ind.prop.second: A Z test for the equality of two proportions using published...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

ind.prop.second conducts a Z test for the equality of two proportions using published work.

Usage

1
ind.prop.second(x, n, sig.level = 0.05, digits = 3, ref.ind=1)

Arguments

x

a numeric vector (length(x) = 2) contains the counts of successes

n

a numeric vector (length(n) = 2) contains the sample sizes

sig.level

a numeric contains the significance level (default 0.05)

digits

the specified number of decimal places (default 3)

ref.ind

the reference for the independent variable (default 1)

Details

This function conducts a Z test for the equality of two proportions using published work. Statistical power is calculated using the following specifications:

(a) small (h = 0.20), medium (h = 0.50), and large (h = 0.80) population effect sizes, according to the interpretive guideline for effect sizes by Cohen (1992)

(b) sample size specified by n

(c) significance level specified by sig.level

Value

The returned object of ind.prop.second contains the following components:

samp.stat

returns the proportions, sample sizes, and a effect size index (Cohen's h)

risk.difference

returns a risk difference, its' confidence interval, and standard error

risk.ratio

returns a risk ratio, its' confidence interval, and a standard error of a log-transformed risk ratio

odds.ratio

returns a odds ratio, its' confidence interval, and a standard error of a log-transformed odds ratio

power

returns statistical power for detecting small (h = 0.20), medium (h = 0.50), and large (h = 0.80) population effect sizes

Author(s)

Yasuyuki Okumura
Department of Social Psychiatry,
National Institute of Mental Health,
National Center of Neurology and Psychiatry
yokumura@blue.zero.jp

References

Cohen J (1992) A power primer. Psychological Bulletin, 112, 155-159.

Kline RB (2004) Beyond significance testing: Reforming data analysis methods in behavioral research. Washington: American Psychological Association.

See Also

ind.prop, samplesize.h

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
##Kline (2004) Chapter 5
x1 <- c("relapsed", "not relapsed")
y1 <- c("control", "treatment")

dat <- data.frame(y =         
factor(c(rep(x1, c(60, 40)), rep(x1, c(40, 60))), levels=x1),
x = factor(rep(y1, each=100), levels=y1)
)
tab <- xtabs(~x+y, data=dat)
tab
ind.prop.second(x=tab[,1], n = rowSums(tab))             #Risk for relapse is lower in treatment than control condition.
ind.prop.second(x=tab[,1], n = rowSums(tab), ref.ind=2)  #Risk for relapse is higher in control than treatment condition.

rpsychi documentation built on May 1, 2019, 10:10 p.m.