KernelReg: Kernel regression with a pre-fixed bandwidth

Description Usage Arguments Value Examples

View source: R/KernelReg.R

Description

Kernel regression with a pre-fixed bandwidth

Usage

1
2
3
4
5
6
7
KernelReg(
  x,
  y,
  bandwidth.method = "CV",
  kernel = gaussian.kernel,
  cents = c(0.03, 0.25, 0.5, 0.75, 0.97)
)

Arguments

x

the explanatory variable - numeric

y

the response variable - numeric

bandwidth.method

the bandwidth method choice: CV or plug-in. Default is CV.

kernel

kernel fucntion to choose: gaussian, trig, circular. See KernelFunctions.R. Default is set to gaussian

cents

A numeric vector that represents the centiles calculated. Default is set to cents=c(0.03,0.25,0.5,0.75,0.97) )

Value

Plots the centile curves and returns a list object containing bandwidth value, kernel and estimated centiles values.

Examples

1
2
3
4
5
6
7
#' create a data frame
example<-data.frame(sample(30:42,50,rep=TRUE),sample(800:5000,50,rep=TRUE))
colnames(example)<-c("Gestational Age in weeks","Weight in gramms")
x<-example$`Gestational Age in weeks`
y<-example$`Weight in gramms`
#calculate the centile and plot the curves
KernelReg(x,y)

amouchot/nparamEstim documentation built on Feb. 6, 2021, 9:16 p.m.