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

From: Charles Annis, P.E. <Charles.Annis_at_statisticalengineering.com>
Date: Wed, 28 May 2008 09:06:47 -0400

Do it again. What did you get this time? Then do it another time. Do you see what is happening?

Charles Annis, P.E.

Charles.Annis_at_StatisticalEngineering.com phone: 561-352-9699
eFax: 614-455-3265
http://www.StatisticalEngineering.com  

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Philip Twumasi-Ankrah
Sent: Wednesday, May 28, 2008 8:53 AM
To: r-help_at_r-project.org
Subject: [R] "rbinom" not using probability of success right

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:

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

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.

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 - 15:15:06 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