[R] Binomial simulation

Ranjan Maitra maitra at iastate.edu
Sun Apr 19 18:08:03 CEST 2009


With due respect, and in all fairness, you should inform your instructor
that you took help from R's mailing list for doing homework. 

This mailing list (or any other general mailing list for that matter) is
not for doing your (or anyone else's) homework. If the instructor
allowed that, that is a different story but you should state that in
your post to the mailing list.

Ranjan

On Sat, 18 Apr 2009 15:06:15 -0700 (PDT) beetle2
<samandbrendan at aapt.net.au> wrote:

> 
> Thank you for your help!
> Yes you are right the probabilities are for the values 0 through 12.
> I been asked to compare the simulated values to that of dbinom()
> once again thanks!
> 
> 
> 
> 
> 
> Ranjan Maitra wrote:
> > 
> > This sounds like a potential homework problem. You don't quite need to
> > simulate anything if your question is all you have been asked to do.
> > 
> > dbinom(x = 1:10, size = 10, prob = 0.25)
> > 
> > Perhaps you have been asked to simulate 1000 realizations and compare
> > the relative frequencies with these probabilities: use 
> > 
> > rbinom(n = 1000, size = 10, prob = 0.25)
> > 
> > in that case and compare the relative frequencies.
> > 
> > Btw, there is a small chance of getting a 0. Are you sure the
> > instructor (or whoever has issued the orders) wants only from 1:10?
> > 
> > HTH!
> > Ranjan
> > 
> > On Fri, 17 Apr 2009 22:23:11 -0700 (PDT) beetle2
> > <samandbrendan at aapt.net.au> wrote:
> > 
> >> 
> >> 
> >> Not being entirely sure what you mean, I think 
> >> 
> >> rbinom(1000, 10, .25) 
> >> 
> >> may be what you want. 
> >> 
> >> Hi,
> >> Thanks for your reply.
> >> It is close to that but I need to know the probabilty of how many judges
> >> pick a certain brand.
> >> Just say x= 6 judges pick brand A which has P=0.25.
> >> 
> >> Using R it would be:
> >> > dbinom(6,10,.25)
> >> [1] 0.016222
> >> 
> >> Probability of six judges choosing  brand A. Hence not very likely.
> >> 
> >> I have been asked to do this for all values of x = 1 to 10.
> >> But the question says to simulate 1000 trials for each x value.
> >> I'm not sure how to construct the simulation.
> >> regards
> >> Brendan
> >> 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Binomial-simulation-tp23106347p23109522.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >> 
> >> ______________________________________________
> >> 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.
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Binomial-simulation-tp23106347p23117793.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.
>




More information about the R-help mailing list