This function performs analysis of variance when the factor(s) of interest has/have ordinal scale level. For testing, values from the null distribution are simulated.
1 2 
x 
a vector or matrix of integers 1,2,... giving the observed levels
of the ordinal factor(s). If 
y 
the vector of response values. 
type 
the type of test to carry out: likelihood ratio ("LRT") or restricted likelihood ratio ("RLRT"). 
nsim 
number of values to simulate from the null distribution. 
null.sample 
a vector, or a list of vectors (in case of multifactorial
ANOVA) containing values already simulated from the null distribution
(overrides 
... 
additional arguments to 
The method assumes that ordinal factor levels (contained in vector/columns of
matrix x
) take values 1,2,...,max, where max denotes the highest level
of the respective factor observed in the data. Every level between 1 and max has
to be observed at least once.
The method uses a mixed effects formulation of the usual one or multifactorial
ANOVA model (with main effects only) while penalizing (squared) differences of
adjacent means. Testing for equal means across factor levels is done by
(restricted) likelihood ratio testing for a zero variance component in a linear
mixed model. For simulating values from the finite sample null
distribution of the (restricted) likelihood ratio statistic, the
algorithms implemented in Package RLRsim
are used. See
LRTSim
and RLRTSim
for further information.
If x
is a vector (or onecolumn matrix), onefactorial ANOVA is applied,
and it is simulated from the exact finite sample null distribution as derived by
Crainiceanu & Ruppert (2004). If x
is a matrix, multifactorial ANOVA
(with main effects only) is done, and the approximation of the finite sample null
distribution proposed by Greven et al. (2008) is used. Simulation
studies by Gertheiss (2014) suggest that for ANOVA with ordinal factors RLRT
should rather be used than LRT.
In case of onefactorial ANOVA, a list of class htest
containing the
following components (see also exactLRT
and exactRLRT
):
statistic 
the observed (restricted) likelihood ratio. 
p 
pvalue for the observed test statistic. 
method 
a character string indicating what type of test was performed and how many values were simulated to determine the critical value. 
sample 
the samples from the null distribution returned by

In case of multifactorial ANOVA, a list (of lists) with the jth component giving the results above when testing the main effect of factor j.
Jan Gertheiss
Crainiceanu, C. and D. Ruppert (2004). Likelihood ratio tests in linear mixed models with one variance component, Journal of the Royal Statistical Society B, 66, 165185.
Gertheiss, J. (2014). ANOVA for factors with ordered levels, Journal of Agricultural, Biological and Environmental Statistics, 19, 258277.
Gertheiss, J. and F. Oehrlein (2011). Testing relevance and linearity of ordinal predictors, Electronic Journal of Statistics, 5, 19351959.
Greven, S., C. Crainiceanu, H. Kuechenhoff, and A. Peters (2008). Restricted likelihood ratio testing for zero variance components in linear mixed models, Journal of Computational and Graphical Statistics, 17, 870891.
Scheipl, F., S. Greven, and H. Kuechenhoff (2008). Size and power of tests for a zero random effect variance or polynomial regression in additive and linear mixed models, Computational Statistics & Data Analysis, 52, 32833299.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  # load some data
data(ICFCoreSetCWP)
# the pysical health component summary
y < ICFCoreSetCWP$phcs
# consider the first ordinal factor
x < ICFCoreSetCWP[,1]
# adequate coding
x < as.integer(x  min(x) + 1)
# ANOVA
ordAOV(x, y, type = "RLRT", nsim=1000000)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.