You can use "sink" to dump the output to a file. If you want
something more elegant, let's first store the fit from the first example
on the help page (S-Plus 6.2 for Windows Professional Edition):
fit <- lm(Fuel ~ . , data = fuel.frame)
You said you "cut/paste the MSE from the report". I don't know
how you get the MSE, but I assume it's from anova(fit). From
"attributes(anova(fit))", we learn that this has $class = "anova" and
"data.frame", AND its names include "Mean Sq" and row.names include
"Residuals". Thus, the following is the number you want:
anova(fit)["Residuals", "Mean Sq"]
You can write the whole anova table using "write.table" or just
this number using "write" or "cat".
If this still doesn't solve your problem, please give us a very
small example of something you tried that you think should work but
doesn't. If someone can copy a couple of lines from your email and
paste them into S-Plus, they are more likely to understand what you want
and can quickly test ideas regarding possible solutions.
hope this helps.
spencer graves
Shepherd, Marsha (NIH/NIEHS) wrote:
How can I extract the variance estimate from a linear model (lm)? Getting
the betas are easy. I have cut/paste the MSE from the report - but I need
to automate the program so cut/paste will not work.
Thank you,
Marsha
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|