I would like to create a block, meaning an immutable list of numbers, of a sequence of numbers in R. Meaning that when I index the list, I will get the group of numbers.
ts <- cbind(1:11, 12:22, 23:33, 34:44, 45:55, 56:66, 67:77, 78:88, 89:99, 100:110, 111:121)
#divide numbers in 11 groups
sample(a, 11, replace=TRUE)
#should "shuffle" the blocks so that I have for example (12:22, 34:44, 45:55, 56:66, 56:66, 34:44, etc.)
ts[3]
[23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
This will be used to bootstrap. Rest of the code is already set, which I will post for reference below.
for (j in 1:10){
s <- NULL
#ts is the above sequence
s <- sample(ts, 11, replace = TRUE)
a3 <- Three_grosslarger2[s,]
x <- factors[s,]
for (i in 1:length(Four_grosslarger2)){
m_a3 <- summary(lm(a3[,i] - x[,4] ~ x[,1] + x[,2] + x[,3] + x[,5], na.action = na.exclude), data = a3)
Four_grosslarger2_a[j, i] <- m_a3$coefficients[1,1]
Four_grosslarger2_ta[j, i] <- m_a3$coefficients[1,3]
Thank you!