Skip to contents

Function to calculate risk difference by unconditional maximum likelihood estimation (Wald) for any given treatment pairs.

Usage

riskdiff_wald(x, conf.level = 0.95)

Arguments

x

input data input data can be one of the following: r x 2 table, vector of numbers from a contigency table (will be transformed into r x 2 table in row-wise order), or single factor or character vector that will be combined with y into a table.

conf.level

confidence level (default is 0.95)

Value

a list containg a data,measure,p.value,correction

Examples

riskdiff_wald(
  x = matrix(c(178, 79, 1411, 1486), 2, 2),
  conf.level = 0.95
)
#> $data
#>           Outcome
#> Predictor  Disease1 Disease2 Total
#>   Exposed1      178     1411  1589
#>   Exposed2       79     1486  1565
#>   Total         257     2897  3154
#> 
#> $measure
#>           risk difference with 95% C.I.
#> Predictor     estimate       lower       upper
#>   Exposed1  1.00000000          NA          NA
#>   Exposed2 -0.06154091 -0.08046517 -0.04261664
#> 
#> $p.value
#>           two-sided
#> Predictor    midp.exact fisher.exact   chi.square
#>   Exposed1           NA           NA           NA
#>   Exposed2 1.780016e-10 1.845304e-10 2.676407e-10
#> 
#> $correction
#> [1] FALSE
#> 
#> attr(,"method")
#> [1] "Unconditional MLE & normal approximation (Wald) CI"