I'd like to plot the probability distribution for a set of binomial trials in R, the catch is that each trial has an independent probability of success (which I have in vector form).
So, in R if I were doing this with coin tosses: plot(x,dbinom(x,10,.5))
would work, where x
is 0:10
. This shows the probability distribution by plotting number of successful trials on the x-axis with percent of the time that specific results is achieved as the y
(4 successes is 20.5%).
That said, how do I plot the same graph for 10 discrete trials with varying probabilities. For instance if odds<-c(.1,.8,.2,.2,.3,.7,.9,.99,.05,.5)
, was the probability of success for each independent toss, and I wanted to see a probability distribution?