Description Usage Arguments Value References Examples
Estimation of a CFAR process with heteroscedasticity and irregualr observation locations.
1 2 |
f |
the functional time series. |
weight |
the covariance functions of noise process. |
p |
CFAR order. |
grid |
the number of gird points used to constrct the functional time series and noise process. Default is 1000. |
df_b |
the degrees of freedom for natural cubic splines. Default is 10. |
num_obs |
the numbers of observations. It is a t-by-1 vector, where t is the length of time. |
x_pos |
the observation location matrix. If the locations are regular, it is a t-by-(n+1) matrix with all entries 1/n. |
The function returns a list with components:
phi_coef |
estimated spline coefficients for convluaional function(s). |
phi_func |
estimated convoluational function(s). |
rho |
estimated rho for O-U process (noise process). |
sigma |
estimated sigma for O-U process (noise process). |
Liu, X., Xiao, H., and Chen, R. (2016) Convolutional autoregressive models for functional time series. Journal of Econometrics, 194, 263-282.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | phi_func1= function(x){
return(0.5*x^2+0.5*x+0.13)
}
phi_func2= function(x){
return(0.7*x^4-0.1*x^3-0.15*x)
}
grid=1000
testh=g_cfar2h(100,grid,1,40,5,phi_func1=phi_func1,phi_func2=phi_func2)
#obtain discret observations
f_grid=testh$cfar2h
num_obs=testh$num_obs
x_pos=testh$x_pos
t=dim(f_grid)[1]
n=max(num_obs)
index=matrix(0,t,n)
x_grid=seq(0,1,by=1/grid)
b_grid=seq(-1,1,by=1/grid)
f=matrix(0,t,n)
for(i in 1:t){
for(j in 1:num_obs[i]){
index[i,j]=which(abs(x_pos[i,j]-x_grid)==min(abs(x_pos[i,j]-x_grid)))
}
f[i,1:num_obs[i]]=f_grid[i,index[i,1:num_obs[i]]];
}
weight0= function(w){
return((w<=0.6)*exp(-10*w)+(w>0.6)*(exp(-6)+0.2*(w-0.6))+0.1);
}
const=sum(weight0(x_grid)/(grid+1))
weight= function(w){
return(((w<=0.6)*exp(-10*w)+(w>0.6)*(exp(-6)+0.2*(w-0.6))+0.1)/const)
}
est=est_cfarh(f,weight,2,1000,5,num_obs,x_pos)
par(mfrow=c(1,2))
c1=range(est$phi_func)
plot(b_grid,phi_func1(b_grid),type='l',col='red',ylim=c1*1.05)
points(b_grid,est$phi_func[1,],type='l')
c1=range(est$phi_func)
plot(b_grid,phi_func2(b_grid),type='l',col='red',ylim=c1*1.05)
points(b_grid,est$phi_func[2,],type='l')
cat("rho: ",est$rho,"\n")
cat("sigma2: ",est$sigma2,"\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.