bivLocPol: Bivariate Local estimation.

bivNPestR Documentation

Bivariate Local estimation.

Description

Simple bivariate Local density and regression estimation with weights.

Usage

    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,...)

Arguments

X

Covariate or independent data, should be a data.frame or matrix, whose two first two columns are used.

Y

Response data, a vector

.

weig

Vector of weigths for each observations.

K

Bivariate kernel function as bivDens and bivReg.

H

Bandwidth matrix. Its default value is determined by mayBeBwSel.

object, x

bivNpEst class objects, those returned by bivDens and bivReg functions.

newdata

Data, should be a data.frame where the density or regressions is going to be predicted.

...

Further graphical parameters. These parameters should agree with those in persp.

Details

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.

Value

A list containing:

X

Covariate data.

Y

Response data

H

Bandwidth matrix

estFun

Estimator function.

Author(s)

Jorge Luis Ojeda Cabrera.

Examples

  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)

locpol documentation built on Nov. 29, 2022, 9:05 a.m.

Related to bivLocPol in locpol...