Forfatter av avsnitt: Danielle J. Navarro and David R. Foxcroft

Ulike måter å spesifisere kontraster på

I forrige avsnitt viste jeg deg en metode for å konvertere en faktor til en samling kontraster. I metoden jeg viste deg, spesifiserte vi et sett med binære variabler der vi definerte en tabell som denne:

drug

druganxifree

drugjoyzepam

placebo

0

0

anxifree

1

0

joyzepam

0

1

Each row in the table corresponds to one of the factor levels, and each column corresponds to one of the contrasts. This table, which always has one more row than columns, has a special name. It is called a contrast matrix. However, there are lots of different ways to specify a contrast matrix. In this section I discuss a few of the standard contrast matrices that statisticians use and how you can use them in jamovi. If you are planning to read the section on unbalanced ANOVA later on (section Faktoriell ANOVA 3: ubalanserte design), it is worth reading this section carefully. If not, you can get away with skimming it, because the choice of contrasts does not matter much for balanced designs.

Behandlingskontraster

In the particular kind of contrasts that I have described above, one level of the factor is special, and acts as a kind of “baseline” category (i.e., placebo in our example), against which the other two are defined. The name for these kinds of contrasts is treatment contrasts, also known as “dummy coding”. In this contrast each level of the factor is compared to a base reference level, and the base reference level is the value of the intercept.

The name reflects the fact that these contrasts are quite natural and sensible when one of the categories in your factor really is special because it actually does represent a baseline. That makes sense in our clinicaltrial data. The placebo condition corresponds to the situation where you do not give people any real drugs, and so it is special. The other two conditions are defined in relation to the placebo. In one case you replace the placebo with Anxifree, and in the other case your replace it with Joyzepam.

The table shown above is a matrix of treatment contrasts for a factor that has three levels. But suppose I want a matrix of treatment contrasts for a factor with five levels? You would set this out like this:

Level   2 3 4 5
  1     0 0 0 0
  2     1 0 0 0
  3     0 1 0 0
  4     0 0 1 0
  5     0 0 0 1

In this example, the first contrast is level 2 compared with level 1, the second contrast is level 3 compared with level 1, and so on. Notice that, by default, the first level of the factor is always treated as the baseline category (i.e., it is the one that has all zeros and does not have an explicit contrast associated with it). In jamovi you can change which category is the first level of the factor by manipulating the order of the levels of the variable shown in the Data Variable window (double click on the name of the variable in the spreadsheet column to bring up the Data Variable view).

Helmert kontrasterer

Treatment contrasts are useful for a lot of situations. However, they make most sense in the situation when there really is a baseline category, and you want to assess all the other groups in relation to that one. In other situations, no such baseline category exists, and it may make more sense to compare each group to the mean of the other groups. Helmert contrasts, generated by the Helmert option in the jamovi ANOVAContrasts selection box, compare each group to the mean of the “previous” ones. That is, the first contrast represents the difference between group 2 and group 1, the second contrast represents the difference between group 3 and the mean of groups 1 and 2, and so on. This translates to a contrast matrix that looks like this for a factor with five levels:

1   -1   -1   -1   -1
2    1   -1   -1   -1
3    0    2   -1   -1
4    0    0    3   -1
5    0    0    0    4

With Helmert contrasts, every contrast sums to zero (i.e., all the columns sum to zero). This has the consequence that, when we interpret the ANOVA as a regression, the intercept term corresponds to the grand mean µ.. if we are using Helmert contrasts. Compare this to treatment contrasts, in which the intercept term corresponds to the group mean for the baseline category. It does not matter very much if you have a balanced design, which we have been assuming so far, but it will turn out to be important later when we consider unbalanced designs in section Faktoriell ANOVA 3: ubalanserte design. In fact, the main reason why I have included this section is that contrasts become important if you want to understand unbalanced ANOVA.

Sum til null kontraster

The third option are “sum to zero” contrasts, called Simple contrasts in jamovi, which are used to construct pairwise comparisons between groups. Specifically, each contrast encodes the difference between one of the groups and a baseline category, which corresponds to the first group:

1   -1   -1   -1   -1
2    1    0    0    0
3    0    1    0    0
4    0    0    1    0
5    0    0    0    1

I likhet med Helmert-kontraster ser vi at hver kolonne summerer til null, noe som betyr at termen for intercept tilsvarer det totale gjennomsnittet når ANOVA behandles som en regresjonsmodell. Når man tolker disse kontrastene, er det viktig å være klar over at hver av disse kontrastene er en parvis sammenligning mellom gruppe 1 og en av de fire andre gruppene. Kontrast 1 tilsvarer en «gruppe 2 minus gruppe 1»-sammenligning, kontrast 2 tilsvarer en «gruppe 3 minus gruppe 1»-sammenligning, og så videre.[1]

Valgfrie kontraster i jamovi

jamovi can generate different kinds of contrasts in an ANOVA. The following contrast types are available in the drop-down menu Contrasts of the ANOVA analysis panel:

Kontrasttype

Hva sammenligner kontrasten?

Avvik

Sammenligner gjennomsnittet for hvert nivå (unntatt en referansekategori) med gjennomsnittet for alle nivåene (grand mean).

Enkelt

I likhet med behandlingskontraster sammenligner den enkle kontrasten gjennomsnittet av hvert nivå med gjennomsnittet av et spesifisert nivå. Denne typen kontrast er nyttig når det finnes en kontrollgruppe. Som standard er den første kategorien referansen. Med en enkel kontrast er imidlertid skjæringspunktet (intercept) det totale gjennomsnittet av alle nivåene av faktorene.

Forskjell

Sammenligner gjennomsnittet av hvert nivå (unntatt det første) med gjennomsnittet av de foregående nivåene. (Noen ganger kalt omvendt Helmert-kontrast).

Helmert

Sammenligner gjennomsnittet for hvert nivå av faktoren (unntatt det siste) med gjennomsnittet for de påfølgende nivåene.

Gjentatt

Sammenligner gjennomsnittet for hvert nivå (bortsett fra det siste) med gjennomsnittet for det påfølgende nivået.

Polynomisk

Sammenligner den lineære effekten og den kvadratiske effekten. Den første frihetsgraden inneholder den lineære effekten på tvers av alle kategorier, mens den andre frihetsgraden inneholder den kvadratiske effekten. Disse kontrastene brukes ofte til å estimere polynomiske trender.