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

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

Description

ind.prop conducts a Z test for the equality of two proportions using individual data.

Usage

1
 ind.prop(formula, data, sig.level=.05, digits=3, lev.count=2, ref.ind=1) 

Arguments

formula

two-sided formula; the left-hand-side of which gives one dependent variable containing a factor with two levels, and the right-hand-side of one independent variable containing a factor with two levels

data

a data frame contains the variables in the fomrmula

sig.level

a numeric contains the significance level (default 0.05)

digits

the specified number of decimal places (default 3)

lev.count

a numeric contains the level to be counted (default 2)

ref.ind

the reference for the independent variable (default 1)

Details

This function conducts a Z test for the equality of two proportions using individual data. 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 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.second, samplesize.h

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
##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(y~x, data=dat, lev.count=2, ref.ind=1)    #Odds for not relapse is higher in treatment than control condition.
ind.prop(y~x, data=dat, lev.count=1, ref.ind=1)    #Odds for relapse is lower in treatment than control condition.
ind.prop(y~x, data=dat, lev.count=2, ref.ind=2)    #Odds for not relapse is lower in control than treatment condition.
ind.prop(y~x, data=dat, lev.count=1, ref.ind=2)    #Odds for relapse is higher in control than treatment condition.

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