plot.pendensity {pendensity}R Documentation

Plotting estimated penalized densities

Description

Plotting estimated penalized densities, need object of class 'pendensity'.

Usage

## S3 method for class 'pendensity':
plot(x, plot.val = 1, latt = FALSE, kernel = FALSE, confi = TRUE,
 main = NULL, sub = NULL, xlab = NULL, ylab = NULL, plot.base = FALSE,
 lwd=NULL,legend.txt=NULL,...)

Arguments

x object of class pendensity
plot.val if plot.val=1 the density is plotted, if plot.val=2 the distribution on the observation values is plotted, if plot.val=3 the distribution is plotted as function
latt TRUE/FALSE if the lattice interface should be used for ploting, default=FALSE
kernel TRUE/FALSE if a kernel density estimation should be added to the density plots, default=FALSE
confi TRUE/FALSE if confidence intervals should be added to the density plots, default=TRUE
main Main of the density plot, if NULL main contains settings 'K', 'AIC' and 'lambda0' of the estimation
sub sub of the density plot, if NULL sub contains settings used base 'base' and used order of B-Spline 'q'
xlab xlab of the density plot, if NULL xlab contains 'y'
ylab ylab of the density plot, if NULL ylab contains 'density'
plot.base TRUE/FALSE if the weighted base should be added to the density plot, default=FALSE
lwd lwd of the lines of density plot, if NULL lwd=3, the confidence bands are plotted with lwd=2
legend.txt if FALSE no legend is plotted, legend.txt can get a vector of chracters with length of the groupings. legend.txt works only for plot.val=1
... further arguments

Details

Each grouping of factors is plotted. Therefore, equidistant help values are constructed in the support of the response for each grouping of factors. Weighting these help values with knots weights ck results in the density estimation for each grouping of factors. If asked for, pointwise confidence intervals are computed and plotted.

Value

If the density function is ploted, function returns two values

help.env Contains the constructed help values for the response, the corresponding values for the densities and if asked for the calculated confidence intervals
combi list of all combinations of the covariates
y containing the observed values y
sum containing the empirical distribution of each observation y

If the theoretical distribution function is plotted, the function returns an environment. For plotting the theoretical distributions, each interval between two knots is evaluated at 100 equidistant simulated points between the two knots considered. These points are saved in the environment with the name "paste("x",i,sep="")" for each interval i, the calculated distribution is save with the name "paste("F(x)",i,sep="")" for each interval i. For these points, the distribution is calculated.

Note

For plotting the density and e.g. the empirical distributions, use e.g. 'X11()' before calling the second plot to open a new graphic device.

Author(s)

Christian Schellhase <cschellhase@wiwi.uni-bielefeld.de>

References

Penalized Density Estimation, Kauermann G. and Schellhase C. (2009), to appear.

Examples

y <- rnorm(100)
test <- pendensity(y~1)
plot(test)

#empirical distribution
plot(test,plot.val=2)

[Package pendensity version 0.1 Index]