Goodness of fit functions in R

medriscoll picture medriscoll · Jul 25, 2009 · Viewed 23.6k times · Source

What functions do you use in R to fit a curve to your data and test how well that curve fits? What results are considered good?

Answer

Dirk Eddelbuettel picture Dirk Eddelbuettel · Jul 25, 2009

Just the first part of that question can fill entire books. Just some quick choices:

  • lm() for standard linear models
  • glm() for generalised linear models (eg for logistic regression)
  • rlm() from package MASS for robust linear models
  • lmrob() from package robustbase for robust linear models
  • loess() for non-linear / non-parametric models

Then there are domain-specific models as e.g. time series, micro-econometrics, mixed-effects and much more. Several of the Task Views as e.g. Econometrics discuss this in more detail. As for goodness of fit, that is also something one can spend easily an entire book discussing.