WH {WH}R Documentation

Whittaker-Henderson Smoothing

Description

Main package function to apply Whittaker-Henderson Smoothing in a survival analysis framework. It takes as input two vectors / matrices of observed events and associated central exposure and estimate a smooth version of the log-hazard rate. Smoothing parameters may be supplied or automatically chosen according to a specific criterion such as "REML" (recommended), "AIC", "BIC" or "GCV". Whittaker-Henderson Smoothing may be applied in a full maximum likelihood framework (strongly recommended) or an asymptotic (approximate) Gaussian framework.

Usage

WH(d, ec, lambda = NULL, q = 2, criterion, reg, y, wt, verbose = 1, ...)

Arguments

d

Vector / matrix of observed events whose elements should be named.

ec

Vector / matrix of central exposure. The central exposure corresponds to the sum of the exposure period over the insured population. An individual experiencing an event of interest during the year will no longer be exposed afterwards and the exposure should be reduced accordingly.

lambda

Smoothing parameter. If missing, an optimization procedure will be used to find the optimal smoothing parameter.

q

Order of penalization. Polynoms of degrees q - 1 are considered smooth and therefore unpenalized. The default of 2 should be suitable for most practical applications. Higher orders may cause numerical issues.

criterion

Criterion to be used for the selection of the optimal smoothing parameter. Default is "REML" which stands for restricted maximum likelihood. Other options include "AIC", "BIC" and "GCV".

reg

Should an approximate regression framework be used ? framework.

y

Optional vector of observations whose elements should be named. Used only in the regression framework and even in this case will be automatically computed from the d and ec arguments if those are supplied. May be useful when using Whittaker-Henderson smoothing outside of the survival analysis framework.

wt

Optional vector / matrix of weights. As for the observation vector / matrix y, used only in the regression framework and even in this case will be automatically computed if the d argument is supplied. May be useful when using Whittaker-Henderson smoothing outside of the survival analysis framework.

verbose

Integer between 0 and 3. Control the level of informations that will be printed on screen during fitting.

...

Additional parameters passed to the smoothing function called.

Value

An object of class WH_1d i.e. a list containing, among other things :

Examples


d <- portfolio_mort$d
ec <- portfolio_mort$ec

y <- log(d / ec)
y[d == 0 | ec == 0] <- NA
wt <- d

# Maximum likelihood
WH(d, ec) # automatic smoothing parameter selection via REML
WH(d, ec, lambda = 1e2) # fixed smoothing parameter
WH(d, ec, criterion = "GCV") # alternative criterion for smoothing parameter selection

# Regression
WH(y = y, wt = wt) # regression framework is default when y is supplied
WH(d, ec, reg = TRUE, lambda = 1e2) # forces computation of y from d and ec


[Package WH version 2.0.0 Index]