LoginSignup
0
0

More than 3 years have passed since last update.

Rで二項分布のグラフを作る

Last updated at Posted at 2020-05-10
tags: rBasicLearning

二項分布のグラフを作る

表の出る確率が0.8のコインを3回投げた時の二項分布のグラフ

グラフ化

x <- 0:3
n <- 3
p <- 0.8
plot(x, dbinom(x,n,p))
plot(x, dbinom(x,n,p), type="h")

二項分布の式

二項分布の定義式は、

$$f(x) = {}_n \mathrm{C} _r \cdot p^x \cdot (1 - p)^{n - x}$$

$n = 3$, $p = 0.8$より
$$f(x) = {}_3 \mathrm{C} _r \cdot (0.8)^x \cdot (1 - 0.8)^{3 - x}$$
これより、

$f(0) = 1\cdot1\cdot(0.2)^3 = 0.008$
$f(1) = 3\cdot0.8\cdot(0.2)^2 = 0.096$
$f(2) = 3\cdot(0.8)^2\cdot0.2 = 0.384$
$f(3) = 1\cdot(0.8)^3\cdot1 = 0.512$

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0