Learn R Programming

stats4teaching (version 0.1.0)

sample2indp.pow: Independent normal data

Description

Generates two normal independent samples with desired power and cohen's effect.

Usage

sample2indp.pow(n1, mean = 0, s1= 1, d.cohen, power,
   alternative = c("two.sided", "less", "greater"), delta = 1,
   conf.level = 0.95, dec = 2)

Value

A list containing the following components:

  • Data: a data frame containing the samples created.

  • Size: size of each sample.

  • T.test: a t-test of the samples.

Arguments

n1

first sample size.

mean

vector of sample means.

s1

standard deviation for first sample.

d.cohen

Cohen's effect.

power

power of the test.

alternative

a character string specifying the alternative hypothesis for T-Test. Must be one of ``two.sided`` (default), ``greater`` or ``less``. Can be specified just the initial letter.

delta

true value of the difference in means.

conf.level

confidence level of the interval.

dec

number of decimals for observations.

Details

Pooled standard deviation= sp = sqrt((n1 - 1) sigma1^2 +(n2 - 1) sigma2^2) / (n1 + n2 - 2)

d.cohen = |mean1 - mean2| / sqrt(sp)

Examples

Run this code
sample2indp.pow(n1 = 30, mean = c(2,3), s1= 0.5, d.cohen = 0.8, power = 0.85, delta = 1)
sample2indp.pow(n1 = 50, mean = c(15.5,16), s1=2 , d.cohen = 0.3, power = 0.33, delta = 0.5)

Run the code above in your browser using DataLab