[R] Binomial simulation

Johannes Huesing johannes at huesing.name
Sat Apr 18 06:56:13 CEST 2009


beetle2 <samandbrendan at aapt.net.au> [Fri, Apr 17, 2009 at 11:28:56PM CEST]:
> 
> Hi Guy's
> I was wondering if someone could point me in the right direction.
> 
> dbinom(10,1,0.25)
> 
> I am using dbinom(10,1,0.25) to calculate the probabilty of 10 judges
> choosing a certain brand x times. 

dbinom returns the discrete density of the binomial distribution, which
is in your case .75 at 0, .25 at 1 and 0 elsewhere (such as at 10).

Is dbinom(0:10, 10, .25) what you are driving at? 

> 
> I was wondering how I would go about simulating 1000 trials of each x value
> ?

Not being entirely sure what you mean, I think 

rbinom(1000, 10, .25)

may be what you want.

-- 
Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")




More information about the R-help mailing list