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 |
data |
An optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from |
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 |
na.action |
The same as in |
offset |
The same as in
|
control |
Usually an object from calling |
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 |
model |
A logical scalar, indicating whether the model frame will be included in the result. |
X |
For |
Y |
For |
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
|
V |
This is a numeric array containing the variance-covariance matrices. See details below. |
... |
When |
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
call
: the actual call.beta
: a named numeric vector of parameter estimates. These are the estimated of the fixed effect parameters.vcov.beta
: estimated variance-covariance matrix of the estimated fixed effects parameters.eta
: a named numeric vector of parameter estimates. These are the estimated variance components.vcov.eta
: estimated variance-covariance matrix of the estimated random effects variance parameters.gamma
: a named numeric vector of parameter estimates. These are the estimated ratio of each variance component relative to the error variance.vcov.gamma
: estimated variance-covariance matrix of the estimated ratio of random effects variance parameters with respect the estimated error variance.eta0
: the estimated error variance.resid
: residuals in matrix formp \times n
.weights
: final weights of the iterative fixed point equations.dotweights
: another type of weight. See references for details.Sigma
: an estimates of the variance-covariance marginal matrix.scales
: the scales in case of composite robust procedures otherwiseNULL
.scale
: the scale in case of classical robust procedures otherwiseNULL
.min
: the minimum attains by the goal function.scale0
:initial.values
: a list with the following components:beta
: initial value for the fixed parameters;gamma
: initial value for the ratio of each variance component relative to the error variance;eta0
: initial value for the errot variance;scales
: initial value for the scales in case of composite robust methods otherwise is not available;scale
: initial value for the scale in case of classic robust methods otherwise is not available.iterations
: number of iterations.control
: thecontrol
argument.method
: the robust method used to perform the estimation.
The function varComprob
returns also
-
fixed
: the same asbeta
. -
parms
: the same asgamma
. -
sigma2
: the same aseta0
. -
nobs
: the number of observations. -
na.action
: thena.action
used in the model frame. -
offset
: the same as input. -
contrasts
: the contrast used in the fixed-effect design matrix. -
random.labels
: the labels used to differentiate random effects. Note that the error variance is not included here. It is safe to check the number of variance components specified by the model by checking the length ofrandom.labels
.
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)