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