I'm trying to simulate some BM for 500 observations.
I got correlated increments as I needed and they are not exactly N(0,1), so I standardize them (x-mean(x))/sd(x). But then the resulting Brownian motions are doing a weird elliptic shape and end up back on the x-axis. So I simulated fresh N(0,1) and used the standardizing function on them again (shouldnt do anything, should it?), but got the same result.
Any idea why is that? Why do they all (100 paths) converge exactly to zero? I guess it must be the normalisation function, but I cannot figure out why would they all go to zero because of that?
My code in R:
simGBM<-function(cov=TRUE,secs=100,Tau=500,sigma=0.05,neg.cor=0.3){
if(cov==TRUE){
# s<-apply(simSeries(simCov(secs,neg.cor),Tau),2,normalise)
m<-simCov(secs,neg.cor)
s<-simSeries(m,Tau)
} else {
s<-matrix(rnorm(secs*Tau),ncol=secs)}
dt<-1/(Tau)
BM<-apply(s,2,function(x) cumsum(sqrt(dt)*x))
GBM<-apply(BM,2,function(x) 100*exp((-0.5*sigma*sigma*dt+sigma*x)))
if(cov==TRUE) {return(list(GBM=matrix(GBM,ncol=secs),cov=m))}
else{return(matrix(GBM(ncol=secs)))}
}
normalise<-function(x){
( (x-mean(x))/sd(x) )
}
The s is either a series that I simulated with a some covariance structure, or pure white noise. Just to clarify, if I dont use the scaling function everything is ok and looks like it works correctly - checked against 'proven correct' examples.