fcut                   package:Epi                   R Documentation

_C_u_t_s _f_o_l_l_o_w-_u_p _t_i_m_e _a_t _m_u_l_t_i_p_l_e _f_a_i_l_u_r_e _t_i_m_e_s.

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

     This function cuts the follow-up time at multiple failure times
     allowing a person to stay at risk between and after the laset
     failure. It is aimed at processing of recurrent events. Failure
     times outside the interval ('enter','exit') are ignored.

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

     fcut( enter, exit, dof, fail = 0,
           data = data.frame(enter, exit),
           Expand = 1:nrow( data ))

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

   enter: Date of entry into the study. Numerical vector.

    exit: Date of exit from the study. Numerical vector.

    fail: Failure indicator for the exit date.

     dof: Failure time(s). For multiple failures per individual, 'dof'
          must be a list.

    data: Dataframe of variables to be carried over to the output.

  Expand: Variable identifying original records.

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

     A dataframe with the same variables as in 'data' preceded by the
     variables: 

  Expand: Identification of the rows from the input dataframe.

   Enter: Entry date for the interval.

    Exit: Exit date for the interval.

    Fail: Failure indicator for end of the current interval.

  n.Fail: Number of failures prior to the start of the current
          interval. Counts all failures given in the list 'dof',
          including those prior to 'enter'.

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

     Bendix Carstensen, Steno Diabetes Center, bxc@steno.dk, <URL:
     www.biostat.ku.dk/~bxc>

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

     'Lexis', 'isec', 'icut', 'fcut1', 'ex1'

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

     one <- round( runif( 15, 0, 10 ), 1 )
     two <- round( runif( 15, 0, 10 ), 1 )
     doe <- pmin( one, two )
     dox <- pmax( one, two )
     # Goofy data rows to test possibly odd behaviour
     doe[1:3] <- dox[1:3] <- 8
     dox[2] <- 6
     dox[3] <- 7.5
     # Some failure indicators
     fail <- sample( 0:1, 15, replace=TRUE, prob=c(0.7,0.3) )
     # Failure times in a list
     dof <- sample( c(one,two), 15 )
     l.dof <- list( f1=sample( c(one,two), 15 ),
                    f2=sample( c(one,two), 15 ),
                    f3=sample( c(one,two),15 ) )
     # The same, but with events prior to entry removed
     lx.dof <- lapply( l.dof, FUN=function(x){ x[x<doe] <- NA ; x } )
     # So what have we got
     data.frame( doe, dox, fail, l.dof, lx.dof )
     # Cut follow-up at event times
     fcut( doe, dox, lx.dof, fail, data=data.frame( doe, dox, lx.dof ) )

