Hi dear all, i am triying to do jackknife-after bootstrap for detection of influential observation. my data and resamples are following ; e <- rnorm(n=50, mean=0, sd=sqrt(0.5625)) x0 <- c(rep(1,50)) x1 <- rnorm(n=50,mean=2,sd=1) x2 <- rnorm(n=50,mean=2,sd=1) x3 <- rnorm(n=50,mean=2,sd=1) x4 <- rnorm(n=50,mean=2,sd=1) y <- 1+ 2*x1+4*x2+3*x3+2*x4+e x2[1] = 10 #influential observarion y[1] = 10 #influential observarion data.x <- matrix(c(x0,x1,x2,x3,x4),ncol=5) data.y <- matrix(y,ncol=1) replicate(3100, data.x[sample(50,50,replace=T),], simplify = FALSE) replicate(3100, data.y[sample(50,50,replace=T),], simplify = FALSE) now i want to calculate each of 3100 resamples's Cook's Distance like this formula ; B.cap <- solve(crossprod(data.x)) %*% crossprod(data.x, data.y) P <- data.x %*% solve(crossprod(data.x)) %*% t(data.x) Y.cap <- P %*% data.y e <- data.y - Y.cap dX <- nrow(data.x) - ncol(data.x) var.cap <- crossprod(e) / (dX) ei <- as.vector(data.y - data.x %*% B.cap) pi <- diag(P) var.cap.i <- (((dX) * var.cap)/(dX - 1)) - (ei^2/((dX - 1) * (1 - pi))) ti <- ei / sqrt(var.cap * (1 - pi)) ti.star <- ei / sqrt(var.cap.i * (1 - pi)) pi.star <- pi + ei^2 / crossprod(e) Ci <- (ti^2/ncol(data.x))*(pi/(1-pi)) ####(Cook's Distance) and i want to compute each of resamples, which do not include the influential observation, Cook's Distances. Can someone help me about this ? Thanks for any idea.. -- View this message in context: http://r.789695.n4.nabble.com/Computing-and-Finding-tp3220423p3220423.html Sent from the R help mailing list archive at Nabble.com.