Learn R Programming

far (version 0.6-7)

kerfon: Functional Kernel estimation

Description

Modelization of fdata using functional kernel.

Usage

kerfon(data, x, r, hmin, hmax, na.rm=TRUE)

Value

A kerfon object. A method for the print function is provided.

For information, the object is a list with the following elements :

call

the call of the function.

h

the bandwidth (three values : optimal, minimum, maximum)

x

the name of the chosen variable

xdata

the past values for x

ydata

the associated values for x

Arguments

data

A fdata object.

x

The name of the studied variable.

r

Number of observations used to cross validate the model.

hmin

Minimal value of the bandwidth.

hmax

Maximal value of the bandwidth.

na.rm

Logical. Does the n.a. need to be removed.

Author

J. Damon

Details

This function constructs a functional kernel model and performs the estimation of it's bandwidth.

One nonparametric way to deal with the conditional expectation \(\rho(x)=\mbox{I$\!$E}\left[ X_{i}\left| X_{i-1}=x\right. \right]\), where \(\left(X_{i}\right)\) is a $H$-valued process, is to consider a predictor inspired by the classical kernel regression, as in Nadaraja and Watson. This estimator is defined by :

$$\hat{\rho}_{h_{n}}(x)=\frac{\sum\limits_{i=1}^{n-1}X_{i+1}\cdot% K\left(\frac{\left\| X_{i}-x\right\| _{H}}{h_{n}}\right)% }{\sum\limits_{i=1}^{n-1}K\left( \frac{\left\| X_{i}-x\right\|% _{H}}{h_{n}}\right)},x\in H$$

Where K is a kernel, \(\left\|.\right\| _{H}\) is the norm in H, and \(h_n\) is the bandwidth (\(\in \mbox{I$\!$R}^+_*\)).

The function kerfon use the cross validation to determinate a value for \(h_n\). This method have been chosen because of the lack of theoretical results about this model. The parameters hmin and hmax are used, when provided, to control the permissible values of \(h_n\). By default, those parameters are respectively equals to \(\sigma/8\) and \(4*\sigma\), where \(\sigma\) is the estimated squared root of the variance operator of X. To choose the value of \(h_n\), you need to provide the same value for both hmin and hmax.

During the cross-validation, considering that the fdata object x contains \(n\) observations, the function use the first \((n-r)\) observations as the past values, and compute the mean square norm of the errors on the last \(r\) observations.

Of course, if the model created is then used to compute prediction through predict.kerfon, the whole set of observations (the \(n\) observations) are used as the past values.

As fdata object may contains several variables, a way is provided to select the studied variable (the function only works with one variable for the moment).

See Also

predict.kerfon

Examples

Run this code
  # Simulation of a FARX process
  data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5),
                base.exo=base.simul.far(20,5),
                d.a=matrix(c(0.5,0),nrow=1,ncol=2),
                alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2),
                d.rho=diag(c(0.45,0.90,0.34,0.45)),
                alpha=diag(c(0.5,0.23,0.018)),
                d.rho.exo=diag(c(0.45,0.90,0.34,0.45)),
                cst1=0.0)

  # Cross validation
  model1 <- kerfon(data=data1, x="X", r=10, na.rm=TRUE)
  print(model1)

Run the code above in your browser using DataLab