I always face a dilemma on whether to assume prices to have a time trend or not while modelling. It is also partly a statistics problem. Let me explain. Assume I have time series, $y_t$ of price of a commodity which on plotting appears to be having an upward slope (which is after all true for majority of items).
When I apply unit root test without drift, the result is non-rejection of unit root. However, if I include a drift term, the result is rejection of unit root.
Now, if the true process is random walk without drift, inclusion of drift is very likely to incorrectly reject the null (below is a simulation study that shows that if the true process is pure random walk, inclusion of drift rejects the null around 34% of times). The red-line is the distribution of t-statistic when ADF test is applied with drift, and blue-line when applied without drift (which is the true process).
(the vertical line is the 0.05 quantile value for DF-distribution - blue curve)
Now if the series did have a time trend (without unit root), ADF test (without drift) almost never rejects the null of unit root.
Hence the dilemma. My take is that the answer (whether trend is stochastic or deterministic) has to come from theory. So the question boils down to Why should prices have a deterministic trend? What economic dynamics would justify modelling the series as, say AR(1) process with time trend?
Code:
'%>%'=magrittr::'%>%'
n=1e4
tt_coef = 0.1
ar1 = function(phi, n=1000, tt=0, tt_coef=0,sd) {
y = numeric(1000+100)
for (i in 2:length(y)) {
y[i] = phi*y[i-1] + tt*tt_coef*i + rnorm(1,mean = 0, sd = 1)
}
return(tail(y,n)) # first 100 observations burned to remove impact of initial condtns
}
samples_tt = replicate(n,ar1(phi = 0.7,tt = 1, tt_coef = tt_coef, sd = 8),simplify = F)
df_stats_tt = lapply(samples_tt, function(x) urca::ur.df(x,lags = 0,
type = 'none')@teststat) %>%
unlist()
samples_rw = replicate(n,ar1(phi = 1, sd = 1),simplify = F)
df_stats_rw = lapply(samples_rw, function(x) urca::ur.df(x,lags = 0,
type = 'none')@teststat) %>%
unlist()
df_stats_drift = lapply(samples_rw, function(x) urca::ur.df(x,lags = 0,
type = 'drift')@teststat[,1]) %>%
unlist()
sum(df_stats_drift<quantile(df_stats_rw, probs = 0.05))/n
sum(df_stats_tt < quantile(df_stats_rw, probs = 0.05))/n
plot(density(df_stats_drift), type = 'l', lwd = 2,
col = 'red', main = 'DF-Distribution', xlab = '')
lines(density(df_stats_rw), type = 'l', lwd = 2, col = 'blue')
abline(v = quantile(df_stats_rw, prob = 0.05))
legend('topleft', legend = c('Without Drift', 'With Drift'),
col = c('blue', 'red'), lwd = 2, bty = 'n')