rlmDD_het {rlmDataDriven} | R Documentation |
Robust estimation for autoregressive models with heterogeneity
Description
Performs robust regression for autoregressive models with heterogeneity.
First, a M-estimation is performed on the data assuming that the variance is constant. The residuals of this model are used to robustly estimate the variance parameter. Then, a weighted M-estimation with variance as weight is used to update the regression parameters. These steps are repeated for different values of tuning parameter. The best tuning parameter is the one which minimizes the variance of the estimator.
Finally, lagged term are built and added to the regression model therefore accounting for temporal correlations. The loss function used is Huber's function.
Usage
rlmDD_het(yy, xx, var.function = c("power", "exponential"),
phi.par = TRUE, tuning.para = NULL, step = 0.1, n.lag = NULL,
print.summary = TRUE)
Arguments
yy |
Vector representing the response variable |
xx |
Design matrix of the covariates (including the intercept) |
var.function |
Assumed function for the variance. " |
phi.par |
If |
tuning.para |
If |
step |
Only works when |
n.lag |
If |
print.summary |
If |
Value
The function returns a list including
coefficients |
Value of the robust estimates |
residuals |
Residuals of the model. |
p_residuals |
Pearson residuals of the model. |
r_residuals |
Robust pearson residuals of the model : |
with
\psi
the derivative of the loss function and c the chosen tuning parameter.
fitted values |
Fitted values obtained with the robust method |
vcov |
Variance-covariance matrix of the estimates |
summary |
Summary of the model including: values, standard errors and z-values of the estimates |
model |
Design matrix of the model |
tuningpara |
When |
varpara |
Estimates of the variance parameters |
Author(s)
Aurelien Callens, You-Gan Wang, Benoit Liquet
References
Callens, A., Wang, Y-G., Fu, L. & Liquet, B. (2018). Robust estimation for autoregressive models with heterogeneity. Submitted.
See Also
rlm
function from package MASS
Examples
library(tseries)
data(ice.river)
xx <- model.matrix(flow.vat ~ prec + temp, data = ice.river)
yy <- flow.jok
least_square <- lm(flow.vat ~ prec + temp, data = ice.river)
pacf(least_square$residuals)
qqnorm(least_square$residuals)
qqline(least_square$residuals, col = "red", lwd = 2)
#With choice of optimal tuning parameter and 2 lags.
#Note that if lag = NULL, a Pacf plot will appear to help you choose
#the number of lags, you will need to input this number in the console.
model_1 <- rlmDD_het(yy, xx, var.function = "exponential",
tuning.para = NULL, n.lag = 2)
pacf(model_1$p_residuals)
qqnorm(model_1$r_residuals)
qqline(model_1$r_residuals, col = "red", lwd = 2)
#For fixed number of lags and tuning parameter
model_2 <- rlmDD_het(yy, xx, var.function = "exponential",
tuning.para = 1.345, n.lag = 2)