Learn R Programming

misty (version 0.6.7)

size.cor: Sample Size Determination for Testing Pearson's Correlation Coefficient

Description

This function performs sample size computation for testing Pearson's product-moment correlation coefficient based on precision requirements (i.e., type-I-risk, type-II-risk and an effect size).

Usage

size.cor(rho, delta, alternative = c("two.sided", "less", "greater"),
         alpha = 0.05, beta = 0.1, write = NULL, append = TRUE,
         check = TRUE, output = TRUE)

Value

Returns an object of class misty.object, which is a list with following entries:

call

function call

type

type of analysis

data

matrix or data frame specified in x

args

specification of function arguments

result

list with the result, i.e., optimal sample size

Arguments

rho

a number indicating the correlation coefficient under the null hypothesis, \(\rho\).0.

delta

a numeric value indicating the minimum difference to be detected, \(\delta\).

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

alpha

type-I-risk, \(\alpha\).

beta

type-II-risk, \(\beta\).

write

a character string naming a text file with file extension ".txt" (e.g., "Output.txt") for writing the output into a text file.

append

logical: if TRUE (default), output will be appended to an existing text file with extension .txt specified in write, if FALSE existing text file will be overwritten.

check

logical: if TRUE (default), argument specification is checked.

output

logical: if TRUE (default), output is shown.

Author

Takuya Yanagida takuya.yanagida@univie.ac.at,

References

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.

See Also

size.mean, size.prop

Examples

Run this code
#-------------------------------------------------------------------------------
# Example 1: Two-sided test
# H0: rho = 0.3, H1: rho != 0.3
# alpha = 0.05, beta = 0.2, delta = 0.2

size.cor(rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2)

#-------------------------------------------------------------------------------
# Example 2: One-sided test
# H0: rho <= 0.3, H1: rho > 0.3
# alpha = 0.05, beta = 0.2, delta = 0.2

size.cor(rho = 0.3, delta = 0.2, alternative = "greater", alpha = 0.05, beta = 0.2)

Run the code above in your browser using DataLab