varComprob {robustvarComp}R Documentation

Fitting variance component models using robust procedures

Description

varComprob and varComprob.fit fit linear mixed-effect models where the marginal variance-covariance matrix is linear in known positive semidefinite matrices. varComprob uses a formula interface, whereas varComprob.fit is the underlying working horse.

Usage

varComprob(fixed, data, random, groups, varcov, weights, subset,
  family = stats::gaussian("identity"), na.action, offset,
  control = varComprob.control(...), doFit = TRUE,
  normalizeTrace = FALSE, contrasts = NULL,
  model = TRUE, X = TRUE, Y = TRUE, K = TRUE, ...)

varComprob.fit(Y, X, V, control = varComprob.control(), ...)

Arguments

fixed

A two-sided formula specifying the fixed effects of the model. This is the same as in stats::lm.

data

An optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(fixed), typically the environment from which varComprob is called. This is the same as the data argument of stats::lm.

random

This argument is not yet used.

groups

a numeric matrix with two columns which is used to group appropriately the observations according to subject. See details below and the example.

varcov

An list of symmetric positive semidefinite matrices. The weighted sum of these matrices represent the contribution of random effects to the marginal variance of the response variable, with unknown weights representing variance components.

weights

This argument is not yet used.

subset

An optional vector specifying a subset of observations to be used in the fitting process.

family

The same as the family argument of stats::glm. However, only gaussian('identity') is supported currently.

na.action

The same as in stats::lm.

offset

The same as in stats::glm. These offsets are assumed as known fixed effects.

control

Usually an object from calling varComprob.control.

doFit

This argument is not yet used.

normalizeTrace

A logical scalar, indicating whether the individual variance-covariance matrices should be normalized such that variance components are on the same scale.

contrasts

The same as in stats::lm.

model

A logical scalar, indicating whether the model frame will be included in the result.

X

For varComprob, this is a logical scalar, indicating whether the fixed-effect design matrix should be included in the result. For varComprob.fit this is the optional numeric array containing the fixed effect design matrix for the model, see details below. If X is missing or an array with zero dimension, it is assumed that Y has zero mean.

Y

For varComprob, this is a logical scalar, indicating whether the response variable should be included in the result. For varComprob.fit, this is a numeric matrix of response variables. See details below.

K

This is a logical scalar, indicating whether the list of variance-covariance matrices should be included in the result. These matrices are those specified by varcov. See details below.

V

This is a numeric array containing the variance-covariance matrices. See details below.

...

When control is given, this is ignored. Otherwise, these arguments are passed to varComprob.control and the result will be used as the control argument.

Details

The variance component model is of form

\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \mathbf{e}

where \mathbf{e} is multivariate normally distributed with mean zero and variance-covariance matrix \mathbf{\Sigma} being

\mathbf{\Sigma} = \sum_{j=1}^R \sigma_j^2 \mathbf{K}_j + \sigma_e^2 \mathbf{I}

in which \mathbf{K}_j are known positive semidefinite matrices and \mathbf{I} is the identity matrix.

In the varComprob formula interface, the \mathbf{X} matrix and response variable are specified by the fixed argument. The varcov argument specifies each variance-covariance matrix in a list.

In varComprob.fit, let p the number of observations, n the number of independent replicates and k the number of regressors. Then Y must be a matrix of dimension p \times n, X must be an array of dimension p \times n \times k and V must be an array of dimension p \times p \times R, where R is the number of variance-covariance matrices.

The model fitting process is performed by a robust procedures. See references for more details.

See varComprob.control for arguments controlling the modeling fitting.

Value

The value of any of the two functions is a list with class varComprob or varComprob.fit respectively. The following elements are present in both

The function varComprob returns also

Author(s)

Claudio Agostinelli and Victor J. Yohai

References

C. Agostinelli and V.J. Yohai (2014) Composite Robust Estimators for Linear Mixed Models. arXiv:1407.2176.

M.P. Victoria-Feser and Copt (2006) High Breakdown Inference in the Mixed Linear Model. Journal of American Statistical Association, 101, 292-300.

