[R] bootstrap help

luciferyan anniehyhung at googlemail.com
Wed Jan 6 18:42:00 CET 2010


I have a similar question.
I want to generate list of 50 bootstrap samples,
it can be done by:

lapply(1:50,function(i){data[sample(nrow(data),size=nrow(data),replace=TRUE),]})

>From these  bootstrap samples, I want to work out the Bootstrap estimates,
which is E[y]/E[x].
How can I do it?

'>> data<-data.frame(x=rnorm(49), y=rnorm(49))
>> t(sapply(1:50,function(i){colMeans(data[sample(nrow(data),size=nrow(data),replace=TRUE),])}))'
These codes will generate mean of column x and mean of column y. 
Is y the corresponding of x? because x and y are pair data.

Thank you.
-- 
View this message in context: http://n4.nabble.com/bootstrap-help-tp949807p1008227.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list