[R] "rbinom" not using probability of success right

From: Philip Twumasi-Ankrah <nana_kwadwo_derkyi_at_yahoo.com>
Date: Wed, 28 May 2008 05:53:26 -0700 (PDT)

I am trying to simulate a series of ones and zeros (1 or 0) and I am using "rbinom" but realizing that the number of successes expected is not accurate. Any advice out there.

This is the example:

status<-rbinom(N, 1, prob = 0.15)

15 percent of 500 should be 75 but what I obtain from the "count" variable is 77 that gives the probability of success to be 0.154. Not very good.

Is there another way beyond using "sample" and "rep" together?

A Smile costs Nothing

     But Rewards Everything

Happiness is not perfected until it is shared

                                                              -Jane Porter        

	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 28 May 2008 - 13:01:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 May 2008 - 15:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive