effx                   package:Epi                   R Documentation

_F_u_n_c_t_i_o_n _t_o _c_a_l_c_u_l_a_t_e _e_f_f_e_c_t_s

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

     The function calculates the effects of an exposure on a response,
     possibly stratified by a stratifying variable, and/or controlled
     for one or more confounding variables.

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

     effx( response, type = "metric",
                      fup = NULL,     
                 exposure,     
                   strata = NULL,  
                  control = NULL,
                  weights = NULL,
                    alpha = 0.05,   
                     base = 1,             
                   digits = 3,     
                     data = NULL )    

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

response: The 'response' variable - must be numeric

    type: The type of response'type' - must be one of "metric",
          "binary", "failure", or "count"

     fup: The 'fup' variable contains the follow-up time for a failure
          response

exposure: The 'exposure' variable can be numeric or a factor

  strata: The 'strata' stratifying variable - must be a factor

 control: The 'control' variable(s) - these are passed as a list if
          there are more than one.

 weights: Frequency weights for binary response only

    base: Baseline for the effects of a categorical exposure, default 1

  digits: Number of significant digits for the effects, default 3

   alpha: 1 - confidence level

    data: 'data' refers to the data used to evaluate the function

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

     The function is a wrapper for glm. Effects are calculated as
     differences in means for a metric response, odds ratios for a
     binary response, and rate ratios for a failure or count response.  

     The k-1 effects for a categorical exposure with k levels are
     relative to a baseline which, by default, is the first level. The
     effect of a metric (quantitative) exposure is calculated per unit
     of exposure. 

     The exposure variable can be numeric or a factor, but if it is an
     ordered factor the order will be ignored.

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

  comp1 : Effects of exposure

  comp2 : Tests of significance

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

     Michael Hills

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

     www.mhills.pwp.blueyonder.co.uk

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

     library(Epi)
     data(births)
     births$hyp <- factor(births$hyp,labels=c("normal","hyper"))
     births$sex <- factor(births$sex,labels=c("M","F"))

     # bweight is the birth weight of the baby in gms, and is a metric
     # response (the default) 

     # effect of hypertension on birth weight
     effx(bweight,exposure=hyp,data=births) 
     # effect of hypertension on birth weight stratified by sex
     effx(bweight,exposure=hyp,strata=sex,data=births) 
     # effect of hypertension on birth weight controlled for sex
     effx(bweight,exposure=hyp,control=sex,data=births) 
     # effect of gestation time on birth weight
     effx(bweight,exposure=gestwks,data=births) 
     # effect of gestation time on birth weight stratified by sex
     effx(bweight,exposure=gestwks,strata=sex,data=births) 
     # effect of gestation time on birth weight controlled for sex
     effx(bweight,exposure=gestwks,control=sex,data=births) 

     # lowbw is a binary response coded 1 for low birth weight and 0 otherwise
     # effect of hypertension on low birth weight
     effx(lowbw,type="binary",exposure=hyp,data=births)
     # etc.

