ltre | R Documentation |
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.
ltre(func, pars1, pars2, dfunc, N = 20, ...)
func |
A function specified by the user. This must be able to take the vectors |
pars1 |
vector of covariates to be passed on as arguments to |
pars2 |
is the same as |
dfunc |
a derivative function, see details |
N |
The number of intervals to integrate over. |
... |
... optional parameters to pass on to |
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.
caswell1989analysisDemoDecomp \insertRefcaswell2006matrixDemoDecomp
grad
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.