第1章

TV番組

おお笑い実験

  • 結果のばらつき,個人差

牛乳悪酔い防止

  • 個人差(対応)
  • 一般性(サンプルサイズ)
  • 作用機構

記述統計量

In [1]:
data1.m <- c(129.6, 130.5, 130.6, 131.1, 131.5, 132.0, 133.5, 133.9, 135.2, 135.3, 135.4, 136.7, 138.7, 139.3, 141.2)
data1.f <- c(128.5, 128.9, 129.2, 131.5, 131.7, 132.1, 132.1, 132.2, 133.0, 133.4, 133.8, 134.0, 135.2, 137.8, 138.6)
(data1 <- data.frame(male = data1.m, female = data1.f))
malefemale
129.6128.5
130.5128.9
130.6129.2
131.1131.5
131.5131.7
132.0132.1
133.5132.1
133.9132.2
135.2133.0
135.3133.4
135.4133.8
136.7134.0
138.7135.2
139.3137.8
141.2138.6
In [2]:
sapply(c("pipeR", "dplyr", "tidyr", "ggplot2"), require,character.only=TRUE)
Loading required package: pipeR
Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: tidyr
Warning message:
"package 'tidyr' was built under R version 3.3.3"Loading required package: ggplot2
Warning message:
"package 'ggplot2' was built under R version 3.3.3"
pipeR
TRUE
dplyr
TRUE
tidyr
TRUE
ggplot2
TRUE
In [3]:
options(repr.plot.width = 4, repr.plot.height = 4)
In [ ]:

In [13]:
data1 %>>% gather(key = gender, value = height) %>>% 
    ggplot(aes(x = gender, y = height)) + 
        geom_boxplot() + 
        scale_y_continuous(limits = c(120, 160))
In [9]:
data2.m <- c(138.4, 138.9, 142.8, 143.2, 144.0, 144.1, 144.4, 144.6, 144.8, 145.8, 146.2, 146.7, 147.0, 148.6, 149.5)
data2.f <- c(142.3, 142.4, 143.4, 144.0, 144.3, 145.6, 145.9, 147.7, 147.9, 148.6, 149.2, 149.7, 151.6, 151.9, 152.0)
(data2 <- data.frame(male = data2.m, female = data2.f))
malefemale
138.4142.3
138.9142.4
142.8143.4
143.2144.0
144.0144.3
144.1145.6
144.4145.9
144.6147.7
144.8147.9
145.8148.6
146.2149.2
146.7149.7
147.0151.6
148.6151.9
149.5152.0
In [14]:
data2 %>>% gather(key = gender, value = height) %>>% 
    ggplot(aes(x = gender, y = height)) + 
        geom_boxplot() + 
        scale_y_continuous(limits = c(120, 160))

1.3

  • 推定
  • 検定
  • 予測