twoby2                  package:Epi                  R Documentation

_A_n_a_l_y_s_i_s _o_f _a _t_w_o _b_y _t_w_o _t_a_b_l_e

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

     Computes the usual measures of association in a 2 by 2 table with
     confidence intervals. Also produces asymtotic and exact tests.
     Assumes that comparison of probability of the first column level
     between levels of the row variable is of interest. Output requires
     that the input matrix has meaningful row and column labels.

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

     twoby2(exposure, outcome,
            alpha = 0.05, print = TRUE, dec = 4,
            conf.level = 1-alpha, F.lim = 10000)

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

exposure: If a table the analysis is based on the first two rows and
          first two columns of this. If a variable, this variable is
          tabulated against

 outcome: as the second variable

   alpha: Significance level

   print: Should the results be printed?

     dec: Number of decimals in the printout.

conf.level: 1-'alpha'

   F.lim: If the table total exceeds 'F.lim', Fisher's exact test is
          not computed

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

     A list with elements: 

   table: The analysed 2 x 2 table augmented with probabilities and
          confidence intervals. The confidence intervals for the
          probabilities are computed using the normal approximation to
          the log-odds. Confidence intervals for the difference of
          proportions are computed using method 10 from Newcombe,
          Stat.Med. 1998, 17, pp.873 ff.

measures: A table of Odds-ratios and relative risk with confidence
          intervals.

 p.value: Exact p-value for the null hypothesis of OR=1

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

     Mark Myatt. Modified by Bendix Carstensen.

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

     Treat <- sample(c("A","B"), 50, rep=TRUE )
     Resp <- c("Yes","No")[1+rbinom(50,1,0.3+0.2*(Treat=="A"))]
     twoby2( Treat, Resp )                 
     twoby2( table( Treat, Resp )[,2:1] ) # Comparison the other way round

