LoginSignup
1
1

More than 5 years have passed since last update.

Rで超幾何分布を用いてp-valueを計算する

Posted at

overrepresentationを計算するときに、p(X>=x)を計算したい。
しかし、Rのphyperではp(X<=x)を計算するため、工夫が必要。

x # white balls drawn
m # nunmber of white balls in bag
n # number of black balls in bag
k # number of balls drawn

p <- 1 - phyper(x-1, m, n, k) # P[X >= x] = 1 - P[X <= x-1]
1
1
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
1
1