The libraryANOFA provides easy-to-use tools to analyzefrequency data. It does so using theAnalysis of Frequency datA(ANOFA) framework (the full reference Laurencelle & Cousineau,2023). With this set of tools, you can examined if classificationfactors are non-equal (have an effect) and if theirinteractions (in case you have more than 1 factor) are significant. Youcan also examine simple effects (a.k.a.expected marginalanalyses). Finally, you can assess differences based on orthogonalcontrasts. ANOFA also comes with tools to make a plot of the frequenciesalong with 95% confidence intervals (these intervals are adjusted forpair- wise comparisons Cousineau, Goulet, & Harding, 2021); withtools to compute statistical power given somea priori expectedfrequencies or sample size to reach a certain statistical power. In sum,eveything you need to analyse frequencies!
The main function isanofa() which provide an omnibusanalysis of the frequencies for the factors given. For example, Light& Margolin (1971) explore frequencies for attending a certain typeof higher education as a function of gender:
w<-anofa( obsfreq~ vocation* gender, LightMargolin1971)summary(w)## G df Gcorrected pvalue etasq## Total 266.889 9 NA NA NA## vocation 215.016 4 214.668 0.0000 0.258428## gender 1.986 1 1.985 0.1589 0.003209## vocation:gender 49.887 4 49.555 0.0000 0.301949A plot of the frequencies can be obtained easily with
anofaPlot(w)
Owing to the interaction, simple effects can be analyzed from theexpected marginal frequencies with
e<-emFrequencies(w,~ gender| vocation )summary(e)## G df Gcorrected pvalue etasq## gender | Secondary 0.00813 1 0.008124 1.0000 0.000066## gender | Vocational 2.90893 1 2.906575 0.5736 0.010659## gender | Teacher 3.38684 1 3.384098 0.4957 0.048118## gender | Gymnasium 3.22145 1 3.218840 0.5219 0.057299## gender | University 42.34782 1 42.313530 0.0000 0.289364Follow-up functions includes contrasts examinations with`contrastFrequencies()’.
Power planning can be performed on frequencies usinganofaPower2N() oranofaN2Power if you candetermine theoretical frequencies.
Finally,toRaw(),toCompiled(),toTabulated(),toLong() andtoWide() can be used to present the frequency data in otherformats.
Note that the package is named using UPPERCASE letters whereas themain function is in lowercase letters.
The officialCRAN version can be installed with
install.packages("ANOFA")library(ANOFA)The development version 0.1.3 can be accessed through GitHub:
devtools::install_github("dcousin3/ANOFA")library(ANOFA)The library is loaded with
library(ANOFA)As seen, the libraryANOFA makes it easy to analyzefrequency data. Its general philosophy is that of ANOFAs.
The complete documentation is available on thissite.
A general introduction to theANOFA framework underlyingthis library can be found atthe Quantitative Methods forPsychology Laurencelle & Cousineau (2023).