Learn R Programming

LogConcDEAD (version 1.1-1)

plot.LCDweights: Plot function for weighted log-concave estimator

Description

This plot function currently only plots 1- and 2-d data.

Usage

## S3 method for class 'LCDweights':
plot(x, uselog=FALSE, method="akima", itype="p",
addp=TRUE, gridlen=100, g=NULL, marg=NULL, g.marg=NULL, ...)

Arguments

x
Object of class LCDweights (e.g. as output from lcd.weights)
uselog
logical indicating whether the log or true scale should be plotted
method
The akima package is used for linear interpolation
itype
Plot type: p perspectice, c contour, i image, ic image and contour, r using rgl (the best!)
addp
logical: should the data points be plotted on the surface?
gridlen
Number of points at which the MLE is evaluated in each direction
g
If many plots are required, it may be quicker to compute the grid using lcd.interp(out) and pass the result to plot
marg
axis-aligned marginals can be plotted (set to 1 or 2)
g.marg
may be quicker to compute marginal using lcd.marg or lcd.marg2 and pass to plot
...
Other plot arguments

Details

This function makes use of the akima package.

For one-dimensional data, the log estimator is piecewise linear with knots at observation points.

The same is (roughly speaking) true in higher dimensions. The estimator is evaluated on a grid using the interp function from akima.

To come: plotting of marginals for higher-dimensional data.

See Also

interp

Examples

Run this code
## some simple normal data

set.seed(101)
x <- matrix(rnorm(200), ncol=2)
w <- runif(100)
w <- w/sum(w)
out <- lcd.weights(x,w)
par(mfrow=c(2,2))
plot(out,  itype="c", main="Density")
plot(out,  itype="c", uselog=TRUE, main="LogDensity")
plot(out,  itype="i", main="Density")
plot(out,  itype="i", uselog=TRUE, main="LogDensity")

Run the code above in your browser using DataLab