R/ANOPA-contrastProportions.R
contrastProportions.Rd
The function 'contrastProportions()' performs contrasts analyses on proportion data after an omnibus analysis has been obtained with 'anopa()' according to the ANOPA framework. See Laurencelle and Cousineau (2023) for more.
contrastProportions(w = NULL, contrasts = NULL)
An ANOPA object obtained from anopa()
or emProportions()
;
A list that gives the weights for the contrasts to analyze. The contrasts within the list can be given names to distinguish them. The contrast weights must sum to zero and their cross-products must equal 0 as well.
A table of significance of the different contrasts.
contrastProportions()
computes the _F_s for the contrasts,
testing the hypothesis that it equals zero.
The contrasts are each 1 degree of freedom, and the sum of the contrasts'
degrees of freedom totalize the degrees of freedom of the effect being decomposed.
Laurencelle L, Cousineau D (2023). “Analysis of proportions using arcsine transform with any experimental design.” Frontiers in Psychology, 13, 1045436. doi:10.3389/fpsyg.2022.1045436 .
# Basic example using a one between-subject factor design with the data in compiled format.
# Ficticious data present success or failure of observation classified according
# to the state of residency (three levels); 175 participants have been observed in total.
# The cells are unequal:
minimalBSExample
#> state s n
#> 1 Florida 31 57
#> 2 Kentucky 25 73
#> 3 Montana 9 45
# First, perform the omnibus analysis :
w <- anopa( {s;n} ~ state, minimalBSExample)
summary(w)
#> MS df F p correction Fcorr pvalcorr
#> state 0.032384 2 7.335621 0.000652 1.011881 7.24949 0.000711
#> Error 0.004415 Inf
# Compare the first two states jointly to the third, and
# compare the first to the second state:
cw <- contrastProportions( w, list(
contrast1 = c(1, 1, -2)/2,
contrast2 = c(1, -1, 0) )
)
#> [1] 3
#> Not yet programmed...
summary(cw)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> -99 -99 -99 -99 -99 -99