Cosider a discrete-time radom walk x t =u + +u t with i.i.d. N(,σ ) icremets u t. Exercise: Show that UL ( x) = 3 x t L σ N(, 3 ). Exercise: Show that U (i) x t ~N(,tσ ), (ii) s<t x t x s ~N(,(t s)σ ), (iii) q<r s<t x r x q ad x t x s are idepedet. Exercise: Show that the discrete-time radom walk satisfies the differece equatio x t =φ x t- +u t with x = ad φ=. U x t Solutio: 3 x t = u +(u +u )+ +(u + +u ) = u +( ) u + +u ~ N(,( +( ) + + )σ ) ( + )(+ ) = N(, 6 ( + )(+ ) σ ) ~ N(, σ ). 3 44 6443 σ 3
Exercise: Compare the daily quotes of the S&P 5 idex (symbol: ^GSPC) with realizatios of a radom walk. Dowload the historical prices from Yahoo!Fiace as a csv file ^GSPC.csv ito the workig directory C:\SP5. Import the data ito R ad plot the log closig prices ad 3 realizatios of a radom walk (with drift) with matchig parameters (startig value, mea ad variace of log returs). setwd("c:/sp5") # R uses / as path separator Y <- read.csv("^gspc.csv",header=t,a.strigs="ull") # i the dowloaded file, missig values are represeted # by the strig "ull" rather tha by the symbol NA Y <- a.omit(y) # rows with missig values are omitted N <- row(y); D <- as.date(y[,]) # dates i colum cl <- log(y[,6]) # adjusted close prices i colum 6 r <- cl[:n]-cl[:(n-)]; <- N- # (log) returs my <- mea(r); sigma <- sd(r) # sample momets par(mar=c(,,,)); COL <- c("red","gree","blue") plot(d,cl,type="l",ylim=rage(cl)+c(-,)) for (j i :3) { u <- rorm(,m=my,sd=sigma) x <- cumsum(c(cl[],u)); lies(d,x,col=col[j]) }
Exercise: Compare the (log) returs with matchig Gaussia icremets ad resampled returs. par(mar=c(.,,.,.)); YL <- c(-.9,.9) plot(r,type="l",ylim=yl) # returs Resamplig blocks of returs rather tha idividual returs produces clusters of differet volatility. # k=/b ooverlappig blocks of legth b: b <- 5; k <- truc(/b); K <- sample(:k,k,replace=t) u <- NULL; for (j i K) u <- c(u,r[(j-)b+:b]) u <- rorm(,m=my,sd=sigma); plot(u,"l",ylim=yl) # k=/b overlappig blocks of legth b: b <- 5; k <- truc(/b); K <- sample(:(-b),k,t) u <- NULL; for (j i K) u <- c(u,r[j+:b]) Obviously, the desity of the returs has more probability mass ear the ceter as well as i the tails tha a ormal desity. A more realistic sample of sythetic returs ca be obtaied by resamplig the give returs. u <- sample(r,size=,replace=t); plot(u,"l",ylim=yl) # statioary bootstrap: blocks of radom legth q <-.996; K <- sample(:,,t) # mea legth=/(-q) for (i i :) if (ruif()<q) # icrease block with prob. q K[i] <- ifelse(k[i-]!=,k[i-]+,); u <- r[k] 3
Give observatios x,,x from a discrete-time radom walk, a simple cotiuous-time process ca be defied by x (t)=x [t], t [,], where x = ad [t] is the greatest iteger less tha or equal to t. Exercise: Show that as UC (i) Var(x ()) ad (ii) < α Var(x ())< α=. Exercise: Show that the cotiuous-time process UN satisfies (i) (ii) x (t)= x (t)= x [t], t [,], x ()=, x (t) L N(,tσ ), (iii) s<t x (t) x (s) L N(,(t s) σ ), (iv) q<r s<t x (r) x (q) ad x (t) x (s) are idepedet if is sufficietly large. Exercise: Plot realizatios of the discrete-time process x t ad the cotiuous-time process x (t) for σ = ad =. par(mar=c(,,.,.),pch=9); <- t <- c(:); x <- cumsum(c(,rorm())); plot(t,x) t <- t/; x <- x/^.5; plot(t,x,type="s") # "s": stair steps (move first horizotal, the vertical) 4
Exercise: Plot realizatios of the process ad =,. x (t) for σ = As icreases the height of the jumps i the graph of x (t) decreases. We ca therefore expect cotiuity i the limit. Of course, this does ot imply smoothess. A cotiuous-time process B(t), t [,], is called Browia motio with variace σ if (i) B()=, (ii) B(t)~N(,tσ ), (iii) s<t B(t) B(s)~N(,(t s) σ ), (iv) q<r s<t B(r) B(q) ad B(t) B(s) are idepedet. Browia motio with variace is called stadard Browia motio or Wieer process. 5
Exercise: Show that UB s<t Cov(B(s),B(t))=sσ. Solutio: Cov(B(s),B(t)) = Cov(B(s),(B(t) B(s))+B(s)) = Cov(B(s),B(t) B(s))+Cov(B(s),B(s)) = Cov(B(s) B(),B(t) B(s))+Var(B(s)) = +sσ It ca be show that ay realizatio of Browia motio is everywhere cotiuous ad owhere differetiable with probability. Ideed, for <h we have ad E(B(t+h) B(t)) = Var(B(t+h) B(t)) = ((t+h) t)σ = hσ E B( t+ h) B( t) h = h hσ = h σ. UD 6
For ay fixed <τ, the cetral limit theorem applied to the mea [ τ] [ τ] u t of the fractio u,,u [τ] of the whole sample u,,u gives ad x (τ)= [ τ] τ [ τ] u t [ ] [ τ] u t = [τ] [ τ] [ τ] L N(,σ ) [ τ] u t L τn(, σ ). 443 = N(, τσ ) I cotrast, the fuctioal cetral limit theorem cocers the asymptotic behavior of x regarded as a stochastic fuctio of τ, i.e., x L B, where B is Browia motio with variace σ. For the extesio of covergece i law to radom fuctios, it is required, amog other coditios, that ( x (τ ),, x (τ k )) T L (B(τ ),,B(τ k )) T for ay τ < < τ k. The cotiuous mappig theorem (CMT): For a sequece of radom variables x t ad a cotiuous fuctio g, we have x L x g(x ) L g(x). Aalogously, we have for a sequece of stochastic fuctios f ad a cotiuous fuctioal g, f L f g(f ) L g(f). Fuctioals map a fuctio ito a real umber ad a stochastic fuctio ito a radom variable, respectively. Examples: (i) g ( f) = f(), (ii) g ( f) = f( τ) 7
Example: g (f) = f ( τ) g ( x ) = = = x ( τ) = x[ τ ] ( x[ τ ] + + x[ τ ] ) ( x + + x ) = x L B g ( x )= 3 x t x 3 x t ( τ) L g (B) = B ( τ) L N(, σ ) 3 B ( τ) ~ N(, 3 σ ) Example: g (f) = ( f ( τ)) g ( x ) = x ( ( τ)) = = ( x [ τ + + ] x τ ] [ x [ τ ] ) = ( x + + x )= x L B g ( x ) = x t. ( x ( τ)) L g (B)= ( B ( τ)) R RM 8
Uder the uit root hypothesis RU H : φ=, the expected value of the deomiator of the statistic is give by φˆ φ =φˆ = x t u t / x t E( u = σ +... + u t ) ( t ) = σ, which implies that we eed to multiply φˆ by i order to obtai a odegeerate asymptotic distributio. The estimator φˆ is called a supercosistet estimator, because it coverges to φ= at a faster rate tha usual. We have (φˆ ) = x t u t / x t = (u u +(u +u )u 3 + +(u + +u - )u )/ g ( x ) u t = ( ( u t ) )/ x (( x ()) σ )/ ( x ( τ)) = g 3 ( x ), L g 3 (B) = ((B()) σ )/ ( ( τ)) ( Bτ ( )) = ((W()) ) / ( W ( τ)). = The radom variable i the umerator is.5 times a demeaed χ ()-variable ad is therefore skewed to the right. 9
We caot use the statistics ( )(φˆ ) or (φˆ ) to test the uit root hypothesis H : φ= agaist the alterative hypothesis H A : φ< uless we have critical values. For the calculatio of critical values, we do ot eed to use the asymptotic distributio of the respective test statistic. Istead, we ca use Mote Carlo techiques. First, we ca geerate m pseudo-radom samples u (j),,u (j), j=,,m, of N(,) variates ad the compute φˆ for each sample. Fially, order statistics are used to estimate the quatiles of iterest. Exercise: Fid critical values for the test statistic (φˆ ). Use =5, 5,,, m=,, ad α=.5. m <- ; <- 5; <- -; phi <- rep(,m) for (i i :m) { u <- rorm(); x <- cumsum(u)[:] phi[i] <- sum(xu[:])/sum(xx) } # phi=phi- q <- quatile(phi,probs=.5); cr.val <- q; cr.val -7.654794 Aalogously, we obtai the remaiig values (α=.5): for m= for m= 5-7.7-7.3 5-7.7-7.8-8. -7.8-8.5-8. Clearly, the values obtaied with m= are more reliable tha those obtaied with m=. Furthermore, we ca use the critical values obtaied for large values of, e.g., =, as estimates of the critical values of the asymptotic distributio.
Exercise: Test H : φ= for a sythetic AR() series. x <- arima.sim(list(order=c(,,),ar=.7),=5) # φ=.7 <- 5; x <- x[:(-)] phi <- sum(xx[:])/sum(xx) (phi-) -8.74 The uit root hypothesis H ca be rejected, because the value of the test statistic is less tha the critical value for a sample size of 5, i.e., -8.74 < -7.3. Exercise: Suppose that x,,x are o-stochastic ad u,,u are ucorrelated with commo mea ad variace σ. Show that i the liear regressio model y =β x + u the variace of the OLS estimator βˆ is give by RV t t var( ˆ) β = σ /. t x t Aother way of testig the uit root hypothesis is to write the model x t =φ x t- +u t as x t =x t x t- =φ x t- +u t x t- =φ x t- +u t, where φ =φ, ad reject H if the value of the OLS estimator ˆ φ = x t x t / x t or, alteratively, the covetioal OLS t-ratio where ˆ var( φ ) = t = ˆ φ / ˆ var( φ ) x ˆ t xt ) ( φ /, x t, is much smaller tha. The test based o t is called Dickey-Fuller test. Clearly, t has either a t-distributio or a limitig ormal distributio if φ=.
A more realistic model is obtaied by itroducig additioal lags i order to allow for serial correlatio: Writig the model as x t =φ x t- + +φ p x t-p +u t x t =(φ ) x t- + +φ p x t-p +u t =[(φ + +φ p ) (φ + +φ p )] x t- +[(φ + +φ p ) (φ 3 + +φ p )] x t- M +[φ p- +φ p ) φ p ] x t-(p-) +φ p x t-p +u t =(φ + +φ p ) x t- (φ + +φ p ) x t- φ p x t-(p-) +u t =φ x t- +δ x t- + +δ p x t-p- +u t we see that the uit root hypothesis Φ ()= φ φ p = is equivalet to the hypothesis H : φ =. RL Icludig also a costat term ad a liear time tred, we obtai a eve more geeral model: x t =α+βt+φ x t- +δ x t- + +δ p x t-p +u t The test of the hypothesis H : φ =, which is based o the covetioal OLS t-ratio for φ, is called augmeted Dickey-Fuller (ADF) test. I practice, it is extremely hard to decide whether a costat term ad a time tred should be icluded ad how may lags should be icluded. Ufortuately, differet model specificatios typically produce differet test results. Exercise: Apply a augmeted Dickey-Fuller test to the log S&P5 series created above. Hit: library(tseries) # the package tseries is loaded help(adf.test)