residuals.Mort1Dsmooth: Extract 1D P-splines Model Residuals

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/residuals.Mort1Dsmooth.R

Description

Extracting different types of residuals from a Mort1Dsmooth object.

Usage

1
2
3
4
## S3 method for class 'Mort1Dsmooth'
residuals(object,
          type = c("deviance", "pearson",
                   "anscombe", "working"), ...)

Arguments

object

an object of class "Mort1Dsmooth", usually, a result of a call to Mort1Dsmooth.

type

the type of residuals which should be returned. The alternatives are: "deviance" (default), "anscombe", "pearson" and "working".

...

Further arguments passed to or from other methods. Not in used. Not in use.

Details

The references define the types of residuals.

The way of computing the residuals are described in Section 2.4 of McCullagh and Nelder's book. The working residuals are merely the differences between fitted and actual counts.

Value

A vector of the selected type of residuals for each of the predictor in the Mort1Dsmooth object.

Author(s)

Carlo G Camarda

References

Davison, A. C. and Snell, E. J. (1991). Residuals and diagnostics. In: Statistical Theory and Modelling. In Honour of Sir David Cox, FRS, eds. Hinkley, D. V., Reid, N. and Snell, E. J., Chapman & Hall.

McCullagh P. and Nelder, J. A. (1989). Generalized Linear Models. London: Chapman & Hall.

See Also

Mort1Dsmooth for computing Mort1Dsmooth.object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## selected data
years <- 1970:2006
death <- selectHMDdata("Denmark", "Deaths", "Females",
                       ages = 60, years = years)
exposure <- selectHMDdata("Denmark", "Exposures", "Females",
                          ages = 60, years = years)
## fit
fit <- Mort1Dsmooth(x=years, y=death, offset=log(exposure),
                    method=3, lambda=1000)

## extracting residuals
devR <- resid(fit, type="deviance")
ansR <- resid(fit, type="anscombe")
peaR <- resid(fit, type="pearson")
worR <- resid(fit, type="working")
## summaries
summary(devR)
summary(ansR)
summary(peaR)
summary(worR)

MortalitySmooth documentation built on May 29, 2017, 7:11 p.m.