var.components: Variance components estimation

var.componentsR Documentation

Variance components estimation

Description

Computes estimated effects, standard errors and process variance for a set of estimates

Usage

var.components(
  theta,
  design,
  vcv,
  alpha = 0.05,
  upper = 10 * max(vcv),
  LAPACK = TRUE
)

Arguments

theta

vector of parameter estimates

design

design matrix for combining parameter estimates

vcv

estimated variance-covariance matrix for parameters

alpha

sets 1-alpha confidence limit on sigma

upper

upper limit for process variance

LAPACK

argument passed to call to qr for qr decomposition and inversion

Details

Computes estimated effects, standard errors and process variance for a set of estimates using the method of moments estimator described by Burnham and White (2002). The design matrix specifies the manner in which the estimates (theta) are combined. The number of rows of the design matrix must match the length of theta.

If you select specific values of theta, you must select the equivalent sub-matrix of the variance-covariance matrix. For instance, if the parameter indices are $estimates[c(1:5,8)] then the appropriate definition of the vcv matrix would be vcv=vcv[c(1:5,8), c(1:5,8)], if vcv is nxn for n estimates. Note that get.real will only return the vcv matrix of the unique reals so the dimensions of estimates and vcv will not always match as in the example below where estimates has 21 rows but with the time model there are only 6 unique Phis so vcv is 6x6.

To get a mean estimate use a column matrix of 1's (e.g., design=matrix(1,ncol=1,nrow=length(theta)). The function returns a list with the estimates of the coefficients for the design matrix (beta) with one value per column in the design matrix and the variance-covariance matrix (vcv.beta) for the beta estimates. The process variance is returned as sigma.

Value

A list with the following elements

sigmasq

process variance estimate and confidence interval; estimate may be <0

sigma

sqrt of process variance; set to o if sigmasq<0

beta

dataframe with estimates and standard errors of betas for design

betarand

dataframe of shrinkage estimates

vcv.beta

variance-covariance matrix for beta

GTrace

trace of matrix G

Author(s)

Jeff Laake; Ben Augustine

References

BURNHAM, K. P. and G. C. WHITE. 2002. Evaluation of some random effects methodology applicable to bird ringing data. Journal of Applied Statistics 29: 245-264.

Examples


# This example is excluded from testing to reduce package check time
data(dipper)
md=mark(dipper,model.parameters=list(Phi=list(formula=~time)),delete=TRUE)
md$results$AICc
zz=get.real(md,"Phi",vcv=TRUE)
z=zz$estimates$estimate[1:6]
vcv=zz$vcv.real
varc=var.components(z,design=matrix(rep(1,length(z)),ncol=1),vcv) 
df=md$design.data$Phi
shrinkest=data.frame(time=1:6,value=varc$betarand$estimate)
df=merge(df,shrinkest,by="time")
md=mark(dipper,model.parameters=list(Phi=list(formula=~time,
  fixed=list(index=df$par.index,value=df$value))),adjust=FALSE,delete=TRUE)
npar=md$results$npar+varc$GTrace
md$results$lnl+2*(npar + (npar*(npar+1))/(md$results$n-npar-1))


RMark documentation built on Aug. 14, 2022, 1:05 a.m.

Related to var.components in RMark...