Effects coding with more than two levels (orthogonal?)

Home forums Other Discussions Effects coding with more than two levels (orthogonal?)

This topic contains 1 reply, has 2 voices, and was last updated by  John Vokey 1 month, 4 weeks ago.

  • Author
    Posts
  • #315

    Daniel Silva
    Participant

    In Afex documentation and in “An Introduction to Mixed Models for Experimental Psychology”, effects coding (contr.sum()) are mentioned as an example of orthogonal contrasts coding – which requires that 1) “the sum of each variable across observations is zero”, and 2) “the sum of the product of all variable pairs is also zero”. However, doesn’t contr.sum(>2) violate requirement 2? For example: contrast1 [1 0 -1]; contrast2 [0 1 -1]. Sum of the products: (1*0)+(0*1)+(-1*-1)=1. Did I understand it wrong? If not, what caution should I take in interpreting results when using such non-orthogonal contrasts? I have some experimental data for which contr.sum(3) would indeed make much more sense than, for example, contr.helmert(3). However, only the latter seems to me to satisfy requirement 2. In the ANOVA table, results are almost identical for contr.sum(3) and contr.helmert(3), but I am really interested in the fixed effect coefficients provided by summary(lmer(…)) – including interactions with two other two-level factors.

    Kind regards

    Daniel

  • #317

    John Vokey
    Participant

    Daniel,
    Here is a simple example. Let us assume we have two factors, A with 2 levels and B with 3 levels, such that A crosses B, and there are 2 of observations per each of the 2 × 3 = 6 cells, for a total of 12 observations:

    Table 1: Example table of vector codes using “effect coding” for a 2 × 3 factorial experiment, with two observations per cell. As the column sums and the sums of column products across sets are necessarily zero, the sets are necessarily orthogonal (and, hence, uncorrelated) with one another (it is in LaTeX, but you should get the point):

    \begin{table}[t] \centering
    \caption{Example table of vector codes using effect coding” for a $2 \times 3$ factorial experiment, with two observations per cell. As the column sums and the sums of column products across sets are necessarily zero, the sets are necessarily orthogonal (and, hence, uncorrelated) with one another.}
    \label{tbl:effect}
    \footnotesize

    \begin{tabular}{@{\extracolsep{5pt}} c c c c c }
    \\[-1.8ex]\hline
    \hline \\[-1.8ex]
    a & b1 & b2 & ab1 & ab2 \\
    \hline \\[-1.8ex]
    $1$ & $1$ & $0$ & $1$ & $0$ \\
    $1$ & $1$ & $0$ & $1$ & $0$ \\
    $1$ & $0$ & $1$ & $0$ & $1$ \\
    $1$ & $0$ & $1$ & $0$ & $1$ \\
    $1$ & $-1$ & $-1$ & $-1$ & $-1$ \\
    $1$ & $-1$ & $-1$ & $-1$ & $-1$ \\
    $-1$ & $1$ & $0$ & $-1$ & $0$ \\
    $-1$ & $1$ & $0$ & $-1$ & $0$ \\
    $-1$ & $0$ & $1$ & $0$ & $-1$ \\
    $-1$ & $0$ & $1$ & $0$ & $-1$ \\
    $-1$ & $-1$ & $-1$ & $1$ & $1$ \\
    $-1$ & $-1$ & $-1$ & $1$ & $1$ \\
    \hline \\[-1.8ex]
    \normalsize
    \end{tabular}
    \end{table}

You must be logged in to reply to this topic.