tmp <- data.frame(x=c(1,1), y=c(1,2)) tmp.lm <- lm(y ~ x, data=tmp) summary(tmp.lm)
coef(summary(tmp.lm)) ## I consider this to be a bug. Since summary(tmp.lm) gives ## two rows for the coefficients, I believe the coef() function ## should also give two rows. > summary(tmp.lm) Call: lm(formula = y ~ x, data = tmp) Residuals: 1 2 -0.5 0.5 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) 1.5 0.5 3 0.205 x NA NA NA NA Residual standard error: 0.7071 on 1 degrees of freedom > coef(summary(tmp.lm)) Estimate Std. Error t value Pr(>|t|) (Intercept) 1.5 0.5 3 0.2048328 > > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day 03 svn rev 39566 language R version.string R version 2.4.0 (2006-10-03) > ## this is a related problem tmp <- data.frame(x=c(1,2), y=c(1,2)) tmp.lm <- lm(y ~ x, data=tmp) summary(tmp.lm) coef(summary(tmp.lm)) ## Here the summary() give NA for the values that can't be ## calculated and the coef() function gives NaN. I think both ## functions should return the same result. > summary(tmp.lm) Call: lm(formula = y ~ x, data = tmp) Residuals: ALL 2 residuals are 0: no residual degrees of freedom! Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0 NA NA NA x 1 NA NA NA Residual standard error: NaN on 0 degrees of freedom Multiple R-Squared: 1, Adjusted R-squared: NaN F-statistic: NaN on 1 and 0 DF, p-value: NA > > coef(summary(tmp.lm)) Estimate Std. Error t value Pr(>|t|) (Intercept) 0 NaN NaN NaN x 1 NaN NaN NaN > > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel