Description Usage Arguments Value Author(s) References See Also Examples
Produces a contour plot of a bivariate weighted kernel density estimate
1 2 3 4 | wkde.contour(y, Sigma, H, w, gamma,
RUG = TRUE, COMPARE = TRUE, LEVELS = NA,
XLAB = expression(italic(x)), YLAB = expression(italic(y)),
DL = FALSE)
|
y |
the observed values; matrix with two columns. |
Sigma |
the variance-covariance matrix of the contaminating (normal) distribution. |
H |
the matrix of smoothing parameters to be used for the
weighted bivariate kernel density estimate; if missing the bandwidth
returned by |
w |
the weights to be used; if missing the weights returned by
|
gamma |
the regularisation parameter to be used |
RUG |
logical; if |
COMPARE |
logical; if |
LEVELS |
passed to the argument |
XLAB |
passed as argument |
YLAB |
passed as argument |
DL |
passed to the argument |
Invisible NULL
. This function is called for its side effect of
creating a plot.
Martin L Hazelton m.hazelton@massey.ac.nz
Berwin A Turlach Berwin.Turlach@gmail.com
Hazelton, M.L. and Turlach, B.A. (2009). Nonparametric density deconvolution by weighted kernel estimators, Statistics and Computing 19(3): 217–228. http://dx.doi.org/10.1007/s11222-008-9086-7.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ##
## Figure 7 from paper
##
library(ks)
Age <- framingham[,2]
Age.lim.2 <- 56
SBP1.A <- framingham[Age>=Age.lim.2,3] # SBP, measure 1, Exam 2
SBP2.A <- framingham[Age>=Age.lim.2,4] # SBP, measure 2, Exam 2
SBP1.B <- framingham[Age>=Age.lim.2,5] # SBP, measure 1, Exam 3
SBP2.B <- framingham[Age>=Age.lim.2,6] # SBP, measure 2, Exam 3
sigma.fram.A <- sd(SBP1.A-SBP2.A)
sigma.fram.B <- sd(SBP1.B-SBP2.B)
Sigma.fram <- diag(c(sigma.fram.A,sigma.fram.B))^2
SBP.A <- SBP1.A
SBP.B <- SBP1.B
SBP.bi <- cbind(SBP.A,SBP.B)
H.fram <- Hpi(SBP.bi)
par(mfrow=c(1,2))
wkde.contour(SBP.bi, Sigma=diag(c(0,0)), H=H.fram,
RUG=FALSE, COMPARE=FALSE, XLAB="SBP2", YLAB="SBP3",
LEVELS=seq(5e-5,40e-5,by=10e-5))
points(SBP.A,SBP.B,pch=19,cex=0.25)
gamma <- 0.4
wkde.contour(SBP.bi, Sigma=Sigma.fram, H=H.fram,
RUG=FALSE, COMPARE=FALSE, XLAB="SBP2", YLAB="SBP3",
LEVELS=seq(5e-5,40e-5,by=10e-5), gamma=gamma)
points(SBP.A,SBP.B,pch=19,cex=0.25)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.