Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understood correctly, your model is already doing the interpretation you would wish to have inside <code>target==TRUE</code>. If I am correct, you could translate the model terms in your example as follows:</p> <pre><code>"(Intercept)" -&gt; target==TRUE, cond==0 (even if model matrix contains all conds) "cond1" -&gt; target==TRUE, cond==1 on top of cond==0 "cond2" -&gt; target==TRUE, cond==2 on top of cond==0 "targetFALSE" -&gt; target==FALSE, cond==0 (even if model matrix contains all conds) "cond1:targetFALSE" -&gt; target==FALSE, cond==1 on top of cond==0 "cond2:targetFALSE" -&gt; target==FALSE, cond==2 on top of cond==0 </code></pre> <p>So isn't the interesting difference detected in terms <code>"(Intercept)"</code>, <code>"cond1"</code> and <code>"cond2"</code>? Taking a look at the fixed effects' model matrix structure in <code>getME(stu3,'X')</code> may be helpful.</p> <p>Below is an example data I constructed to test your case. Notice that I built three different responses: one without any effect, one with just <code>target==TRUE</code> effect, and one with an effect for <code>target==TRUE</code> and an interaction effect with <code>target==TRUE</code> and the different levels of <code>cond</code>. The artificially introduced effect is detected in <code>fit1</code> and <code>fit2</code>:</p> <pre><code>set.seed(0) struct &lt;- expand.grid(target = c(FALSE,TRUE), cond = as.factor(0:2), patient = LETTERS[1:20]) attach(struct) ranpatient &lt;- rep(rnorm(20), each=6) rerror &lt;- rnorm(120) # Just random noise response0 &lt;- ranpatient + rerror # When target==TRUE we increment the response by 1 and add errors response1 &lt;- 1*target + ranpatient + rerror # When target==TRUE we increment the response by 1, # to which we also add an interaction effect condition {0,1,2} * target {0,1} # notice that numeric transformation of cond {0,1,2} transforms to ranks {1,2,3} response2 &lt;- 1*target + target*(as.numeric(cond)-1) + ranpatient + rerror dat &lt;- data.frame(cond, target, patient, response0, response1, response2) detach(struct) require(lme4) fit0 &lt;- lmer(response0 ~ cond*target + (1|patient), data=dat) fit1 &lt;- lmer(response1 ~ cond*target + (1|patient), data=dat) fit2 &lt;- lmer(response2 ~ cond*target + (1|patient), data=dat) head(dat) round(coef(summary(fit0)),2) # Notice low t values round(coef(summary(fit1)),2) # High t value for targetTRUE round(coef(summary(fit2)),2) # High t value for interaction cond0/1/2 with targetTRUE # Notice how cond==1 adds 1, and cond==2 adds 2 in comparison to cond==0 when targetTRUE # Notice also that coefficient "cond2:targetTRUE" is incremental to term "targetTRUE", not "cond1:targetTRUE" head(getME(fit2,'X')) # Columns correspond to the fixed effect terms </code></pre> <p>With the output</p> <pre><code>&gt; head(dat) cond target patient response0 response1 response2 1 0 FALSE A 1.038686 1.038686 1.038686 2 0 TRUE A 1.640350 2.640350 2.640350 3 1 FALSE A 1.396291 1.396291 1.396291 4 1 TRUE A 2.067144 3.067144 4.067144 5 2 FALSE A 1.205848 1.205848 1.205848 6 2 TRUE A 1.766562 2.766562 4.766562 &gt; round(coef(summary(fit0)),2) # Notice low t values Estimate Std. Error t value (Intercept) -0.13 0.31 -0.40 cond1 0.18 0.29 0.62 cond2 0.00 0.29 0.00 targetTRUE 0.00 0.29 -0.01 cond1:targetTRUE 0.13 0.41 0.32 cond2:targetTRUE 0.08 0.41 0.19 &gt; round(coef(summary(fit1)),2) # High t value for targetTRUE Estimate Std. Error t value (Intercept) -0.13 0.31 -0.40 cond1 0.18 0.29 0.62 cond2 0.00 0.29 0.00 targetTRUE 1.00 0.29 3.42 cond1:targetTRUE 0.13 0.41 0.32 cond2:targetTRUE 0.08 0.41 0.19 &gt; round(coef(summary(fit2)),2) # High t value for interaction cond0/1/2 with targetTRUE Estimate Std. Error t value (Intercept) -0.13 0.31 -0.40 cond1 0.18 0.29 0.62 cond2 0.00 0.29 0.00 targetTRUE 1.00 0.29 3.42 cond1:targetTRUE 1.13 0.41 2.75 cond2:targetTRUE 2.08 0.41 5.04 &gt; # Notice how cond==1 adds 1, and cond==2 adds 2 in comparison to cond==0 when targetTRUE &gt; # Notice also that coefficient "cond2:targetTRUE" is incremental to term "targetTRUE", not "cond1:targetTRUE" &gt; head(getME(fit2,'X')) # Columns correspond to the fixed effect terms [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 0 0 0 0 0 [2,] 1 0 0 1 0 0 [3,] 1 1 0 0 0 0 [4,] 1 1 0 1 1 0 [5,] 1 0 1 0 0 0 [6,] 1 0 1 1 0 1 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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