I have implemented a new statistical model in R and it works in my sandbox, but I would like to make it more standard. A good comparison is lm(), where I can take a model object and:

  • apply the summary() function
  • extract the coefficients of the model
  • extract residuals from the fitted (training) data
  • update the model
  • apply the predict() function
  • apply plot() to pre-selected descriptive plots
  • engage in many other kinds of joy

I've looked through the R manuals, searched online, and thumbed through several books, and, unless I'm overlooking something, I can't find a good tutorial on what should go into a new model package.

Although I'm most interested in thorough references or guides, I'll keep this post focused on a question with two components:

  1. What are the key components that are usually expected to be in a model object?
  2. What are typical functions that are usually implemented in a modeling package?

Answers could be from the R Core (or package developers) perspective or from the perspective of users, e.g. users expect to be able to use functions like summary, predict, residuals, coefficients, and often expect to pass a formula when fitting a model.

Edit
Report