From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>

Date: Sun, 01 May 2011 18:02:50 +0200

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 05 May 2011 - 06:25:08 GMT

Date: Sun, 01 May 2011 18:02:50 +0200

On 29.04.2011 22:20, hck wrote:

*> Barth sent me a very good code and I modified it a bit. Have a look:
**>
**> Error<-rnorm(10000000, mean=0, sd=0.05)
**> estimate<-(log(1+0.10)+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))
**> DCF_verzerrt<-(1/(exp(estimate)-1))
**>
**> S<- 10000000 # total sample size
**> D<- 10000 # number of subsamples
**> Subset<- 10000 # number in each subsample
**> Select<- matrix(sample(S,D*Subset,replace=TRUE),nrow=Subset,ncol=D)
**>
**> DCF_korrigiert_select<- matrix(DCF_korrigiert[Select],nrow=Subset,ncol=D)
**> Delta_ln<-(log(colMeans(DCF_korrigiert_select, na.rm=T)/(1/0.10)))
**>
**>
**>
**> The only problem I discovered is that R cannot handle more than
**> 2.147.483.647 integers, thus the cells in the matrix are bounded by this
**> condition. (R shows the max by typing: .Machine$integer.max). And if you
**> want to safe the workspace, the file with 10.000 times 10.000 becomes round
**> 2 GB. Compared to the original of "just" 300 MB.
**>
**> So I cannot perform my previous bootstrap with 1.000.000 times 100.000. But
**> nevertheless 10.000 times 10.000 seems to be sufficiently; I have to say its
**> amazing, how fast the idea works.
**>
**> Has anybody a suggestion how to make it work for the 1.000.000 times 100.000
**> bootstrap???
*

Run it in several blocks of matrices with appropriate dimensions? This allows easy parallelization as well.

Uwe Ligges

*>
**>
**> --
*

> View this message in context: http://r.789695.n4.nabble.com/Speed-up-code-with-for-loop-tp3481680p3484548.html

*> Sent from the R help mailing list archive at Nabble.com.
**>
**> ______________________________________________
**> R-help_at_r-project.org mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
**> and provide commented, minimal, self-contained, reproducible code.
*

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 05 May 2011 - 06:25:08 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 07:00:06 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*