There are a few things here.
First, you better combine variables with data.frame:
df <- data.frame(y=rnorm(10), x1=rnorm(10), x2 = rnorm(10)) fit <- lm(y~x1+x2, data=df)
If you do, then using the prediction model with the new dataset is much easier.
Secondly, some of the fitness statistics are available from the model itself, and some of them are available from summary(fit) .
coef <- coefficients(fit)
To get odds statistics, you need to use a summary:
stat.coef <- summary(fit)$coefficients coef <- stat.coef[,1] # 1st column: coefficients (same as above) se.coef <- stat.coef[,2] # 2nd column: se for each coef t.coef <- stat.coef[,3] # 3rd column: t-value for each coef p.coef <- stat.coef[,4] # 4th column: p-value for each coefficient
source share