On Thu, 2007-10-11 at 11:41 -0700, Jiong Zhang, PhD wrote: > Hi All, > > How do I get the sample size in lm? I know it is not reported by "summary". > > Thanks. > > jiong
You need to be careful to understand the difference between the sample size in the original data frame and the actual sample size used in the creation of the model. Missing data may contribute to a reduction in sample size depending upon the value of 'na.action'. See the 'na.action' argument in ?lm for more information. In general however, you can use: nrow(model.frame(lmObject)) See ?model.frame for more information. HTH, Marc Schwartz ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.