Hi everyone, Here's how I solved a problem for my stats class. I'm pretty sure I understand what's going on, but I wonder if there's a more direct way to solve it. Problem summary: A recent poll indicated that Candidate A is leading B with 55% of the vote. How many voters need to be surveyed to ensure a margin of error of +/- 2.5% with 99% confidence. Here's what I did:> binom.test(55, 100, 0.5, alternative='t', conf.level=0.99)Exact binomial test data: 55 and 100 number of successes = 55, number of trials = 100, p-value 0.3682 alternative hypothesis: true probability of success is not equal to 0.5 99 percent confidence interval: 0.4170382 0.6780727 sample estimates: probability of success 0.55 After some trial and error I got:> binom.test(1100, 2000, 0.5, alternative='t', conf.level=0.99)Exact binomial test data: 1100 and 2000 number of successes = 1100, number of trials = 2000, p-value 8.457e-06 alternative hypothesis: true probability of success is not equal to 0.5 99 percent confidence interval: 0.5210033 0.5787563 sample estimates: probability of success 0.55 So my answer is that you would need to survey more than 2000 persons. Is there a way other than trial and error to solve this? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson at visi.com | <dtml-var pithy_quote> | http://linux.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Here's how I solved a problem for my stats class. I'm pretty sure I > understand what's going on, but I wonder if there's a more direct way > to solve it.(a) You definitely don't have to --- and SHOULDN'T --- use ``trial and error''. (b) You should talk to the instructor of your stats class. That's what he or she is paid for. (c) You should also read your textbook. (d) This is a very standard sort of problem. It is also very easy to solve with pencil and paper (or at the very least a hand calculator). You do ***not*** need to use binom.test() (in fact this is counter productive) nor do you need to use prop.power.test() as someone else suggested (although this will do it for you). There is a formula for the required sample size which is surely given in your textbook --- in ***any*** introductory stats textbook. The formula is readily amenable to use with ``hand calculations''. Find the formula and use it. (e) You were given this exercise to get you to learn some of the basic ideas about confidence intervals for proportions. Learn them. Don't try to dodge the issue by pumping numbers through a computerized ``black box''. cheers, Rolf Turner rolf at math.unb.ca -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This reply, while probably seen as helpful by some, reminds me that sometimes the price paid for "free" software is to endure rude, patronising interactions with some of those in the user or developer community. Tim Wilson originally wrote:>> Here's how I solved a problem for my stats class. I'm pretty sure I >> understand what's going on, but I wonder if there's a more direct way >> to solve it.Rolf Turner replied:>(a) You definitely don't have to --- and SHOULDN'T --- use ``trial >and error''.>(b) You should talk to the instructor of your stats class. That's >what he or she is paid for.>(c) You should also read your textbook.>(d) This is a very standard sort of problem. It is also very easy to >solve with pencil and paper (or at the very least a hand >calculator). You do ***not*** need to use binom.test() (in fact this >is counter productive) nor do you need to use prop.power.test() as >someone else suggested (although this will do it for you).>There is a formula for the required sample size which is surely given >in your textbook --- in ***any*** introductory stats textbook. The >formula is readily amenable to use with ``hand calculations''. Find >the formula and use it.>(e) You were given this exercise to get you to learn some of the >basic ideas about confidence intervals for proportions. Learn them. >Don't try to dodge the issue by pumping numbers through a >computerized ``black box''.Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Andrew Ward observes:> This reply, while probably seen as helpful by some, reminds me that > sometimes the price paid for "free" software is to endure rude,patronising> interactions with some of those in the user or developer community.[WNV] Now there's an insight! In fact I think that once you get used to the style you get to appreciate it. The commercial world substitutes politeness for candour. True candour can be disconcerting but it does get the message across much quicker. This rather reminds me of the story of the two sons in the gospel. One blandly assures his father that he will do the work and then goes away and forgets about it. The other grumbles, complains and winges like mad but in the end, does in fact do it. Happily my sons and daughters are more like the latter, bless 'em. Bill.> Tim Wilson originally wrote: > >> Here's how I solved a problem for my stats class. I'm pretty sure I > >> understand what's going on, but I wonder if there's a more direct way > >> to solve it. > > Rolf Turner replied: > >(a) You definitely don't have to --- and SHOULDN'T --- use ``trial > >and error''. > > >(b) You should talk to the instructor of your stats class. That's > >what he or she is paid for. > > >(c) You should also read your textbook. > > >(d) This is a very standard sort of problem. It is also very easy to > >solve with pencil and paper (or at the very least a hand > >calculator). You do ***not*** need to use binom.test() (in fact this > >is counter productive) nor do you need to use prop.power.test() as > >someone else suggested (although this will do it for you). > > >There is a formula for the required sample size which is surely given > >in your textbook --- in ***any*** introductory stats textbook. The > >formula is readily amenable to use with ``hand calculations''. Find > >the formula and use it. > > >(e) You were given this exercise to get you to learn some of the > >basic ideas about confidence intervals for proportions. Learn them. > >Don't try to dodge the issue by pumping numbers through a > >computerized ``black box''. > > Regards, > > Andrew C. Ward > CAPE Centre > Department of Chemical Engineering > The University of Queensland > Brisbane Qld 4072 Australia > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-> r-help mailing list -- Readhttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html> Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._