rmodel-comparison

MuMIn::dredge(). Exclude models only including main effect, keep only models with interactions


Is it possible to make a general logical statement for subsetting away (exclude) all potential models that only include the main effect of e.g. A?

y ~ A + B + C + A:C + A:B

For models including A, only include those where A is a part of an interaction (as the relationship y~A would make no sense by itself).


Solution

  • Either !A || {A:B} || {A:C} or dc(A:B, A) && dc(A:C, A) but there is no notation for specifying "any interaction containing A".

    Update: In MuMIn >= 1.42.3 (for the time being, on R-Forge) you can use the dot . pseudo-function to specify any or all interaction containing specific first-order term. For example .(A, 2:100) includes models if they contain any 2nd to 100-th order interaction terms with A. It is still experimental feature, so check if you get what you expected.