extract variables from linear model

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

extract variables from linear model

Jörg Schaber
Hi,

I fitted a linear model:
fit <- lm(y ~ a * b + c - 1 , na.action='na.omit')

Now I want to extract only the a * b effects with confidence intervals.
Of course, I can just add the coefficients by hand, but I think there
should an easier way.
I tried with predict.lm using the 'terms' argument, but I didn't manage
to do it.
Any hints are appreciated,

best,

joerg

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: extract variables from linear model

jruohonen
> I fitted a linear model:
> fit <- lm(y ~ a * b + c - 1 , na.action='na.omit')

wouldn't a simple

coef(fit)[2]

work?

Jukka Ruohonen.

> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html