4
$\begingroup$

I have two questions regarding the R script.

If I want to know the size of the sampling when I do a t-test with R, I can use this R script :

power.t.test(delta=1,sd=1.5,sig.level=0.05,power=0.8)

If I want to know the size of the sampling when I do the test of Pearson correlation coefficient, what is the R script?

And for a chi-square test what is the R script?

$\endgroup$

closed as off-topic by Peter Flom, COOLSerdash, gung, Scortchi, Nick Cox Jul 5 '13 at 0:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about programming are off-topic here unless they involve statistical analysis in some fashion, but they can be asked on Stack Overflow." – Peter Flom, COOLSerdash, gung, Scortchi, Nick Cox
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ You can look at the pwr package for one approach to these problems. $\endgroup$ – Gala Jul 4 '13 at 19:03
  • $\begingroup$ The question could be migrated to SO, it has already received a full answer anyway. $\endgroup$ – Gala Jul 5 '13 at 7:10
7
$\begingroup$

For correlation:

pwr.r.test(n = , r = , sig.level = , power = )

and for chi-square

pwr.chisq.test(w =, N = , df = , sig.level =, power = )

For others, see here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.