ff_proptest: Compare two proportions

Description Usage Arguments Value Examples

Description

Returns a list containing the confusion table, the two proportions, and the difference in the proportions with a confidence interval

Usage

1
ff_proptest(var, byvar, data = dt, dp = 1)

Arguments

var

a binary variable

byvar

a stratifying binary variable

data

a data frame (or data.table)

dp

number of decimal places in formatted response

Value

a table and a series of strings formatted for a scientific paper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Create data.frame and summarise proportion of A's and B's
set.seed(1)
dd <- data.frame(
     X=sample(c(0,1), 100, replace=TRUE),
     strata=sample(c("A", "B"), 100, replace=TRUE))

with(dd, table(strata, X))
ff_proptest(X, strata, data=dd)
# $table

#      0  1
#   A 23 23
#   B 29 25

# $est1
# [1] "50.0%"

# $est2
# [1] "53.7%"

# $d
# [1] "3.7%"

# $ci
# [1] "17.9% to 25.4%"

datascibc/dsbc documentation built on May 14, 2019, 7:45 p.m.