2
I created the following code to calculate the variance using the jackknife method. However, instead of taking one term at a time, I now need to take it out two by two. I know it’s something basic, but I couldn’t think of a way to do it, someone could 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
It helped a lot, from there I can develop the rest! Thank you!
– Amanda