Displaying 1 result from an estimated 1 matches for "delta_ln".
2011 Apr 28
3
Speed up code with for() loop
...ondering whether it might be possible to speed up the following code:
Error<-rnorm(10000000, mean=0, sd=0.05)
estimate<-(log(1.1)-Error)
DCF_korrigiert<-(1/(exp(1/(exp(0.5*(-estimate)^2/(0.05^2))*sqrt(2*pi/(0.05^2))*(1-pnorm(0,((-estimate)/(0.05^2)),sqrt(1/(0.05^2))))))-1))
D<-100000
Delta_ln<-rep(0,D)
for(i in 1:D)
Delta_ln[i]<-(log(mean(sample(DCF_korrigiert,1000000,replace=TRUE))/(1/0.10)))
The calculation of the for-loop takes several hours even on a very quick
machine (4GHz, 8 GB RAM Windows 2008 Server 64bit). Has anybody an idea, how
to improve the for-line?
Thanks for he...