R is rbinom; what is the probability of success if there are N number of observations?

In R, you can generate data from a multidimensional distribution using rbinom. For example, if you do

  rbinom(400, 1, 0.2) 

It generates 400 points 0 or 1 with a probability of 0.2 that the data point is 1. So, the second argument is the number of tests, but I don’t know exactly what that means. What is the number of trials? If I set this value to 1, I see the values ​​0 or 1, and if I set it to N, I see the values ​​0 - N.

+12
source share
1 answer

size- This is the total number of tests from which it is expected to size*probbe successful.

rbinom(400, size = 10, prob = 0.2)

gives the results of 400 runs of 10 coin tosses, returning the number of successes in each run.

, rbinom(1, 10, 0.2) , sum(rbinom(10, 1, 0.2)).

+14

Source: https://habr.com/ru/post/1599772/


All Articles