Skip to content

extract variables from linear model

2 messages · Joerg Schaber, jruohonen

#
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
#
wouldn't a simple 

coef(fit)[2] 

work?

Jukka Ruohonen.