bivNPest | R Documentation |
Simple bivariate Local density and regression estimation with weights.
bivDens(X,weig,K,H) bivReg(X,Y,weig,K,H) ## S3 method for class 'bivNpEst' predict(object,newdata,...) ## S3 method for class 'bivNpEst' plot(x,...)
X |
Covariate or independent data, should be a |
Y |
Response data, a |
.
weig |
Vector of weigths for each observations. |
K |
Bivariate kernel function as |
H |
Bandwidth matrix. Its default value is determined by |
object, x |
|
newdata |
Data, should be a |
... |
Further graphical parameters. These parameters should agree with those in |
The functions bivDens
and bivReg
provide a very basic
interface that allows bivariate local estimation with weights. It implements
basic kernel density estimator and Nadaraya–Watson estimator for bivariate
data. Very simple interface methods allow the prediction and plotting of
these estimators.
The only bivariate kernels provided are epaK2d
and gauK2d
.
New ones can be added in the same way as functions with a vector of length 2.
The default bandwidth selector (see mayBeBwSel
) that has been
provided is not optimal or good in any sense. It has been added as
a simple way to provide an easy, fast and simple way to be able to use the
estimators.
The graphical parameters allowed for ...
in plot(x,...)
are those that appears in the function persp. The list plotBivNpEstOpts
provide a default for some of these graphical parameters.
A list containing:
X |
Covariate data. |
Y |
Response data |
H |
Bandwidth matrix |
estFun |
Estimator function. |
Jorge Luis Ojeda Cabrera.
n <- 100 d <- data.frame(x=rexp(n,rate=1/2),y=rnorm(n)) ## x is a length-biased version of an exp. dist. with rate 1. dDen <- bivDens(d,weig=1/d$x) plot(dDen,r=5) d <- data.frame(X1=runif(n),X2=runif(n)) d$Y <- exp(10*d$X1+d$X2^2) dDen <- bivDens(d[,c("X1","X2")]) plot(dDen,r=5) dReg <- bivReg(d[,c("X1","X2")],d$Y) plot(dReg,r=5) plot(dReg,r=5,phi=20,theta=40)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.