I try to use MuMIn::dredge()
on a global model to give me my candidate models, given certain criteria. I've read ?dredge
and understood some of it, but I still have some question on how to include one of my criteria:
If I have a global model with e.g.
y ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X1:X2 + X2:X3 + X3:X4 + X4:X6 + X5:X7
(several main effects and several interaction) and I want to specify that I only want dredge to return models which include one interaction at a time, how do I subset this in an easy way?
Also, if the global model also includes a second degree polynomial of a parameter
Y ~ X1 + X1^2 + X2 + X3 + X4
and I want to specify that these two should always exist together in the models (main effects X1
never alone without X1^2
) I understood the syntax for this is (agree?):
dredge(global.model, subset=(X1^2|!X1))
And if I have understood it correctly, dredge()
is taking care of the other way around (the X1^2
will only occur in the model if X1
is in the model - same for interactions which will never occur without the main effects present)?
But how is the syntax for second degree polynomials inside dredge()
? Am I right that it's something like this:
dredge(global.model, subset=({I(X1^2)}|!X1))
?