Learn R Programming

varComp (version 0.2-0)

varComp.test: Tests for Nullity of Variance Components

Description

These are the user-interface functions to test the nullity of variance components, using linear score tests, projected quadratic score tests, or restricted likelihood ratio tests.

Usage

varComp.test(object, ...)
# S3 method for formula
varComp.test(object, data, random1, varcov1, 
random2, varcov2, fit.control, test.control, ...)
# S3 method for varComp
varComp.test(object, object2, additional.varcov, null, 
test = "LinScore", control = varCompTest.control(test), ...)

Arguments

object, object2

An R object. In varComp.test.formula, this is the fixed-effect formula. In varComp.test.varComp these are the varComp objects specifying the null model and the alternative models. object2 could be missing, but then either additional.varcov or null needs to be given.

data

The same as in varComp.

random1, random2

The random effect formulas for the first and the second models, respectively. Specification is the same as in varComp.

varcov1, varcov2

The lists of variance-covariance matrices for the first and the second models, respectively. Specification is the same as in varComp.

fit.control

A list of arguments of class varComp.control.

test.control, control

A list of arguments of class varCompTest.control.

additional.varcov

An optional list of variance-covariance matrices. It is only used when object2 is missing. When this is given, object will be treated as the null model. And the test of interest is the nullity of variance components corresponding to these additional.varcov. null needs to be missing when additional.varcov is given.

null

An optional integer vector, indicating the variance components in the null model. It is only used when object2 is missing, and is incompatible with additional.varcov. When null is given, object is treated as the alternative model. And the test of interest is the nullity of variance components not included in null. For example, if object has two variance components (other than the error variance). Setting null=1L will test the nullity of the second components, whereas setting null=integer(0L) (the default) will test the simultaneous nullity of both components.

test

A character vector, specifying the tests to be performed. This does not need to be a vector of length 1. Available choices are given in varCompTests. Currently, this includes "LinScore", "VM03", "SS95", "HP01", and "RLRT". However, not all test methods are applicable to all models/hypotheses.

Place holder.

Value

A list of class varComp.test of the same length as test. Each component is either an object of htest or a list of htest objects, depending upon whether multiple methods are requested under the same test. See varCompTest.control for more details on controlling the tests to be performed.

Details

The formula interface varComp.test.formula is primarily used to test two variance component models with the same fixed-effect formula. The two models need to be nested.

In the varComp.test.varComp interface, exactly one of object2, additional.varcov and null needs to be given. If object2 is given, two-model comparison is performed against object. If additional.varcov is given, object is treated as the null and additional.varcov is treated as the additional variance components to be tested. If null is given, object is treated as the alternative and the components not in null will be tested.

References

Qu L, Guennel T, Marshall SL. (2013) Linear Score Tests for Variance Components in Linear Mixed Models and Applications to Genetic Association Studies. Biometrics, Volume 69, Issue 4, pages 883--892.

Daniel B. Hall and Jens T. Praestgaard (2001) Order-restricted tests for homogeneity in generalised linear and nonlinear mixed models. Biometrika, 88, 739--751.

Mervyn J. Silvapulle and Paramsothy Silvapulle (1995) A score test against one-sided alternatives. Journal of the American Statistical Association, 90, 342--349.

Geert Verbeke and Geert Molenberghs (2003) The use of score tests for inference on variance components. Biometrics, 59, 254--262.

Ciprian M. Crainiceanu and David Ruppert (2003) Likelihood ratio tests in linear mixed models with one variance component. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 66, 165--185.

Greven S, Crainiceanu CM Kuchenhoff H and Peters A (2008) Restricted Likelihood Ratio Testing for Zero Variance Components in Linear Mixed Models. Journal of Computational and Graphical Statistics, 17, 870--891.

See Also

varCompTest.control, varComp

Examples

Run this code
# NOT RUN {
### Oxide/Semiconductor data example
library(nlme)
data(Oxide)
lmef = lme(Thickness~Source, Oxide, ~1|Lot/Wafer)
vcf = varComp(Thickness~Source, Oxide, ~Lot/Wafer)
VarCorr(lmef)
coef(vcf, 'varComp') ## same values as above
varComp.test(vcf)  ## test against linear model
varComp.test(vcf, null=1)  ## test against model with only Lot random effect


### Genetics example	
trt=gl(2, 15)
set.seed(2340)
dat=data.frame(trt=trt)
dat$SNP=matrix(sample(0:2, 120, replace=TRUE), 30)
dat$Y  = as.numeric(trt)+rnorm(30) + dat$SNP%*%rnorm(4)
(vcf0 = varComp(Y~trt, dat, ~ibs(SNP)))
(vcf1 = varComp(Y~trt, dat, ~ibs(SNP):trt)) ## two variance components

varComp.test(vcf0)
varComp.test(vcf1)
varComp.test(vcf0, vcf1)
varComp.test(vcf1, null=1)
varComp.test(Y~trt, dat, random1=~ibs(SNP), random2=~trt:ibs(SNP))

# }

Run the code above in your browser using DataLab