output_to_df {WH}R Documentation

Provide WH model Fit Results as a Data.frame

Description

Provide WH model Fit Results as a Data.frame

Usage

output_to_df(object, dim1 = "x", dim2 = "t")

Arguments

object

An object of class "WH_1d" or "WH_2d" returned by one of the eponymous functions WH_1d() or WH_2d()

dim1

The optional name to be given to the first dimension

dim2

The optional name to be given to the second dimension

Value

A data.frame regrouping information about the fitted and predicted values, the model variance, residuals and effective degrees of freedom...

Examples

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

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

fit_1d <- WH_1d(d, ec)
output_to_df(fit_1d)

keep_age <- which(rowSums(portfolio_LTC$ec) > 5e2)
keep_duration <- which(colSums(portfolio_LTC$ec) > 1e3)

d  <- portfolio_LTC$d[keep_age, keep_duration]
ec <- portfolio_LTC$ec[keep_age, keep_duration]

y <- log(d / ec) # observation vector
y[d == 0] <- - 20
wt <- d

# Maximum likelihood
fit_2d <- WH_2d(d, ec)
output_to_df(fit_2d)


[Package WH version 1.1.1 Index]