# 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

1 2 3 4 5 6 7 | ```
varComp.test(object, ...)
## S3 method for class 'formula'
varComp.test(object, data, random1, varcov1,
random2, varcov2, fit.control, test.control, ...)
## S3 method for class 'varComp'
varComp.test(object, object2, additional.varcov, null,
test = "LinScore", control = varCompTest.control(test), ...)
``` |

### Arguments

`object, object2` |
An R object. In |

`data` |
The same as in |

`random1, random2` |
The random effect formulas for the first and the second models, respectively. Specification is the same as in |

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

`fit.control` |
A list of arguments of class |

`test.control, control` |
A list of arguments of class |

`additional.varcov` |
An optional list of variance-covariance matrices. It is only used when |

`null` |
An optional integer vector, indicating the variance components in the null model. It is only used when |

`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 |

`...` |
Place holder. |

### 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.

### 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.

### Author(s)

Long Qu

### 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
### 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))
``` |