I have this code and I want sample(1:3650, 365, replace=T) to generate the same numbers at both instances, but different values for each replication. This is my attempt at making a function for bivariate bootstrap. I know how to fix this with a for loop but it takes forever to run, so would be nice it could be made without.
listboot1sl = c()
listboot2sl = c()
pairbootstrap2 <- function(y) {
.GlobalEnv$listboot1sl <- replicate(10**y, rbind(listboot1sl, max(sum(mydf1allt[,2][sample(1:3650, 365, replace=T)])-17980405,0)))
.GlobalEnv$listboot2sl <- replicate(10**y, rbind(listboot2sl, max(sum(mydf2allt[,2][sample(1:3650, 365, replace=T)])-137376627,0)))
}
(mydf2allt is made out of two columns with numbers.)
Aucun commentaire:
Enregistrer un commentaire