RRor: RR estimate from logistic regression.

View source: R/RRor.r

RRorR Documentation

RR estimate from logistic regression.

Description

Model based interval estimate of the risk ratio or prevented fraction from a logistic regression model.

Usage

RRor(
  fit = NULL,
  beta.hat = NULL,
  var.beta.hat = NULL,
  degf = NULL,
  which = c(1, 2),
  pf = TRUE,
  norm = FALSE,
  alpha = 0.05,
  rnd = 3
)

Arguments

fit

A glm object.

beta.hat

Parameters estimates from a logistic regression with no intercept.

var.beta.hat

Variance-covariance matrix from a logistic regression with no intercept.

degf

Degrees of freedom.

which

Numeric vector indicating which parameters to compare, so that RR = compare[2] / compare[1]

pf

Estimate RR or its complement PF?

norm

Estimate confidence interval using quantiles of Guassian rather

than t distribution quantiles?

alpha

Complement of the confidence level.

rnd

Number of digits for rounding. Affects display only, not estimates.

Details

Estimates confidence intervals using the delta method on parameters from a generalized linear model with logit link.

RR = {{{\mu}}_{2}} / {{{\mu}}_{1}}, where {\mu}_{i} are the estimated probabilities from the model.

Value

A rror object with the following fields.

  • estimate: vector with point and interval estimate

  • estimator: either PF or RR

  • mu: matrix with rows giving probability estimates for each of the groups

  • rnd: how many digits to round the display

  • alpha: complement of confidence level

  • norm: logical indicating Gaussian or t-interval

  • degf: degrees of freedom

Note

Call to this function may be one of two formats: (1) specify fit or (2) beta.hat, var.beta.hat, degf

RRor(fit, degf = NULL, pf = TRUE, alpha = 0.05, which = c(1, 2), norm = TRUE, rnd = 3)

RRor(beta.hat, var.beta.hat, degf, pf = TRUE, alpha = 0.05, which = c(1, 2), norm = TRUE, rnd = 3)

Author(s)

PF-package

See Also

rror, phiWt, tauWt StatWI007 for more examples

Examples

bird.fit <- glm(cbind(y, n - y) ~ tx - 1, binomial, bird)
RRor(tauWt(bird.fit))

# 95% t intervals on 4 df
#
# PF
#     PF     LL     UL
#  0.500 -0.583  0.842
#
#       mu.hat    LL     UL
# txcon  0.733 0.943 0.3121
# txvac  0.367 0.752 0.0997

RRor(phiWt(bird.fit))
# 95% t intervals on 4 df
#
# PF
#     PF     LL     UL
#  0.500 -0.583  0.842
#
#       mu.hat    LL     UL
# txcon  0.733 0.943 0.3121
# txvac  0.367 0.752 0.0997



ABS-dev/PF documentation built on Sept. 19, 2024, 10:31 a.m.

Related to RRor in ABS-dev/PF...