ltre: Caswell's LTRE method of decomposition

ltreR Documentation

Caswell's LTRE method of decomposition

Description

Caswell's Lifetable Response Experiment (LTRE) decomposed a vector-parameterized function by taking derivatives of the objective function with respect to each parameter. The sum-product of the resulting derivative vector and the change in parameter values is a first order approximation of the decomposition. This implementation repeats this operation N times as pars1 warps into pars2 over N steps. This allows for arbitrary precision as N increases, as in the case of the Horiuchi approach.

Usage

ltre(func, pars1, pars2, dfunc, N = 20, ...)

Arguments

func

A function specified by the user. This must be able to take the vectors rates1 or rates2 as its argument, and to return the value of the function, y, when evaluated for these rates. It may also have additional arguments, not to be decomposed.

pars1

vector of covariates to be passed on as arguments to func(). Covariates can be in any order, as long as func() knows what to do with them. pars1 is for time 1 (or population 1).

pars2

is the same as pars2 but for time/population 2.

dfunc

a derivative function, see details

N

The number of intervals to integrate over.

...

... optional parameters to pass on to func(). These are not decomposed. Also one can use this argument to pass optional arguments to numDeriv::grad().

Details

The case of N=1 differentiates with respect to the arithmetic mean of pars1 and pars2. The ... argument can be used to send extra parameters to func() that do not get decomposed, or to specify other optional arguments to numDeriv::grad() for finer control.

The argument dfunc is optional. If given, it should be a function written to have a first argument func, a second argument x, which consists in the vector of decomposed parameters (same layout at pars1 and pars2), and an option ... argument for undecomposed parameters. Presumably if a derivative function is given then it is analytic or somehow a more parsimonious calculation than numeric derivatives. If left unspecified numDeriv::grad() is used.

As with horiuchi(), the path from pars1 to pars2 is linear, but other paths can be induced by parameterizing func() differently. For example, if you want proportional change from pars1 to pars2 then log them, and write func() to first antilog before continuing. This is not zero-friendly, but in practice power transforms give close results, so you could sqrt() and then square inside func(). If you do this, then dfunc() must be written to account for it too, or you could stick with the default numeric gradient function.

References

\insertRef

caswell1989analysisDemoDecomp \insertRefcaswell2006matrixDemoDecomp

See Also

grad


timriffe/DemoDecomp documentation built on Nov. 4, 2023, 4:15 p.m.