I created the following code to calculate the variance using the jackknife method. However, instead of removing one term at a time, I now need to remove it by 2 in 2. I know it's something basic, but I could not think how to do it, could anyone give me some idea?
A<- numeric(1000)
var1<- numeric(1000)
x<- data.frame(numeric(9))
amostra<- rnorm(10,100,10) #gerando amostra
for(i in 1:10){
x[i]<-c(amostra[-i]) #tirando um termo da amostra
}
var2<- numeric(10) #calculando as variancias dos vetores n-1
for(i in 1:10){
var2[i]<- var(x[,i])
}
Tn<- sum(var2) #soma das variancias de 3 termos
var1[j] <- var(amostra)# variancia da amstra de tamanho n
A[j]<-10*var1[j]-((9/10)*Tn) # variancia Jackknife