deltamethod {CatDyn}R Documentation

First-order Taylor Series Expansion of Functions of Random Variables

Description

The delta method for approximating the standard error of a transformation g(X) of a random variable X = (x1, x2, ...), given estimates of the mean and covariance matrix of X.

Usage

deltamethod(g, mean, cov, ses = TRUE)

Arguments

g

A formula representing the transformation. The variables must be labelled x1, x2, ... For example, ~ 1 / (x1 + x2). If the transformation returns a vector, then a list of formulae representing (g1, g2, ...) can be provided, for example list( ~ x1 + x2, ~ x1 / (x1 + x2) ).

mean

The estimated mean of X.

cov

The estimated covariance matrix of X.

ses

If TRUE, then the standard errors of g1(X), g2(X), ... are returned. Otherwise the covariance matrix of g(X) is returned.

Details

This function was copied from package msm.

It is used in CatDyn to backtransform from the logarithm because CatDyn parameters are all estimated in the log scale to improve numerical performance.

For more details see the help pages for function deltamethod of package msm.

Value

A vector containing the standard errors of g1(X), g2(X), ... or a matrix containing the covariance of g(X).

Author(s)

C. H. Jackson <chris.jackson@mrc-bsu.cam.ac.uk>

Examples

#See the examples in package msm.

[Package CatDyn version 1.1-1 Index]