Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I have fit a linear model using the lm function in R...

model <- lm(trans.baseline.CD4 ~ hiv$Julian.Date)

... and I would like to assess the quality of the model's fit. Is there a function in R that will do this? Alternatively, I found a formula for goodness-of-fit involving the sum of squared residuals given the null and alternative hypotheses, but I don't know how to get these values either. Any pointers?

Thanks!

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

It all starts with

 summary(model)

after your fit. There are numerous commands to assess the fit, test commands, compare alternative models, ... in base R as well as in add-on packages on CRAN.

But you may want to do some reading, for example with Dalgaard's book or another introduction to statistics with R.

share|improve this answer
3  
(+1) Linear Models with R, by Julian J. Faraway is also a good starting point. –  chl Nov 13 '10 at 18:07
    
Yeah, I guess there's really no escaping me actually digging down and figuring out what exactly I want to compute. I was just hoping there was some sort of standard first approach to use. –  Daniel Standage Nov 13 '10 at 21:14
1  
Yup. With great freedom comes great responsibility. It is easy to just mechanically compute something. It may be much harder to come up something meaningful. Damn No Free Lunch theorem again... –  Dirk Eddelbuettel Nov 13 '10 at 22:15
add comment

You should probably take a look at this:

http://stackoverflow.com/questions/1181025/goodness-of-fit-functions-in-r

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.