# [R] stats::power.t.test error

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Fri Oct 4 14:52:44 CEST 2019

```Think about this. What is the null hypothesis? What is the alternative?
What are their distributions? What is the probability that you get a value
from the alternative when the null hypothesis holds and vice versa? Then
a better understanding of power calculation by doing such exercise.

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>

Op vr 4 okt. 2019 om 14:30 schreef Witold E Wolski <wewolski using gmail.com>:

> Hi,
>
> power.t.test works for some range of input parameters but fails otherwise.
>
> > power.t.test(delta = 0.5849625, sd=0.1, power=0.8, sig.level=0.05)\$n
> [1] 1.971668
> > power.t.test(delta = 0.5849625, sd=0.05, power=0.8, sig.level=0.05)\$n
> [1] 1.620328
> > power.t.test(delta = 0.5849625, sd=0.01, power=0.8, sig.level=0.05)\$n
> Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07), tol =
> tol,  :
>   did not succeed extending the interval endpoints for f(lower) * f(upper)
> <= 0
> In qt(sig.level/tside, nu, lower.tail = FALSE) : NaNs produced
>
> I guessing that sd is very small compared with delta, hence the
> problem. But what are allowed values (ratios) of delta and sd?
>
> Best
> Witek
>
>
>
>
>
>
> --
> Witold Eryk Wolski
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help