Full_Name: Mai Zhou Version: 1.9.1 OS: Win XP Professional Submission from: (NULL) (12.222.227.93)> power.t.test(n=25, delta=0.1, sig.level=1.1, strict=TRUE, type="one.sample")One-sample t test power calculation n = 25 delta = 0.1 sd = 1 sig.level = 1.1 power = 1.088311 alternative = two.sided ### power can never be over one! Of course, sig.level should not take value > 1 ### either. ### Possible solution: A check in the input to truncate sig.level into [0, 1]??
ligges@statistik.uni-dortmund.de
2004-Sep-24 08:44 UTC
[Rd] bug in power.t.test( ) (PR#7245)
mai@ms.uky.edu wrote:> Full_Name: Mai Zhou > Version: 1.9.1 > OS: Win XP Professional > Submission from: (NULL) (12.222.227.93) > > > >>power.t.test(n=25, delta=0.1, sig.level=1.1, strict=TRUE, type="one.sample") > > > One-sample t test power calculation > > n = 25 > delta = 0.1 > sd = 1 > sig.level = 1.1 > power = 1.088311 > alternative = two.sided > > ### power can never be over one! Of course, sig.level should not take value > 1 > ### either. > ### Possible solution: A check in the input to truncate sig.level into [0, 1]??Well, an error (or at least warning) message seems to be more appropriate rather than silently changing some values, e.g. somehwere at the top of the functions body: if(any(sig.level < 0 | sig.level > 1)) stop("sig.level must be in [0,1]") Uwe Ligges> ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>> "UweL" == Uwe Ligges <ligges@statistik.uni-dortmund.de> >>>>> on Fri, 24 Sep 2004 08:43:56 +0200 (CEST) writes:UweL> mai@ms.uky.edu wrote: >> Full_Name: Mai Zhou Version: 1.9.1 OS: Win XP >> Professional Submission from: (NULL) (12.222.227.93) >> >> >> >>> power.t.test(n=25, delta=0.1, sig.level=1.1, >>> strict=TRUE, type="one.sample") >> >> >> One-sample t test power calculation >> >> n = 25 delta = 0.1 sd = 1 sig.level = 1.1 power >> 1.088311 alternative = two.sided >> >> ### power can never be over one! Of course, sig.level >> should not take value > 1 ### either. ### Possible >> solution: A check in the input to truncate sig.level into >> [0, 1]?? UweL> Well, an error (or at least warning) message seems to UweL> be more appropriate rather than silently changing some UweL> values, e.g. somehwere at the top of the functions UweL> body: UweL> if(any(sig.level < 0 | sig.level > 1)) UweL> stop("sig.level must be in [0,1]") yes, in principle; thank you, Uwe! Since sig.level can also be NULL (which works with the way you constructed the test - on purpose?), I'd use the test a bit differently. BTW, did you know that e.g., sig.level or delta can be *vectors* giving vectorized results - at least in some cases... That will hopefully leed to more documentation / code updates, but not for 2.0.0 I presume. Martin Maechler
ligges@statistik.uni-dortmund.de
2004-Sep-24 17:12 UTC
[Rd] bug in power.t.test( ) (PR#7245)
Martin Maechler wrote:>>>>>>"UweL" == Uwe Ligges <ligges@statistik.uni-dortmund.de> >>>>>> on Fri, 24 Sep 2004 08:43:56 +0200 (CEST) writes: > > > UweL> mai@ms.uky.edu wrote: > >> Full_Name: Mai Zhou Version: 1.9.1 OS: Win XP > >> Professional Submission from: (NULL) (12.222.227.93) > >> > >> > >> > >>> power.t.test(n=25, delta=0.1, sig.level=1.1, > >>> strict=TRUE, type="one.sample") > >> > >> > >> One-sample t test power calculation > >> > >> n = 25 delta = 0.1 sd = 1 sig.level = 1.1 power > >> 1.088311 alternative = two.sided > >> > >> ### power can never be over one! Of course, sig.level > >> should not take value > 1 ### either. ### Possible > >> solution: A check in the input to truncate sig.level into > >> [0, 1]?? > > UweL> Well, an error (or at least warning) message seems to > UweL> be more appropriate rather than silently changing some > UweL> values, e.g. somehwere at the top of the functions > UweL> body: > > UweL> if(any(sig.level < 0 | sig.level > 1)) > UweL> stop("sig.level must be in [0,1]") > > yes, in principle; > thank you, Uwe! > > Since sig.level can also be NULLYes.> (which works with the way you > constructed the test - on purpose?), I'd use the test a bit > differently. > > BTW, did you know that e.g., sig.level or delta can be *vectors*Yes, hence the "|" rather than "||". Uwe> giving vectorized results - at least in some cases... > That will hopefully leed to more documentation / code updates, > but not for 2.0.0 I presume. > > Martin Maechler