[R] "glmulti": defining which intractions between variables are to be included

Marino Taussig De Bodonia, Agnese agnese.marino09 at imperial.ac.uk
Tue Aug 3 18:04:21 CEST 2010


Hello,

I'm using the "glmulti" package to run models of all the possible combinations of my variables. However, I am only interested in a few interactions between my variables.

I have tried the equivalent of:

mod1<-lm(y~a+b+c+a:b)
glmulti(mod1, level=1)

mod2<-lm(y~a+b+c+a:b)
glmulti(mod2, level=2)

and 

glmulti("y", c("a", "b", "c"), exclude=c("a:c", "b:c" ), data=mydata)

where "mydata" is an object reading a text file.

However, the first code only gives me combinations of main effects (without interactions), the second code doesn't allow me to exclude the a:c and b:c interactions, and the third code doesn't allow me to define my variables as factors becuase it uses character strings (and therefore runs a lot more models than necessary). 

Is there a way to use the third code, but tell R that some of the character strings are factors?

Otherwise, since there are a lot more incteractions that I do not wish to test than interactions that I do wish to test, is there an alternative by which instead of having to exclude the interactions that I do not wish to test, I can simply run models with the interaction terms that I include in my lm fromula? 

Thank you in advance for your time,

Agnese


More information about the R-help mailing list