plot.dbkGrad: Plot Method for dbkGrad objects

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

Description

Plotting the dbkGrad object produces a few different plots that are of interest. The different plots, created from various plottype options, are described below:

Usage

1
2
3
4
5
6
## S3 method for class 'dbkGrad'
plot(x, plottype = c("obsfit", "fitted", "observed", "exposure",
    "residuals", "checksd"), plotstyle = c("mat", "level", "persp"),
    restype = c("working", "proportional", "response", "deviance", "pearson"), 
    byage = TRUE, columns, rows, CI = TRUE, CBBonf = FALSE, CBSidak = FALSE,
    logscale = TRUE, alphares = 0.05, col, ...)

Arguments

x

a dbkGrad object

plottype

an optional character string. It specifies the type of plot to display and must be one of:

  • "observed" to plot observed values;

  • "fitted" to plot fitted values;

  • "obsfit" to plot observed and fitted values (default);

  • "exposure" to plot the exposed to the risk of death;

  • "residuals" to display plots related to residuals: density of residuals, residuals versus fitted values, and residuals versus the discrete variable of interest;

  • "checksd" to plot autocorrelogram and autodependogram (see Bagnato, Punzo, Nicolis, 2012) of residuals, only for the unidimensional case.

plotstyle

an optional character string. It specifies the style of plot; it has no effect when plottype=checksd. It must be:

  • "mat" for a matplot (default for the unidimensional case);

  • "level" for a levelplot (default for the bidimensional case);

  • "persp" for a perspective plot.

restype

an optional character string.When plottype=residuals or plottype=checksd, it specifies the type of residuals displayed. It must be:

  • "working" to use working residuals: o-f (default);

  • "proportional" to use working residuals: o/f-1;

  • "response" to use response residuals: e*(o-f);

  • "deviance" to use deviance residuals: sign(o-f) * sqrt(2*e*o*log(o/f) + 2*e*(1-o)*log((1-o)/(1-f)));

  • "pearson" to use Pearson residuals: e*(o-f)/sqrt(e*f*(1-f)),

where e=exposures, o=observed values and f=fitted values.

rows, columns

an optional numeric vector. It specifies the rows (columns) to plot.

byage

an optional logical. It selects the discrete variable of interest: TRUE (default) for the variable in rows (typically age) and FALSE for the other variable (years or duration).

logscale

an optional logical;when TRUE (default), rates are plotted on log scale.

CI

an optional logical; if TRUE, 1-alpha*100% confidence intervals for the fitted values are displayed in plottype="obsfit" and plottype="fitted". When the alpha argument is not provided in dbkGrad(), 95% pointwise confidence intervals are displayed. Default value is TRUE.

CBBonf

an optional logical; does the same as CI but Bonferroni correction is applied to obtain confidence bands. Default is FALSE.

CBSidak

an optional logical; does the same as CI but Sidak correction is applied to obtain confidence bands. Default is FALSE.

alphares

an optional scalar. When plottype=residuals the boundaries of the (alphares)*100% critical region are displayed. Default value is 0.05.

col

a scalar or a vector with plotting colors.

...

additional arguments to be passed to or from methods.

Value

No values are returned from the plot function.

Author(s)

Angelo Mazza and Antonio Punzo

References

Bagnato L, Punzo A, Nicolis O (2012). The autodependogram: a graphical device to investigate serial dependences. Journal of Time Series Analysis, 33(2), 233-254.

Bagnato L, De Capitani L, Punzo A (2013a). Detecting Serial Dependencies with the Reproducibility Probability Autodependogram. Advances in Statistical Analysis. doi:10.1007/s10182-013-0208-y.

Bagnato L, De Capitani L, Punzo A (2013b). Testing Serial Independence via Density-Based Measures of Divergence. Methodology and Computing in Applied Probability. doi:10.1007/s11009-013-9320-4.

Mazza A, Punzo A (2014) DBKGrad: An R Package for Mortality Rates Graduation by Discrete Beta Kernel Techniques. Journal of Statistical Software, Code Snippets, 572, 1-18.

See Also

DBKGrad-package, dbkGrad, ItalyM, TSA:acf, SDD:ADF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data("ItalyM")

# unidimensional analysis

res1 <- dbkGrad(obsq=obsq, limx=c(6,71), limy=104, exposure=population, bwtypex="EX", adaptx="ab")
plot(res1, plottype="obsfit", CI=FALSE, CBBonf=TRUE)
plot(res1, plottype="residuals", restype="pearson")
plot(res1, plottype="checksd", restype="pearson")
residuals(res1, type="pearson")

# bidimensional analysis

res2 <- dbkGrad(obsq=obsq, limx=c(6,46), limy=c(60,80), exposure=population, 
transformation="logit", bwtypex="VC", bwtypey="EX", hx=0.01, hy=0.008, adaptx="ab", adapty="b")
plot(res2, plottype="obsfit")
plot(res2, plottype="obsfit", plotstyle="persp", col="black")

DBKGrad documentation built on May 2, 2019, 8:43 a.m.