Plot objects of class kepdf
Functions and methods for plotting objects of kepdf-class
.
## S4 method for signature 'kepdf' plot(x, y, eval.points = NULL, n.grid = NULL, data = NULL, add = FALSE, main = NULL, xlab = NULL, ylab = NULL, zlab = NULL, col = NULL, col.data=2, type="l", props = c(75,50,25), method="contour", ticktype = "detailed", indcol = NULL, text.diag.panel = NULL, gap = 0.5, ...)
x |
An object of |
y |
Not used; for compatibility with generic plot; |
eval.points |
A matrix of data points at which the density to be plotted has to be evaluated; the number of columns must correspond to the dimension of the sample data used to estimate the density. If not provided, density is evaluated on a grid defined on the range of sample data. |
n.grid |
A vector with length set to the number of column of sample data, defining the
length of the grid on which the density to be plotted is evaluated; this
argument is ignored when eval.points is not |
data |
Data to be optionally superimposed to the density plot. |
add |
Logical. If |
main |
An overall title for the plot. |
xlab |
A title for the x axis. |
ylab |
A title for the y axis. |
zlab |
A title for the z axis. |
col |
A specification for the plotting color. |
col.data |
A specification for the color of |
type |
What type of plot should be drawn. This argument applies when kernel density estimate is performed on unidimensional data only. Default value is |
props |
A vector defining the fraction of the data to be included within each density level. This argument applies when kernel density estimate is performed on multidimensional data only. |
method |
One of |
ticktype |
Character: "simple" draws just an arrow parallel to the axis to indicate direction of increase;
"detailed" draws normal ticks; to be used if |
indcol |
Vector of the column positions to be plotted, when densities are estimated on higher than 2-dimensional data. |
text.diag.panel |
Text to be displayed on the diagonal panels when plotting densities estimated on higher than 2-dimensional data. |
gap |
Distance between subplots, when plotting densities estimated of 2-dimensional data or higher-dimensional data. |
... |
Further arguments to be passed to |
When density estimation is based on two or higher dimensional data, these functions make use of functions contour
,
image
and persp
.
For densities estimated on higher than 2-d data, the pairwise marginal estimated densities are plotted for all
possible pairs of coordinates or a chosen selection of them.
A list containing the following elements:
eval.points |
data points at which the plotted density has been evaluated |
estimate |
the estimated density at |
signature(x = "kepdf", y = "missing")
S4 method for plotting objects of kepdf-class
.
#1-d example set.seed(123) x1 <- rnorm(50) #normal optimal bandwidth pdf1a <- kepdf(x1) #shrink the smoothing parameter pdf1b <- kepdf(x1, h=0.5*h.norm(x1)) plot(pdf1a, n.grid=50, data=x1, xlab="x1", ylim=c(0, max(c(pdf1a@estimate, pdf1b@estimate)))) plot(pdf1b, n.grid=50, lty=2, add=TRUE) #2-d example set.seed(123) x2 <- cbind(rnorm(50),rnorm(50)) pdf2 <- kepdf(x2) plot(pdf2, n.grid=c(50,50), data=x2) plot(pdf2, n.grid=c(50,50), method="image") plot(pdf2, n.grid=c(50,50), method="perspective", phi=30, theta=30) #3-d example set.seed(123) x3 <- cbind(rnorm(50), rnorm(50), rnorm(50)) pdf3 <- kepdf(x3) plot(pdf3, n.grid=c(50,50,50)) plot(pdf3, n.grid=c(50,50,50), method="image", col = terrain.colors(30)) plot(pdf3, n.grid=c(50,50,50), method="perspective", phi=30, theta=30)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.