Session 1, materials and remarks

If you are logged in, you can download a data sample and the r-syntax file from today's session below. Here are some issues that came up today:



While r's default is to use dummy coding, we used effect coding today, which has the advantages that:

  • you can interpret the intercept directly as the grand mean
  • you can straightforwardly interpret the other coefficiant estimates relative to that mean
  • the main effect terms can be interpreted in the same model as the interaction terms

You might want to have a look at this page which explains how it is done exactly.


iteration limit reached without convergence (9)

this message is shown if the chosen model was so complex that it could not be estimated. This means that you either have to make your model smaller, or collect more data. Often the latter is not possible, here you should start by reducing the random effect structure, e.g. by omitting an interaction.


r syntax

when we excluded the interaction between factor1 and factor3 from our model today, there were two possibilities:

original dependentMeasure ~ factor1*factor2factor1*factor3
version1 dependentMeasure ~ factor1*factor2factor1+factor3
version2 dependentMeasure ~ factor1*factor2factor3


The reason for version1 and version2 being equivalent is that r syntax is always shorthand for the complete formula and that mentioning something twice does not affect the way r will interpret it. You can think of R expanding the two interaction terms as follows:

factor1*factor2 =>  1 + factor1 + factor2 + factor1*factor2 

factor1*factor3 =>  1 + factor1 + factor3 + factor1*factor3 

so overall we have

dependentMeasure ~ 1 + factor1 + factor2 + factor1*factor2 +1 + factor1 + factor3 + factor1*factor3 

everything that is mentioned twice is now erased:

dependentMeasure ~ 1 + factor1 + factor2 + factor1*factor2 + factor3 + factor1*factor3 

If you do the same for version1 and version2, you'll see that you end up with the same formula