kerfon | R Documentation |
Modelization of fdata
using functional kernel.
kerfon(data, x, r, hmin, hmax, na.rm=TRUE)
data |
A |
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 |
This function constructs a functional kernel model and performs the estimation of it's bandwidth.
One nonparametric way to deal with the conditional expectation r(x)=E[X(i)|X(i-1)=x], where X(i) 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 :
r*(x,hn)=sum of(X(i+1)*K(||X(i)-x||/hn)))/((n-1) * sum of(K(||X(i)-x||/hn))))
Where K is a kernel, ||.|| is the norm in H, and hn is the bandwidth (in R+*).
The function kerfon
use the cross validation to determinate a
value for hn. 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 hn. By default, those parameters are
respectively equals to σ/8 and 4*σ, where
σ is the estimated squared root of the variance operator of
X. To choose the value of hn, 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).
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 |
ydata |
the associated values for |
J. Damon
predict.kerfon
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.