CIARinterpolation {iAR} | R Documentation |
Interpolation from CIAR model
Description
Interpolation of missing values from models fitted by CIARkalman
Usage
CIARinterpolation(
x,
y,
t,
delta = 0,
yini = 0,
zero.mean = TRUE,
standardized = TRUE,
c = 1,
seed = 1234
)
Arguments
x |
An array with the parameters of the CIAR model. The elements of the array are, in order, the real (phiR) and the imaginary (phiI) part of the coefficient of CIAR model. |
y |
Array with the time series observations. |
t |
Array with the irregular observational times. |
delta |
Array with the measurements error standard deviations. |
yini |
a single value, initial value for the estimation of the missing value of the time series. |
zero.mean |
logical; if TRUE, the array y has zero mean; if FALSE, y has a mean different from zero. |
standardized |
logical; if TRUE, the array y is standardized; if FALSE, y contains the raw time series. |
c |
Nuisance parameter corresponding to the variance of the imaginary part. |
seed |
a single value, interpreted as the seed of the random process. |
Value
A list with the following components:
fitted Estimation of a missing value of the CIAR process.
ll Value of the negative log likelihood evaluated in the fitted missing values.
References
Elorrieta, F, Eyheramendy, S, Palma, W (2019). “Discrete-time autoregressive model for unequally spaced time-series observations.” A&A, 627, A120. doi: 10.1051/0004-6361/201935560, https://doi.org/10.1051/0004-6361/201935560.
See Also
gentime
, CIARsample
, CIARkalman
Examples
n=100
set.seed(6714)
st<-gentime(n)
x=CIARsample(n=n,phiR=0.9,phiI=0,st=st,c=1)
y=x$y
y1=y/sd(y)
ciar=CIARkalman(y=y1,t=st)
ciar
napos=10
y0=y1
y1[napos]=NA
xest=c(ciar$phiR,ciar$phiI)
yest=CIARinterpolation(xest,y=y1,t=st)
yest$fitted
mse=(y0[napos]-yest$fitted)^2
print(mse)
plot(st,y,type='l',xlim=c(st[napos-5],st[napos+5]))
points(st,y,pch=20)
points(st[napos],yest$fitted*sd(y),col="red",pch=20)