ratetable              package:epitools              R Documentation

_C_r_e_a_t_e _r _x _2 _c_o_u_n_t _a_n_d _p_e_r_s_o_n-_t_i_m_e _t_a_b_l_e _f_o_r _c_a_l_c_u_l_a_t_i_n_g _r_a_t_e_s

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

     Create r x 2 count and person-time table for calculating rates

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

     ratetable(..., byrow = FALSE,
               rev = c("neither", "rows", "columns", "both"))

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

     ...: see details

   byrow: Default is TRUE and single vector or collection of numbers is
          read in row-wise. Set to FALSE to read in column-wise.

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

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

     Creates r x 2 table with r exposure levels and 2 columns (counts
     and person-time exposed). Arguments can be one of the following:

     (1) r x 2 table of the following form:


                              Outcome
                  Exposure    cases pyears
                  E = 0 (ref)   a     PT0
                  E = 1         b     PT1

     (2) Two numeric vectors: 1st should be vector of counts, and the
     2nd vector should be vector of person-times at risk. For example,


         cases  <- c(a, b)
         pyears <- c(PT0, PT1)

     (3) >= 4 numbers in the following order: a, PT0, b, PT1

     (4) One numeric vector of the following form: c(a, PT0, b, PT1)

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

     Returns r x 2 rate table, usually for additional analyses.

_N_o_t_e:

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

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

     Tomas Aragon, aragon@berkeley.edu, <URL: http://www.medepi.com>

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

     none

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

     'epitable'

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

     ##Breast cancer cases from radiation treatment for tuberculosis
     ##Rothman 1998, p. 238
     bc0 <- 15
     bc1 <- 41
     py0 <- 19017
     py1 <- 28010

     ##4 numbers
     ratetable(bc0, py0, bc1, py1)

     ##1 vector
     dat <- c(bc0, py0, bc1, py1)
     ratetable(dat)

     ##2 vectors
     cases <- c(bc0, bc1)
     pyears <- c(py0, py1)
     ratetable(bc.cases = cases, person.years = pyears)

     ##1 matrix
     r238 <- matrix(c(41, 28010, 15, 19017), 2, 2)
     dimnames(r238) <- list(c("BC cases", "Person-years"),
                            "Radiation" = c("Yes", "No"))
     r238
     r238b <- t(r238)
     r238b
     ratetable(r238b, rev = "r")

