fixef.varComp
and anova.varComp
test for fixed effect contrasts, as well as providing standard errors, etc.
# S3 method for varComp
anova(object, ..., test = c("KR", 'Satterthwaite'), L)
# S3 method for varComp
fixef(object, Lmat, alpha=.05, test=c('KR', 'Satterthwaite'), ...)
# S3 method for varCompFixEf
print(x, ...)
An object of class varComp
.
A matrix specifying the linear combinations of fixed effect parameters to be tested for nullity. Each row is a linear combination. If the column names are non-null, the columns will be re-ordered according to the column names of model.matrix(object)
. In case of a single row matrix, it may also be given as a vector.
The requested level of test.
A character scalar requesting the type of the tests to be performed.
For anova.varComp
, this may be optional additional varComp
objects. For fixef.varComp
and print.varCompFixEf
, this is not used.
For anova.varComp
, this is a data frame with the following columns:
F value
: The scaled \(F\)-statistic;
Scale
: The multiplicative factor in the scaled \(F\)-statistic;
numDF
: The numerator degrees of freedom;
denDF
: The denominator degrees of freedom;
Pr(>F)
: The \(p\)-value.
When …
is missing but L
is given, each row of L
matrix will have a corresponding row in the result, testing the nullity of linear contrasts specified by that row of L
. Additionally, an "Overall" row will be the last row, testing the nullity of linear contrasts of all rows of L
.
When …
is not missing, L
will be ignored and the result will have the same number of rows as the number of varComp
objects given (including the first object
argument). The order of rows is such that the rank of the fixed effect design matrix is non-decreasing, i.e., smaller models first. The results will be the comparison between the current model vs. the model in the preceding row, except for the first row. For the first row, the model being compared is a null model. If the fixed effect design matrix for the model in first row includes the intercept in its column space, the null model includes only an intercept. If the intercept is not in the column space of the first model, the null model will contain no fixed effects.
When both …
and L
are missing, anova.varComp
will test each fixed effect parameters together with a last "Overall" row. However, this last row will remove the intercept from the model, if there is one. See example below.
For fixef.varComp
, the result is an object with class varCompFixEf
. This is a named numeric vector, providing estimates of fixed effect contrasts specified by Lmat
. The name will be the row names of Lmat
. It has the anova
attribute, a numeric matrix with the following columns:
Std. Error
: the standard error of estimate. If test='KR'
, this is the adjusted standard error. If test='Satterthwaite'
, this is the plug-in estimate.
Lower
: the lower limit of the 1-alpha
confidence interval.
Upper
: the upper limit of the 1-alpha
confidence interval.
t value
: the scaled \(t\)-statistic testing nullity of this contrast.
Scale
: a multiplicative factor in the scaled \(t\)-statistic.
Df
: the degrees of freedom for the \(t\)-statistic.
Pr(>|t|)
: the \(p\)-value.
Additionally, the anova
attribute also has the Overall
attribute, which is a single-row matrix with the same columns as the results of anova.varComp
, testing for the overall nullity of linear contrasts specified by Lmat
.
print.varCompFixEf
prints the result from fixef.varComp
and return the argument invisibly.
When neither …
nor L
is given for anova.varComp
, the current implementation will test each fixed effect parameter separately. This behavior might be changed in future releases.
When L
is not explicitly given, the current implementation will rely on getOption("digits")
when trying to find the L
matrix that test the difference between adjacent models.
Michael G. Kenward and James H. Roger (1997) Small sample inference for fixed effects from restricted maximum likelihood. Biometrics 53, 983--997
Waseem S. Alnosaier (2007) Kenward-Roger Approximate \(F\) Test for Fixed Effects in Mixed Linear Models. Oregon State University Department of Statistics Ph.D. Thesis
Fai and Cornelius (1996) Approximate \(F\)-tests of multiple degree of freedom hypotheses in generalized least squares analyses of unbalanced split-plot experiments. Journal of Statistical Computation and Simulation 54, 363-378
# NOT RUN {
library(nlme)
data(Oxide)
vcf = varComp(Thickness~Source, Oxide, ~Lot/Wafer)
vcf0 = varComp(Thickness~1, Oxide, ~Lot/Wafer)
fixef(vcf)
anova(vcf, vcf0)
anova(vcf)
anova(vcf, L=diag(1,2)) ## notice the difference in the last row
# }
Run the code above in your browser using DataLab