home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / survival4 / untangle.specials < prev   
Encoding:
Text File  |  1997-09-13  |  1.8 KB  |  51 lines

  1.     
  2.     _H_e_l_p _p_r_o_c_e_s_s _t_h_e '_s_p_e_c_i_a_l_s' _a_r_g_u_m_e_n_t _o_f _t_h_e _t_e_r_m_s _f_u_n_c_t_i_o_n.
  3.     _G_i_v_e_n _a _t_e_r_m_s _s_t_r_u_c_t_u_r_e _a_n_d _a _d_e_s_i_r_e_d _s_p_e_c_i_a_l _n_a_m_e, _t_h_i_s
  4.     _r_e_t_u_r_n _a_n _i_n_d_e_x _a_p_p_r_o_p_r_i_a_t_e _f_o_r _s_u_b_s_c_r_i_p_t_i_n_g _t_h_e _t_e_r_m_s
  5.     _s_t_r_u_c_t_u_r_e _a_n_d _a_n_o_t_h_e_r _a_p_p_r_o_p_r_i_a_t_e _f_o_r _t_h_e _d_a_t_a _f_r_a_m_e.
  6.     
  7.          untangle.specials(tt, special, order=1)
  8.     
  9.     _A_r_g_u_m_e_n_t_s:
  10.     
  11.                tt:
  12.          a terms object.
  13.     
  14.           special:
  15.          the name of a special function, presumably used in the
  16.          terms object.
  17.     
  18.             order:
  19.          the order of the desired terms.  If set to 2, interac-
  20.          tions with the special function will be included.
  21.     
  22.          Value:
  23.     
  24.          a list with two components:
  25.     
  26.     _A_r_g_u_m_e_n_t_s:
  27.     
  28.              vars:
  29.          a vector of variable names, as would be found in the
  30.          data frame, of the specials.
  31.     
  32.             terms:
  33.          a numeric vector, suitable for subscripting the terms
  34.          structure, that indexes the terms in the expanded model
  35.          formula which involve the special.
  36.     
  37.     _E_x_a_m_p_l_e_s:
  38.     
  39.          # This is code from within the coxph program, m is the data frame and TT
  40.          #  the terms structure for the formula.  We wish to exclude first order
  41.          #  strata() terms from the final X matrix, and also to extract these terms
  42.          #  to a second data frame
  43.          TT <- terms(formula, specials='strata')
  44.          temp <- untangle.specials(TT, 'strata')
  45.          if (length(tempars))
  46.              X <- model.matrix( TT[-temperms], m)
  47.              m.strat <- m[tempars]
  48.     
  49.          else X <- model.matrix(TT, m)
  50.     
  51.