Learn R Programming

rpsychi (version 0.3)

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

Description

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

Usage

ind.prop(formula, data, sig.level=.05, digits=3, lev.prop=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.prop
a numeric contains the level to be counted (default 1)

Value

  • The returned object of ind.prop contains the following components:
  • samp.statreturns the proportions, sample sizes, and a effect size index (Cohen's $h$)
  • risk.differencereturns a risk difference, its' confidence interval, and standard error
  • risk.ratioreturns a risk ratio, its' confidence interval, and a standard error of a log-transformed risk ratio
  • odds.ratioreturns a odds ratio, its' confidence interval, and a standard error of a log-transformed odds ratio
  • powerreturns statistical power for detecting small ($h = 0.20$), medium ($h = 0.50$), and large ($h = 0.80$) population effect sizes

encoding

UTF-8

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

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

Run this code
##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)
)
ind.prop(y~x, data=dat) #count relapse
ind.prop(y~x, data=dat, lev.prop=2) #count not relapse

Run the code above in your browser using DataLab