Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.kdde

Plot for kernel density derivative estimate


Description

Plot for kernel density derivative estimate for 1- to 3-dimensional data.

Usage

## S3 method for class 'kdde'
plot(x, ...)

Arguments

x

object of class kdde (output from kdde)

...

other graphics parameters:

which.deriv.ind

index of the partial derivative to be plotted (>1-d)

and those used in plot.kde

Details

For kdde objects, the function headers for the different dimensional data are

## univariate
  plot(fhat, ylab="Density derivative function", ...)

  ## bivariate
  plot(fhat, which.deriv.ind=1, cont=c(25,50,75), abs.cont, display="slice", 
     zlab="Density derivative function", ...)
  
  ## trivariate 
  plot(fhat, which.deriv.ind=1, display="plot3D", cont=c(25,50,75), abs.cont, 
       colors, col, col.fun=cm.colors, ...)

Value

Plots for 1-d and 2-d are sent to graphics window. Plot for 3-d is sent to graphics/RGL window.

In addition to the display options inherited from plot.kde, the first derivative has display="quiver". This is a quiver plot where the size and direction of the arrow indicates the magnitude/direction of the density gradient. See quiver2D from the OceanView package for more details.

See Also

Examples

## univariate example
data(tempb)
fhat1 <- kdde(x=tempb[,"tmin"], deriv.order=1)   ## gradient [df/dx, df/dy]
plot(fhat1, xlab="Min. temp.")                   ## df/dx
points(20,predict(fhat1, x=20))

## bivariate example
fhat1 <- kdde(x=tempb[,c("tmin", "tmax")], deriv.order=1)
plot(fhat1, display="quiver")
  ## gradient [df/dx, df/dy]

fhat2 <- kdde(x=tempb[,c("tmin", "tmax")], deriv.order=2)
plot(fhat2, which.deriv.ind=2, display="persp", phi=15)
plot(fhat2, which.deriv.ind=2, display="filled.contour", col.fun=topo.colors)
  ## d^2 f/(dx dy): purple=-ve, green=zero, beige=+ve
s2 <- kcurv(fhat2)
plot(s2, display="filled.contour")
  ## summary curvature 

## trivariate example  
data(iris)
fhat1 <- kdde(iris[,2:4], deriv.order=1)
plot(fhat1)

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.