Triad sou.

2009-11-01から1ヶ月間の記事一覧

高速 tapply(X, INDEX, var) もどき関数

R

関数を作ってみました。 HS.tapply <- function(x, index, type) { # create index indicate matrix index <- as.numeric(factor(index)) mindex <- NULL for(i in 1:length(unique(index))) { mindex <- cbind(mindex, index-(i-1)) } if (type == 5 || typ…

apply関数は遅かった・・・

R

うーん、こりゃ参ったねw n <- 20 rep <- 100000 d <- matrix(rnorm(n*rep), nrow=n, ncol=rep ) # apply Rprof() varA <- apply(d, 2, var) Rprof(NULL) print(a <- summaryRprof()$sampling.time) # matrix operation (1) Rprof() varB <- NULL for(i in …

Satterthwaiteの近似 (2)

前回書いた結果をもとにして、ちゃんと近似できているのか試してみることにしました。 今回は Welch (1938) の (2) 式の統計量 \[ v=\frac{\bar{X}_1-\bar{X}_2}{\sqrt{\frac{V_1}{n_1}+\frac{V_2}{n_2}}} \] を導出する過程で出てくる分布の近似を考えてみ…

pivotal quantityと無情報事前分布

[1] の説明が分からなかったので、考えたり調べたりしていたら [2] を見つけることが出来た。 ある尤度関数 $p(y \mid \theta)$ に対して、無情報事前分布を構成する事を考える。 どんなパラメータ $h(\theta)$ に対して一様な事前分布を考えるかによって、$…

Bayesian Modeling Using WinBUGS

Ntzoufras I. Bayesian Modeling Using WinBUGS (Wiley Series in Computational Statistics). New York: John Wiley & Sons, Inc. 2009 ぱらぱらっと読ませてもらいました。 うーん、欲しいけど高い。