try ?power.prop.test> -----Messaggio originale----- > Da: Tim Wilson [mailto:wilson at visi.com] > Inviato: sabato 6 luglio 2002 6.05 > A: R-help > Oggetto: [R] one-sample binomial test > > > 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 | isd197.org | zope.com > W. St. Paul, MN | | slashdot.org > wilson at visi.com | <dtml-var pithy_quote> | linux.com > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. > -.-.-.-.-.-.-.-.- > r-help mailing list -- Read > 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 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Good Night R experts I make a Tcl/Tk script for generate a histogram from normal distribuition. ---------------------------- gnorm<-function(){ require(tcltk) || stop("tcltk support is absent") base <- tktoplevel() done <- tclVar(0) mu=tclVar(2) var=tclVar(2) tkwm.title(base,"Gr?fico da Normal") heading <- tklabel(base, text="Par?metros") l.mu <- tklabel(base, text="M?dia") l.var <- tklabel(base, text="Vari?ncia") mu.entry <- tkentry(base, textvariable=mu) var.entry <- tkentry(base, textvariable=var) tkgrid(heading, columnspan=2) tkgrid(l.mu, mu.entry) tkgrid(l.var, var.entry) mu<-tclvalue(mu.entry) but<-tkbutton(base, text="ok",command=function() { tclvalue(done)<-1 }) tkgrid(but) tkwait.variable(done) mu<- as.numeric(tclvalue(mu)) var<- as.numeric(tclvalue(var.entry)) x<-rnorm(100,mean=mu,sd=sqrt(var)) hist(x) } gnorm() ---------------------------- When I click button OK show this error mensage: Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") : [tcl] can't read "<environment>": no such variable. Where this my mistake? Which the correct code? Please Help Me! Thanks in advance Bernardo Rangel Tura, MD National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil P.S platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 5.1 year 2002 month 06 day 17 language R -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._