Description Usage Arguments Value References See Also Examples
Fit twodimensional penalized composite link model (PCLM2D), e.g. simultaneous ungrouping of ageatdeath distributions grouped in age classes for adjacent years. The PCLM can be extended to a twodimensional regression problem. This is particularly suitable for mortality analysis when mortality surfaces are to be estimated to capture both agespecific trajectories of coarsely grouped distributions and time trends \insertCiterizzi2019ungroup.
1 2 3 4 5 6 7 8 9 10 
x 
Vector containing the starting values of the input intervals/bins.
For example: if we have 3 bins 
y 

nlast 
Length of the last interval. In the example above 
offset 
Optional offset term to calculate smooth mortality rates. A vector of the same length as x and y. See \insertCiterizzi2015;textualungroup for further details. 
out.step 
Length of estimated intervals in output. Values between 0.1 and 1 are accepted. Default: 1. 
ci.level 
Level of significance for computing confidence intervals.
Default: 
verbose 
Logical value. Indicates whether a progress bar should be
shown or not. Default: 
control 
List with additional parameters:

The output is a list with the following components:
input 
A list with arguments provided in input. Saved for convenience. 
fitted 
The fitted values of the PCLM model. 
ci 
Confidence intervals around fitted values. 
goodness.of.fit 
A list containing goodness of fit measures: standard errors, AIC and BIC. 
smoothPar 
Estimated smoothing parameters: 
bins.definition 
Additional values to identify the bins limits and location in input and output objects. 
deep 
A list of objects created in the fitting process. Useful in diagnosis of possible issues. 
call 
An unevaluated function call, that is, an unevaluated expression which consists of the named function applied to the given arguments. 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  # Input data
Dx < ungroup.data$Dx
Ex < ungroup.data$Ex
# Aggregate data to be ungrouped in the examples below
# Select a 10y data frame
x < c(0, 1, seq(5, 85, by = 5))
nlast < 26
n < c(diff(x), nlast)
group < rep(x, n)
y < aggregate(Dx, by = list(group), FUN = "sum")[, 2:10]
offset < aggregate(Ex, by = list(group), FUN = "sum")[, 2:10]
# Example 1 
# Fit model and ungroup data using PCLM2D
P1 < pclm2D(x, y, nlast)
summary(P1)
# Plot fitted values
plot(P1)
# Plot input data
plot(P1, "observed")
# NOTE: pclm2D does not search for optimal smoothing parameters by default
# (like pclm does) because it is more time consuming. If optimization is
# required set lambda = c(NA, NA):
P1 < pclm2D(x, y, nlast, control = list(lambda = c(NA, NA)))
# Example 2 
# Ungroup and build a mortality surface
P2 < pclm2D(x, y, nlast, offset)
summary(P2)
plot(P2, type = "observed")
plot(P2, type = "fitted")
plot(P2, type = "fitted", colors = c("blue", "red"))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.