Learn R Programming

RMark (version 3.0.0)

var.components: 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
)

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

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

Author

Jeff Laake; Ben Augustine

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.

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

Run this code
# \donttest{
# 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))
# }

Run the code above in your browser using DataLab