Whipped up something quick to test if stock X follows a random walk…

GOOG apparently does not.

#load libraries library(quantmod) library(vrtest) # get Data replace goog with your stock of choice symbol = "GOOG" currency("USD") stock(symbol, currency="USD", multiplier = 1) getSymbols(symbol,src="yahoo") #make returns rets<-ROC(Cl(GOOG)) #get rid of the NA for the first term rets2<-rets[2:length(rets)] #Variance Ratio test teststat<-Auto.VR(rets2) #norm crit value (1.96) from tables, Lo and McKinlay (1988) use a normal dist ifelse(teststat>1.96,result<-"Not a random Walk",result<- "Random Walk" )