rlmDD_het: Robust estimation for autoregressive models with...

Description Usage Arguments Value Author(s) References See Also Examples

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

1
2
3
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. "power" function corresponds to √(var) = σ = φ |x^T β|^ γ and "exponential" to √(Var) = σ = φ e^(γ |x^T β|).

phi.par

If TRUE, the function estimate the phi parameter. If FALSE, phi is assumed equal to 1.

tuning.para

If NULL, the function will run the estimation procedure for a range of value between 0 and 3 and will select the tuning parameter that minimizes the variance of the estimates. The user can also indicate a value of tuning parameter: in this case the estimation procedure will be evaluated once with the selected value of the tuning parameter.

step

Only works when tuning.para = NULL, indicates the increment of the tuning parameter sequence (between 0 and 3) tested by the function. It will determine the precision of the tuning parameter. Caution : a smaller value indicates a larger number of value tested, resulting in a longer computing time.

n.lag

If NULL, a pAcf plot of the resiuduals will appear and you will have to indicate the number of lags the method has to include. The user can also give an integer corresponding to the number of lags desired.

print.summary

If TRUE, prints a summary of the estimates.

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 : ψ(p_residuals,c)

with ψ 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 tuning.para = NULL, list containing the optimal tuning parameter, all the values of tuning parameter tested and their associated variance obtained.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)

rlmDataDriven documentation built on Oct. 3, 2019, 5:04 p.m.