R: Modify families for use in GAM fitting

fix.family.link {mgcv} | R Documentation

## Modify families for use in GAM fitting

### Description

Generalized Additive Model fitting by `outer' iteration, requires extra derivatives of the variance and link functions to be added to family objects. The functions add what is needed.

### Usage

    fix.family.link(fam)
    fix.family.var(fam)

### Arguments

`fam` | A `family`.

### Details

Outer iteration GAM estimation requires derivatives of the GCV/UBRE score, which are obtained by differentiating the P-IRLS GAM fitting iteration w.r.t. the model smoothing parameters. The expressions for the derivatives require the second and third derivatives of the link w.r.t. the mean, and the first and second derivatives of the variance function w.r.t. the mean. These functions add functions evaluating these quantities to a family.

If the family already has functions `dvar`, `d2var`, `d2link` and `d3link` then these functions simply return the family unmodified: this allows non-standard links to be used with `gam` when using outer iteration (performance iteration operates with unmodified families).

The `dvar` function is a function of a mean vector, `mu`, and returns a vector of corresponding first derivatives of the family variance function. The `d2link` function is also a function of a vector of mean values, `mu`: it returns a vector of second derivatives of the link, evaluated at `mu`. Higher derivatives are defined similarly.

If modifying your own family, note that you can often get away with supplying only a `dvar` and `d2var`, function if your family only requires links that occur in one of the standard families.

### Value

A family object with extra component functions `dvar`, `d2var`, `d2link` and `d3link`.

### Author(s)

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

### See Also

`gam.fit3`

[Package mgcv version 1.4-1.1 Index]