A simple test of the martingale hypothesis in esgtoolkit
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Disclaimer: This is a work in progress.
R code at the end.
Introduction
A fundamental utility in financial econometrics and stochastic processes is the martingale property, which implies that the best approximation of the future value of a time series or stochastic process, based on its historical values, is its present value. This property is critical in the efficient market hypothesis, risk-neutral pricing models. Testing whether a given time series satisfies the martingale hypothesis involves examining whether past values significantly predict future changes. This blog post outlines a formalized statistical test implemented in the esgtoolkit package, and leveraging multiple linear regression, F-statistics, and residual diagnostics to determine whether a time series follows a martingale process.
Martingale Hypothesis Test
Let X={X1,X2,…,Xn} be a time series, where each Xt represents a multivariate observation at time t. We are interested in testing the martingale hypothesis, which posits that the future value Xt+1 is unpredictable given the past values. That is:
E[Xn+1∣σ(Xn,Xn−1,…,X1)]=XnWhere σ(Xn,Xn−1,…,X1) is the sigma-algebra containing all the information about X′ ‘s past values.
1. Regression Model
One way to conduct such a test of the Martingale Hypothesis, is to adjust a multiple linear regression of the change in the series, ΔXt+1=Xt+1−Xt, on the past values Xt,Xt−1,…,X1, for all t>0 :
ΔXt+1≈β0+β1Xt+β2Xt−1+⋯+βpX1+ϵt+1where ϵt+1 are the (centered and homoskedastic) residuals of the regression, because, under the assumption that ˆβ1=ˆβ2=⋯=ˆβp= 0 , we’d have:
E[Xt+1−Xt∣σ(Xt,Xt−1,…,X1)]=0That’s one of the simplest way to do it, and although we could think of other expressions of the conditional expectation, these would require more engineering.
2. F-statistic
The significance of the regression model is tested using the Fisher F-statistic. The null hypothesis H0 is that none of the past values X1,X2,…,Xt significantly explains the change ΔXt+1 :
H0:β1=β2=⋯=βp=0The F-statistic is computed as:
F=R2/p(1−R2)/(n−p−1)where R2 is the coefficient of determination, and p is the number of predictors (lags). A significantly large value of F would lead to reject H0.
3. Critical Value and p-value
The critical value for the Fisher-Snedecor statistic is obtained from the F-distribution with p and n−p−1 degrees of freedom at a chosen significance level α :
Fcritical =Fα(p,n−p−1)The p -value of the F-statistic is computed as:
p-value =P(F≥Fobserved ∣H0 is true )If the p-value is less than the chosen significance level α, we’ll reject the null hypothesis and conclude that the past values explain the change in the time series.
4. Stationarity of Residuals
To test the stationarity of the residuals ϵt+1, we perform the Augmented Dickey-Fuller (ADF) test. The null hypothesis H0 is that the residuals are non-stationary (i.e., they follow a random walk):
H0: Residuals are non-stationaryThe test statistic is the t-statistic of the lagged residuals, and the p-value indicates whether we can reject the null hypothesis. If the p -value is less than α, we reject the null hypothesis and conclude that the residuals are stationary.
5. Autocorrelation of Residuals
In addition to the F-test, and in order to ensure no autocorrelation remains in the residuals, we perform the Ljung-Box test. The null hypothesis H0 is that there is no autocorrelation in the residuals:
H0 : No autocorrelation in residualsThe Ljung-Box test statistic is computed as:
Q=n(n+2)m∑k=1ˆρ2kn−kwhere ˆρk is the sample autocorrelation at lag k, and m is the maximum lag. The p -value is computed based on this statistic.
Examples
See: https://techtonique.github.io/ESGtoolkit/articles/martingale_test.html
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.