[R] leaps: regsubsets, formula including interactions

Jonne Zutt j.zutt at tudelft.nl
Wed Oct 3 11:22:35 CEST 2007


Hi R-list members,

Could somebody explain to me the meaning of the '.' in the formula
SumTL~. below? I could not find it in the help pages. I'm guessing it is
substituted by v1+v2+v3+.. for all independent variables vi.
  Furthermore, I would like to add interaction effects to the model,
is this also possible with the '.'?

> library(leaps)
> d<-regsubsets(SumTL~.,nbest=2,data=dat[,-c(2,9)])
> x11() ; par(mfrow=c(1,4)) ; plot(d) ; plot(d,scale="Cp") ;
plot(d,scale="adjr2") ; plot(d,scale="r2")

My data 'dat' variable looks like this:

> str(dat)
'data.frame':   548 obs. of  9 variables:
 $ SumTL: int  13500 67800 158000 299000 486000 712000 56100 162000
310000 471000 ...
 $ SumUL: int  13800 69700 163000 308000 497000 726000 58100 168000
319000 481000 ...
 $ Ord  : int  96 192 288 384 480 576 192 288 384 480 ...
 $ Incid: int  0 0 0 0 0 0 0 0 0 0 ...
 $ f1   : int  1 1 1 1 1 1 1 1 1 1 ...
 $ f2   : int  0 0 0 0 0 0 0 0 0 0 ...
 $ f3   : int  0 0 0 0 0 0 0 0 0 0 ...
 $ f4   : int  0 0 0 0 0 0 0 0 0 0 ...
 $ f5   : int  0 0 0 0 0 0 0 0 0 0 ...

Thanks,
Jonne.



More information about the R-help mailing list