# [R] simple Q: required sample size & usage of power.t.test()

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Apr 15 23:50:44 CEST 2002

```osiander at 24on.cc writes:

> Hi community,
>
> Seems I am too stupid:
>
> I try to calculate with power.t.test() an example from the statistics textbook [Jerrold H. Zar, Biostatistical Analysis, 2nd edition, Prentice Hall, 1984, Chapter 8, Exercise 8.4, (page 120)]:

Ah, this is not a standard sample size calculation, but a pedagogical
exercise. t tests and power.t.test are irrelevant for this.

> -------
> A sample of size 18 has a mean of 13.55cm and a variance of 6.4512cm^2.
> (a) Calculate the 95% confidence interval for the population mean.
> (b) How large a sample would have to be taken from this population to estimate µ to within 1.00cm,
>  with 95% confidence?
> (c) 2.00cm with 95% confidence?
> (d) 2.00cm with 99% confidence?
>
> Result should be - according to the answers appendix - (a) 13.55 +- 1.26cm (b) n=29, (c) n=10, (d) n=11
> -------
>
> Here my questions:
>
> (1) which functions in R can be used to solve (a)
> (2) what has to be the syntax to answer (b), (c) and (d) ?

Hmmm, now are you trying to learn R for yourself by trying it on some
textbook examples, or are you trying to get us to help with your
homework?

Either way: You'll need the formula for the confidence interval
(presumably a couple of pages earlier in the book). The qnorm()
function gives you quantiles of the Normal distibution, the rest
should be basic algebra.

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```