2008-10-02から1日間の記事一覧

Rでブートストラップ

R

単純なものですが、半分お遊びで。 boot.mean <- function(x,times=1000){ set.seed(101) b <- numeric(times) for(i in 1:times){ c <- sample(x,replace=T) b[i] <- mean(c) } cat("回数",times,"\n") cat("bootstrap平均",mean(b),"\n") cat("bootstrap標…