Marino Taussig De Bodonia, Agnese <agnese.marino09 <at> imperial.ac.uk> writes:
> I am using the package "MuMI" to run all the possible combinations > of variables in my full model, and select > my best models. When I enter my variables in the original model I > write them like this > > lm(y~ a +b +c +a:b) > > However, "MuMI" will also use the variable b:a, which I do not want > in my model. > > How do I stop that from happening? > (1) I think you mean "MuMIn". (2) Please send a reproducible example! (Hint: see the posting guide that is referred to at the bottom of all R-help messages ...) (3) [now proceeding to try to guess what you mean ...] a:b and b:a have identical meanings in the R formula syntax. I tried to do something like what I thought you might have meant and got what seemed to be reasonable answers. > library(MuMIn) > dat <- data.frame(y=runif(100),a=factor(sample(1:5,replace=TRUE,size=100)), + b= factor(sample(1:5,replace=TRUE,size=100)), c=runif(100)) > m1 <- lm(y~a+b+c+a:b,data=dat) > dredge(m1) Global model: lm(formula = y ~ a + b + c + a:b, data = dat) --- Model selection table (Int) a b c a:b k R.sq Adj.R.sq RSS AIC AICc delta weight 4 0.6385 -0.1643 3 0.03019 0.020290 7.386 29.23 29.48 0.0000 0.420 1 0.5530 2 0.00000 0.000000 7.616 30.29 30.42 0.9392 0.262 7 0.6283 + -0.1461 7 0.09397 0.045770 6.900 30.42 31.64 2.1650 0.142 3 0.5533 + 6 0.07067 0.031540 7.077 30.96 31.87 2.3890 0.127 6 0.6134 + -0.2199 7 0.06700 0.017370 7.105 33.36 34.57 5.0980 0.033 2 0.5202 + 6 0.01989 -0.021380 7.464 36.28 37.19 7.7100 0.009 8 0.6232 + + -0.1941 11 0.12050 0.032540 6.698 35.45 38.45 8.9760 0.005 5 0.5352 + + 10 0.08490 0.004455 6.969 37.42 39.89 10.4100 0.002 10 0.7433 + + -0.2504 + 27 0.27800 0.034140 5.498 47.71 68.71 39.2400 0.000 9 0.6193 + + + 26 0.23150 -0.014420 5.853 51.96 71.19 41.7200 0.000 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.