I think you refer to the questions about the arguments, rather than your ambigous example questions. Regarding dbinom()
, size means the number of trials (since in a binomial setting, you have n trials) and x refers to the number of successful trials. The argument prob means the probability of success. In your initial question, you basically asked for "What is the probability of 48 out of 50 trials being successful, if the probability to be successful is equal to 95%?".
In rbinom()
you want to simulate random outcomes of a given binomial distribution. Here, the argument n is equal to the number of simulations (e.g. 5 means you want to repeat the random drawing 5 times), the argument size refers to the number of trials (as stated by the documentation) and prob is again the probability for success. So say you want to know how often there is heads, if 5 students each throw a coin 100 times. Then you can do this with rbinom()
as follows:
rbinom(n = 5, size = 100, prob = 0.5)
#> [1] 44 52 50 48 55
Created on 2022-09-13 by the reprex package (v2.0.1)
Here, student 1 had 44 times heads (or tails, if you treat success as tails, whatever pleases you) and so on. That's all about rbinom()
basically.
Your example questions are ambigous in my opinion, since they are not fully clear. Take the first one
This would require 100 observations of the results, which we don't have. If you have those observations, you will have to use a statistical test to verify, that the coin doesn't have a 50:50 chance to throw heads or tails. But you won't be able to obtain the correct probability of the coin, since in hypothesis testing there is only significant rejection, not confirmation.
Maybe this helped you to understand the function arguments of dbinom()
and rbinom()
a bit better.
Kind regards