deltamethod.special: Compute delta method variance for sum, cumsum, prod and...

Description Usage Arguments Details Value Author(s) Examples

View source: R/deltamethod.r

Description

This function computes the delta method std errors or v-c matrix for a sum, cumsum (vector of cummulative sums), prod (product), or cumprod(vector of cummulative products) of a set of estimates.

Usage

1
deltamethod.special(function.name, mean, cov, ses = TRUE)

Arguments

function.name

Quoted character string of either "sum", "cumsum", "prod" or "cumprod"

mean

vector of estimates used in the function

cov

variance-covariance matrix of the estimates

ses

if TRUE it returns a vector of estimated standard errors of the function of the estimates and if FALSE it returns the variance-covariance matrix

Details

This function computes the delta method std errors or v-c matrix for a sum, cumsum (vector of cummulative sums), prod (product), or cumprod(vector of cummulative products). It uses the function deltamethod from the msm package and constructs the necessary formula for these special cases. It will load the msm pacakge but assumes that it has already been installed. See the msm documentation for a complete description on how the deltamethod function works. If ses=TRUE, it returns a vector of std errors for each of functions of the estimates contained in mean. If ses=F, then it returns a v-c matrix for the functions of the estimates contained in mean. cov is the input v-c matrix of the estimates.

Value

either a vector of standard errors (ses=TRUE) or a variance-covariance matrix (ses=FALSE)

Author(s)

Jeff Laake

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# This example is excluded from testing to reduce package check time
#
# The following are examples only to demonstrate selecting different 
# model sets for adjusting chat and showing model selection table. 
# It is not a realistic analysis.
#
  data(dipper)
  mod=mark(dipper,model.parameters=list(Phi=list(formula=~time)))
  rr=get.real(mod,"Phi",se=TRUE,vcv=TRUE)
  deltamethod.special("prod",rr$estimates$estimate[1:6],rr$vcv.real)
  deltamethod.special("cumprod",rr$estimates$estimate[1:6],rr$vcv.real,ses=FALSE)
  deltamethod.special("sum",rr$estimates$estimate[1:6],rr$vcv.real)
  deltamethod.special("cumsum",rr$estimates$estimate[1:6],rr$vcv.real,ses=FALSE)

RMark documentation built on Nov. 7, 2019, 1:06 a.m.