본문 바로가기

Jackknife 본문

Applied/Statistical Computing

Jackknife

TaeTrix 2022. 11. 27. 22:18
#jackknife - 1
theta.hat <- cor(dat$newpatch, dat$oldpatch)
n <- nrow(dat);n

theta.hat.minus <- numeric(n)
for(i in 1:n){
  theta.hat.minus[i] <- cor(dat$newpatch[-i], dat$oldpatch[-i])
}
theta.hat.minus

bias.jack <- (n-1)*(mean(theta.hat.minus) - theta.hat);bias.jack
theta.jack <- theta.hat - bias.jack;theta.jack

theta.hat.star.minus <- n*theta.hat - (n-1)*theta.hat.minus
mean(theta.hat.star.minus)

se <- sqrt((n-1)*mean((theta.hat.minus - mean(theta.hat.minus))^2));se

 

#jackknofe - 2

library(bootstrap)
dat <- law;dat

 

theta.hat <- cor(dat$LSAT, dat$GPA)
n <- nrow(dat);n
theta.hat.minus <- numeric(n)
for(i in 1:n){
  theta.hat.minus[i] <- cor(dat$LSAT[-i], dat$GPA[-i])
}

bias.jack <- (n-1)*(mean(theta.hat.minus) - theta.hat)
se.jack <- sqrt((n-1)*mean((theta.hat.minus - mean(theta.hat.minus))^2))

'Applied > Statistical Computing' 카테고리의 다른 글

Permutation Test  (1) 2022.12.01
Chapter 14.5 ) The EM - Algorithm  (0) 2022.11.22
Chapter 14 - 1 ) Quasi-Newton Algorithm  (0) 2022.11.18
Chapter 14 - 0 ) Optimization Introduction  (0) 2022.11.17
Bootstrap estimate of bias  (0) 2022.11.13
Comments