Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to remove a lower order parameter in a model when the higher order parameters remain?
    text
    copied!<p><strong>The problem:</strong> I cannot remove a lower order parameter (e.g., a main effects parameter) in a model as long as the higher order parameters (i.e., interactions) remain in the model. Even when doing so, the model is refactored and the new model is not nested in the higher model.<br> See the following example (as I am coming from ANOVAs I use <code>contr.sum</code>):</p> <pre><code>d &lt;- data.frame(A = rep(c("a1", "a2"), each = 50), B = c("b1", "b2"), value = rnorm(100)) options(contrasts=c('contr.sum','contr.poly')) m1 &lt;- lm(value ~ A * B, data = d) m1 ## Call: ## lm(formula = value ~ A * B, data = d) ## ## Coefficients: ## (Intercept) A1 B1 A1:B1 ## -0.005645 -0.160379 -0.163848 0.035523 m2 &lt;- update(m1, .~. - A) m2 ## Call: ## lm(formula = value ~ B + A:B, data = d) ## Coefficients: ## (Intercept) B1 Bb1:A1 Bb2:A1 ## -0.005645 -0.163848 -0.124855 -0.195902 </code></pre> <p>As can be seen, although I remove one parameter (<code>A</code>), the new model (<code>m2</code>) is refactored and is <strong>not nested</strong> in the bigger model (<code>m1</code>). If I transform my factors per hand in numerical contrast variables I can get the desired results, but how do I get it using R's factor capabilities?</p> <p><strong>The Question:</strong> How can I remove a lower order factor in R and obtain a model that really misses this parameter and is not refactored (i.e., the number of parameters in the smaller model must be lower)?</p> <hr> <p><strong>But why?</strong> I want to obtain 'Type 3' like p-values for a <code>lmer</code> model using the <code>KRmodcomp</code> function from the <code>pbkrtest</code> package. So this example is really just an example.</p> <p><strong>Why not CrossValidated?</strong> I have the feeling that this is really more of an R then a stats question (i.e., I know that you should never fit a model with interactions but without one of the main effects, but I still want to do it).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload