gamlss.etamu {mgcv} R Documentation

## Transform derivatives wrt mu to derivatives wrt linear predictor

### Description

Mainly intended for internal use in specifying location scale models. Let `g(mu) = lp`, where `lp` is the linear predictor, and `g` is the link function. Assume that we have calculated the derivatives of the log-likelihood wrt `mu`. This function uses the chain rule to calculate the derivatives of the log-likelihood wrt `lp`. See `trind.generator` for array packing conventions.

### Usage

```gamlss.etamu(l1, l2, l3 = NULL, l4 = NULL, ig1, g2, g3 = NULL,
g4 = NULL, i2, i3 = NULL, i4 = NULL, deriv = 0)
```

### Arguments

 `l1` array of 1st order derivatives of log-likelihood wrt mu. `l2` array of 2nd order derivatives of log-likelihood wrt mu. `l3` array of 3rd order derivatives of log-likelihood wrt mu. `l4` array of 4th order derivatives of log-likelihood wrt mu. `ig1` reciprocal of the first derivative of the link function wrt the linear predictor. `g2` array containing the 2nd order derivative of the link function wrt the linear predictor. `g3` array containing the 3rd order derivative of the link function wrt the linear predictor. `g4` array containing the 4th order derivative of the link function wrt the linear predictor. `i2` two-dimensional index array, such that `l2[,i2[i,j]]` contains the partial w.r.t. params indexed by i,j with no restriction on the index values (except that they are in 1,...,ncol(l1)). `i3` third-dimensional index array, such that `l3[,i3[i,j,k]]` contains the partial w.r.t. params indexed by i,j,k. `i4` third-dimensional index array, such that `l4[,i4[i,j,k,l]]` contains the partial w.r.t. params indexed by i,j,k,l. `deriv` if `deriv==0` only first and second order derivatives will be calculated. If `deriv==1` the function goes up to 3rd order, and if `deriv==2` it provides also 4th order derivatives.

### Value

A list where the arrays `l1`, `l2`, `l3`, `l4` contain the derivatives (up to order four) of the log-likelihood wrt the linear predictor.

### Author(s)

Simon N. Wood <simon.wood@r-project.org>.

`trind.generator`