rateratio              package:epitools              R Documentation

_R_a_t_e _r_a_t_i_o _e_s_t_i_m_a_t_i_o_n _a_n_d _c_o_n_f_i_d_e_n_c_e _i_n_t_e_r_v_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates rate ratio by median-unbiased estimation (mid-p), and
     unconditional maximum likelihood estimation (Wald). Confidence
     intervals are calculated using exact methods (mid-p), and normal
     approximation (Wald).

_U_s_a_g_e:

     rateratio(x, y = NULL,
               method = c("midp", "wald"),
               conf.level = 0.95,
               rev = c("neither", "rows", "columns", "both"),
               verbose = FALSE)
     rateratio.midp(x, y = NULL,
                    conf.level = 0.95,
                    rev = c("neither", "rows", "columns", "both"),
                    verbose = FALSE)
     rateratio.wald(x, y = NULL,
                    conf.level = 0.95,
                    rev = c("neither", "rows", "columns", "both"),
                    verbose = FALSE)

_A_r_g_u_m_e_n_t_s:

       x: input data can be one of the following: r x 2 table where
          first column contains disease counts and second column
          contains person time at risk; a single numeric vector of
          counts followed by person time at risk; a single numeric
          vector of counts combined with 'y' which would be a numeric
          vector of corresponding person time at risk 

       y: numeric vector of person-time at risk; if provided, 'x' must
          be a numeric vector of disease counts   

  method: method for calculating rate ratio and confidence interval 

conf.level: confidence level (default is 0.95)

     rev: reverse order of "rows", "colums", "both", or "neither"
          (default) 

 verbose: set to TRUE to return more detailed results (default is
          FALSE) 

_D_e_t_a_i_l_s:

     Calculates rate ratio by median-unbiased estimation (mid-p), and
     unconditional maximum likelihood estimation (Wald). Confidence
     intervals are calculated using exact methods (mid-p), and normal
     approximation (Wald).

     This function expects the following table struture:


                         counts   person-time
         exposed=0 (ref)   n00        t01
         exposed=1         n10        t11    
         exposed=2         n20        t21
         exposed=3         n30        t31

     The reason for this is because each level of exposure is compared
     to the reference level.

     If the table you want to provide to this function is not in the
     preferred form, just use the 'rev' option to "reverse" the rows,
     columns, or both. If you are providing categorical variables
     (factors or character vectors), the first level of the "exposure"
     variable is treated as the reference. However, you can set the
     reference of a factor using the 'relevel' function.

     Likewise, each row of the rx2 table is compared to the exposure
     reference level and test of independence two-sided p values are
     calculated using mid-p exact method and normal approximation
     (Wald).

_V_a_l_u_e:

       x: table that was used in analysis (verbose = TRUE)

    data: same table as 'x' but with marginal totals

 measure: rate ratio and confidence interval

conf.level: confidence level used (verbose = TRUE)

 p.value: p value for test of independence

_N_o_t_e:

     Visit <URL: http://www.epitools.net> for the latest.

_A_u_t_h_o_r(_s):

     Rita Shiau (original author), rita.shiau@sfdph.org; Tomas Aragon,
     aragon@berkeley.edu, <URL: http://www.medepi.com>

_R_e_f_e_r_e_n_c_e_s:

     Kenneth J. Rothman and Sander Greenland (1998), Modern
     Epidemiology, Lippincott-Raven Publishers

     Kenneth J. Rothman (2002), Epidemiology: An Introduction, Oxford
     University Press

_S_e_e _A_l_s_o:

     'rate2by2.test', 'oddsratio', 'riskratio', 'epitab'

_E_x_a_m_p_l_e_s:

     ##Examples from Rothman 1998, p. 238
     bc <- c(Unexposed = 15, Exposed = 41)
     pyears <- c(Unexposed = 19017, Exposed = 28010)
     dd <- matrix(c(41,15,28010,19017),2,2)
     dimnames(dd) <- list(Exposure=c("Yes","No"), Outcome=c("BC","PYears"))
     ##midp
     rateratio(bc,pyears)
     rateratio(dd, rev = "r")
     rateratio(matrix(c(15, 41, 19017, 28010),2,2))
     rateratio(c(15, 41, 19017, 28010))

     ##midp
     rateratio.midp(bc,pyears)
     rateratio.midp(dd, rev = "r")
     rateratio.midp(matrix(c(15, 41, 19017, 28010),2,2))
     rateratio.midp(c(15, 41, 19017, 28010))

     ##wald
     rateratio.wald(bc,pyears)
     rateratio.wald(dd, rev = "r")
     rateratio.wald(matrix(c(15, 41, 19017, 28010),2,2))
     rateratio.wald(c(15, 41, 19017, 28010))

