df.cdf.estim: Local linear estimation of the conditional distribution...

Description Usage Arguments Details Author(s) References Examples

View source: R/df.R

Description

This function computes the local linear estimation of the conditional distribution function.

Usage

1
df.cdf.estim(x, y, data.X, data.Y, bandwidth, kernel.function = kernel.function.epan)

Arguments

x

a numeric vector.

y

a numeric vector.

data.X

a numeric data vector used to obtain the nonparametric estimator of the conditional distribution function.

data.Y

a numeric data vector used to obtain the nonparametric estimator of the conditional distribution function.

bandwidth

bandwidth used to obtain the nonparametric estimator of the conditional distribution function.

kernel.function

kernel function used to obtain the nonparametric estimator of the conditional distribution function. Default option is "kernel.function.epan" which corresponds to the Epanechnikov kernel function.

Details

Inappropriate bandwidth, x or y choices can produce "NaN" values in cumulative distribution function estimates.

Author(s)

Romain Azais, Sandie Ferrigno and Marie-Jose Martinez

References

G. R. Ducharme and S. Ferrigno. An omnibus test of goodness-of-fit for conditional distributions with applications to regression models. Journal of Statistical Planning and Inference, 142, 2748:2761, 2012.

R. Azais, S. Ferrigno and M-J Martinez. cvmgof: An R package for Cramer-von Mises goodness-of-fit tests in regression models. Submitted. January 2021.hal-03101612

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(1)

require(lattice) # Only for plotting conditional CDF

# Data simulation
n = 25 # Dataset size
data.X = runif(n,min=0,max=5) # X
data.Y = 0.2*data.X^2-data.X+2+rnorm(n,mean=0,sd=0.3) # Y

########################################################################

# Estimation of the link function

bandwidth = 0.75 # Here, the bandwidth is arbitrarily fixed

# Estimation of the conditional CDF
xgrid = seq(0.5,4.5,by=0.1)
ygrid = seq(-1,3,by=0.1)
cdf_df = df.cdf.estim(xgrid,ygrid,data.X,data.Y,bandwidth)

wireframe(cdf_df, drape=TRUE,
          col.regions=rainbow(100),zlab='CDF(y|x)',xlab='x',ylab='y',zlim=c(0,1.01))

cvmgof documentation built on Jan. 16, 2021, 5:40 p.m.