Examples

  if (!require(nlme))
    stop()
  data(Orthodont)

  z1 <- rep(1, 4)
  z2 <- c(8,10,12,14)
  K <- list()
  K[[1]] <- tcrossprod(z1,z1) ## Int
  K[[2]] <- tcrossprod(z1,z2) + tcrossprod(z2,z1) ## Int:age
  K[[3]] <- tcrossprod(z2,z2) ## age
  names(K) <- c("Int", "Int:age", "age")
  p <- 4
  n <- 27
  groups <- cbind(rep(1:p, each=n), rep((1:n), p))

  ## Not run: 

  ## Composite S
  OrthodontCompositeS <- varComprob(distance ~ age*Sex, groups = groups,
      data = Orthodont, varcov = K,
      control=varComprob.control(method="compositeS", lower=c(0,-Inf,0)))
  
## End(Not run)

  ## Composite Tau
  OrthodontCompositeTau <- varComprob(distance ~ age*Sex, groups = groups,
      data = Orthodont, varcov = K,
      control=varComprob.control(lower=c(0,-Inf,0)))

  ## Not run: 

  summary(OrthodontCompositeTau)

  ## Classic S
  OrthodontS <- varComprob(distance ~ age*Sex, groups = groups,
      data = Orthodont, varcov = K,
      control=varComprob.control(lower=c(0,-Inf,0),
      method="S", psi="rocke"))

  summary(OrthodontS)
  
## End(Not run)
  ## Not run: 

  if (!require(WWGbook))
    stop()
  if (!require(nlme))
    stop()
  data(autism)
  autism <- autism[complete.cases(autism),]
  completi <- table(autism$childid)==5
  completi <- names(completi[completi])
  indici <- as.vector(unlist(sapply(completi,
              function(x) which(autism$childid==x))))
  ind <- rep(FALSE, nrow(autism))
  ind[indici] <- TRUE
  autism <- subset(autism, subset=ind) ## complete cases 41
  attach(autism)
  sicdegp.f <- factor(sicdegp)
  age.f <- factor(age)
  age.2 <- age - 2
  sicdegp2 <- sicdegp
  sicdegp2[sicdegp == 3] <- 0
  sicdegp2[sicdegp == 2] <- 2 
  sicdegp2[sicdegp == 1] <- 1
  sicdegp2.f <- factor(sicdegp2)
  autism.updated <- subset(data.frame(autism, 
                    sicdegp2.f, age.2), !is.na(vsae))
  autism.grouped <- groupedData(vsae ~ age.2 | childid, 
                    data=autism.updated, order.groups = FALSE)
  p <- 5
  n <- 41
  z1 <- rep(1, p)
  z2 <- c(0, 1, 3, 7, 11)
  z3 <- z2^2
  K <- list()
  K[[1]] <- tcrossprod(z1,z1)
  K[[2]] <- tcrossprod(z2,z2)
  K[[3]] <- tcrossprod(z3,z3)
  K[[4]] <- tcrossprod(z1,z2) + tcrossprod(z2,z1)
  K[[5]] <- tcrossprod(z1,z3) + tcrossprod(z3,z1)
  K[[6]] <- tcrossprod(z3,z2) + tcrossprod(z2,z3)
  names(K) <- c("Int", "age", "age2", "Int:age", "Int:age2", "age:age2")

  groups <- cbind(rep(1:p, each=n), rep((1:n), p))

  ## Composite Tau
  AutismCompositeTau <- varComprob(vsae ~ age.2 + I(age.2^2)
    + sicdegp2.f + age.2:sicdegp2.f + I(age.2^2):sicdegp2.f, 
    groups = groups,
    data = autism.grouped, varcov = K,
    control=varComprob.control(
    lower=c(0.01,0.01,0.01,-Inf,-Inf,-Inf)))

  summary(AutismCompositeTau)

  ## Classic S
  AutismS <- varComprob(vsae ~ age.2 + I(age.2^2)
    + sicdegp2.f + age.2:sicdegp2.f + I(age.2^2):sicdegp2.f, 
    groups = groups,
    data = autism.grouped, varcov = K,
    control=varComprob.control(
    method="S", psi="rocke", cov.init="covOGK",
    lower=c(0.01,0.01,0.01,-Inf,-Inf,-Inf)))
  summary(AutismS)
  
## End(Not run)

[Package robustvarComp version 0.1-7 Index]