Quantile regression is used when the variables are not normal and there appropriate transformations are not feasible. Consider a case of a variable which can have negative values and zeros so taking a log will not help in making data normal. Following tutorial will guide you how to estimate quantile regression for non stationary variables.
Quantile ARDL Model
Importing Libraries
library(quantmod) #Accessing online data library(quantreg) #to get the function for quantile regression library(forecast) #to generate the lag function library(readxl) #importing excel file library(tidyverse) # data manuplation library(pastecs) # used descriptives library(ggpubr) #normality test plots
df <- read_excel(“D:/UMT notes/MPhil – MS courses/Applied Econometrics/lectures applied econometrics/lecture 8/TIME SERIES r/logistics data.xlsx”)
df <- df %>% mutate(LGDP = log(GDP)) df$l.LGDP <- lag(df$LGDP, n = 1L) df$l.IND <- lag(df$IND, n = 1L) df$l.AGRI <- lag(df$AGRI, n = 1L)
stat.desc(df)
ggqqplot(df$LGDP) ggqqplot(df$IND)
shapiro.test(df$LGDP) shapiro.test(df$IND)
qregr <- rq(LGDP ~ l.LGDP + IND + l.IND + AGRI + l.AGRI, tau = 0.5, data = df) summary(qregr)
qregrd <- rq(LGDP ~ l.LGDP + IND + l.IND, tau = seq(0.05, 0.95, by = 0.05), data = df) summary(qregrd) plot(qregrd)