If the rpanel
package is available, an interactive panel can be
activated to control various features of the plot.
If the rgl
package is also available, rotatable plots are
available for the two- and three-dimensional cases. (For
three-dimensional data, the misc3d
package is also required.)
sm.density(x, h, model = "none", weights = NA, group=NA, ...)
h
is its standard deviation.
If this parameter is omitted, a normal optimal smoothing parameter is used.
"none"
. If it is set to "Normal"
(or indeed any value
other than "none"
) then a reference band, indicating where a
density estimate is likely to lie when the data are normally
distributed, will be superimposed on any plot.
nbins
must
then be set to 0 or left at its default value NA
.
sm.options
function,
through a mechanism which limits their effect only to this call of the
function. Those specifically relevant for this function are the following:
hmult
,
h.weights
,
band
,
add
,
lty
,
display
,
props
,
xlab
,
ylab
,
zlab
,
xlim
,
ylim
,
yht
,
nbins
,
ngrid
,
eval.points
,
panel
,
positive
,
delta
,
theta
,
phi
;
see the documentation of sm.options
for their description.
positive
is set to TRUE
.
display="none"
is set.contour3d
function in the misc3d
package of Feng & Tierney.
h.select
, hnorm
, hsj
, hcv
,
nise
, nmise
, sm
,
sm.sphere
, sm.regression
,
sm.options
# A one-dimensional example
y <- rnorm(50)
sm.density(y, model = "Normal")
# sm.density(y, panel = TRUE)
# A two-dimensional example
y <- cbind(rnorm(50), rnorm(50))
sm.density(y, display = "image")
# sm.density(y, panel = TRUE)
# A three-dimensional example
# y <- cbind(rnorm(50), rnorm(50), rnorm(50))
# sm.density(y)
Run the code above in your browser using DataLab