Displaying 1 result from an estimated 1 matches for "dcf_korrigiert".
2011 Apr 28
3
Speed up code with for() loop
Hallo everybody,
I'm wondering 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 sev...