# NOT RUN {
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)
# }
Run the code above in your browser using DataLab