dregar2 {DREGAR} | R Documentation |
Estimating (just) adaptive-DREGAR coefficients using an iterative 2-step procedure
Description
Estimating coefficients for penalized/non-penalized dynamic regression in the presence of autocorrelated residuals using an iterative 2-step procedure.
Usage
dregar2(data, da = 0, ar = 0, mselection = 4,
normalize = FALSE, penalized = TRUE,
iteration = 15)
Arguments
data |
Data matrix of order (time, response, covariates) |
da |
A vector of lags. Autoregressive orders for response. For example 1:p for all lags from 1 to p |
ar |
A vector of lags. Autoregressive orders for residuals. For example 1:q for all lags from 1 to q |
mselection |
Model selection criteria. Choosing among 1 (CP), 2 (AIC), 3 (GCV) and 4 (BIC) |
normalize |
Logical flag. Setting to TRUE to normalize data prior to analysis |
penalized |
Logical flag. Setting to TRUE to estimate coefficients through penalized likelihood. Otherwise the algorithm applies iterative OLS. |
iteration |
The number of iterations |
Author(s)
Hamed Haselimashhadi <hamedhaseli@gmail.com>
See Also
dregar6
,
generateAR
,
sim.dregar
Examples
par(mfrow=c(2,2))
m=sim.dregar(n=500 , beta=1:4, phi=generateAR(2), theta=.3,
n.z.coeffs=3 , plot=TRUE) # generating data
r=dregar2(data = m$rawdata,da = 1:3,ar = 1:2,mselection = 4,
penalized = 1 )# estimating parameters using2-step adaptive-DREGAR
round(cbind(
true = c(phi=c(m$phi,0),theta=c(m$theta,0),beta=m$beta),
estimates = c(phi=r$phi,theta=r$theta,beta=r$beta)
)
,3
)
plot(r$obj)
acf(r$res, main='Residual ACF')
pacf(r$res,main='Residual PACF')