K050 t分布f分布
Click here to load reader
-
Upload
t2tarumi -
Category
Technology
-
view
78 -
download
3
Transcript of K050 t分布f分布
情報統計学
t分布, F分布
1
t分布
• 密度関数のグラフは curve(dt(x, 10), -4, 4)
2
-4 -2 0 2 4
0.0
0.1
0.2
0.3
0.4
x
dt(
x, 1
0)
t分布と正規分布の確率密度関数
• curve(dt(x, 10), -4, 4)• curve(dt(x, 2), -4, 4, col = 2, add = TRUE)
• curve(dnorm, -4, 4, col = 3, add = TRUE)
3
-4 -2 0 2 4
0.0
0.1
0.2
0.3
0.4
x
dt(
x, 1
0)
t分布のパーセント点
> qt(0.05, 5)
> qt(0.05, c(1, 2, 3, 4, 5, 10, 20, 50, 100))
[1] -6.313752 -2.919986 -2.353363 -2.131847 -2.015048 -1.812461 -1.724718
[8] -1.675905 -1.660234
> qt(c(0.05, 0.95), 5)
[1] -2.015048 2.015048
> pt(2.015048, 5)
[1] 0.95
4
シミュレーション 1
nrdata <- rnorm(1000)
chi2data <- rchisq(1000, 10)
hist(chi2data)
tdata <- nrdata / (sqrt(chi2data / 10))
mean(tdata)
sd(tdata)
curve(dt(x, 10), -4, 4, col = 2)
hist(tdata, freq = F, add=TRUE)
5
-4 -2 0 2 4
0.0
0.1
0.2
0.3
0.4
x
dt(
x, 1
0)
シミュレーション 2 6
7
8
tcalc <-function(x){
barx <- mean(x)
sdx <- sd(x)
tval <- barx / (sdx / sqrt(length(x)))
tval
}
ran <- sapply(rep(10, 1000), rnorm)
sample.t <- apply(ran, 2, tcalc)
hist(sample.t, nclass = 20, freq = F)
curve(dt(x, 9), -4, 4, col = 2, add = T)
9
Histogram of sample.t
sample.t
De
nsi
ty
-4 -2 0 2 4
0.0
0.1
0.2
0.3
0.4
F分布 10
F分布の密度関数
> curve(df(x,1,10),0.00000001,5,ylim=c(0,1.5))
> curve(df(x,2,10),0.00000001,5,col=2,add=T)
> curve(df(x,3,10),0,5,col=3,add=T)
> curve(df(x,8,10),0,5,col=4,add=T)
> curve(df(x,8,20),0,5,col=5,add=T)
11
0 1 2 3 4 5
0.0
0.5
1.0
1.5
x
df(
x, 1
, 10)
シミュレーション
> c8rand <- rchisq(1000, 8)
> c10rand <- rchisq(1000, 10)
> fprop <- (c8rand / 8) / (c10rand / 10)
> hist(fprop, nclass = 20, freq = F)
> hist(fprop, nclass = 20, freq = F)$count
> curve(df(x,8,10), 0, 5, col = 2, add = TRUE)
12
Histogram of fprop
fprop
Density
0 2 4 6 8 10
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
13