RRmpWald | R Documentation |
Estimates confidence intervals for the risk ratio or prevented fraction from matched pairs.
RRmpWald(
formula = NULL,
data = NULL,
compare = c("vac", "con"),
affected = 1,
x,
alpha = 0.05,
pf = TRUE,
tdist = TRUE,
df = NULL,
rnd = 3
)
formula |
Formula of the form |
data |
|
compare |
Text vector stating the factor levels: |
affected |
Indicator for positive response |
x |
Alternative data input. Instead of formula and data frame, data may be input as frequency vector. See example for how to order this vector. |
alpha |
Complement of the confidence level |
pf |
Estimate RR or its complement PF? |
tdist |
Use t distribution? |
df |
Degrees of freedom. When NULL, the function will default to
|
rnd |
Number of digits for rounding. Affects display only, not estimates. |
Estimates confidence intervals for the risk ratio or prevented
fraction from matched pairs. The response is the tetranomial vector c(11, 12, 21, 22)
, where the first index is the row and the the second index is
the column when displayed as a 2x2 table. Wald type confidence intervals
are found by applying the delta method to the multinomial variance. This
method fails when there are no responders in one of the treatment groups.
Alternative forms of data entry are illustrated by the output, say
Y
, where c(Y$xtable) = Y$freqvec = Y$multvec$Freq
.
If RR = 0 (PF = 1), the function will return degenerate interval.
A rrmp
object with the following fields:
estimate |
vector of point and interval estimates - see details |
estimator |
either |
compare |
text vector, same as input |
alpha |
complement of confidence level |
rnd |
how many digits to round the display |
multvec |
data frame showing the multinomial representation of the data |
Experimental functions for estimating profile likelihood intervals are
in the CVBmisc package.
Call to this function may be one of two
formats: (1) specify data
and formula
or (2) as a vector
x
RRmpWald(formula, data, compare = c('vac', 'con'),
affected = 1, alpha = 0.05,
pf = TRUE, tdist = TRUE, df = NULL,
rnd = 3)
RRmpWald(x, compare = c('vac', 'con'), affected =
1, alpha = 0, 05,
pf = TRUE, tdist = TRUE, df = NULL, rnd = 3)
PF-package
RRmpWald(pos ~ tx + cluster(cage), New, compare = c('vac', 'con'))
# PF
# 95% interval estimates
#
# PF LL UL
# 0.550 0.183 0.752
require(magrittr)
thistable <- New |>
tidyr::spread(tx, pos) |>
dplyr::mutate(vac = factor(vac, levels = 1:0),
con = factor(con, levels = 1:0)) |>
with(table(vac, con))
thistable
# con
# vac 1 0
# 1 7 2
# 0 13 4
as.vector(thistable)
# [1] 7 13 2 4
RRmpWald(x = as.vector(thistable))
# PF
# 95% interval estimates
#
# PF LL UL
# 0.550 0.183 0.752
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.