bivlocsc2stg             package:missreg             R Documentation

_B_i_v_a_r_i_a_t_e _b_i_n_a_r_y-_l_i_n_e_a_r _r_e_g_r_e_s_s_i_o_n _f_o_r _t_w_o-_p_h_a_s_e _s_a_m_p_l_e_d _d_a_t_a

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

     Fits bivariate binary-linear regression models to data with two
     associated response variables, binary Y1 and continuous Y2, and
     two-phase missingness structure.

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

     bivlocsc2stg(formula1, formula2, formula3, weights = NULL, 
                  xstrata = NULL, data, obstype.name = "obstype", 
                  fit = TRUE, xs.includes = FALSE, off.set = NULL, 
                  errdistrn = "normal", errmodpars = 6, start = NULL, 
                  Qstart = NULL, control = mlefn.control(...), 
                  control.inner = mlefn.control.inner(...), ...)

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

formula1: A symbolic description of the model to be fitted for Y1|Y2, 
          where Y1 is the binary response defining the case-control
          status of subjects and Y2 is a continuous response of
          interest observed at the second phase.

formula2: A symbolic description of the location model to be fitted for
          Y2.

formula3: A symbolic description of the log-scale model to be fitted
          for Y2.

 weights: An optional vector of weights to be used in the fitting
          process.  Should be 'NULL' or a numeric vector.

 xstrata: Specify names of the stratification variables to be used,
          e.g. '"vname"' or 'c("vname1","vnames2",...)'.  Strata are
          defined by cross-classification of all levels.

obstype.name: Name of the variable specifying labels for observations 
          by sampling and variable type: '"uncond"','"retro"','"y|x"',
          '"xonly"', or '"strata"'.

     fit: If 'FALSE', only stratum report will be generated without
          model fitting.

xs.includes: 'TRUE' if weights specified for observations labelled as 
          '"strata"' include those observed at the second phase (i.e.
          '"uncond"' or '"retro"' observations).

 off.set: Specify an 'a' 'priori' known component to be included in 
          the predictors. Should be 'NULL' or a numeric vector.

errdistrn: A specification for the erro distribution. Three choices are
          provided: standard logistic ('"logistic"'), standard normal
          ('"normal"') or student's-t distribution ('"t"'). The default
          is '"logistic"'.

errmodpars: Set parameter values for the error distribution. The
          default is 6 for student's-t distribution.

   start: Starting values for the regression parameters.

  Qstart: An optional starting matrix for Pr(Ystratum=i|Xstratum=j).

 control: Specify control parameters for the iterations in 'mlefn'
          call.  See 'mlefn' for details.

control.inner: Specify control parameters for inner iterations nested
          within 'mlefn' call. See 'mlefn' for details.

     ...: Further arguments passed to or from related functions.

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

     This function extends the application of 'SPML2' method when Y2,
     the second response of interest  associated with Y1, is a
     continuous variable and ideal to be analysed under the
     location-scale model. In particular, we use a logistic regression
     model for Y1|Y2 as in 'bivbin2stg' when the  'SPML2' method is
     applied, but a linear regression model for Y2 itself. Although the
     function  allows for different error distributions ('"logistic"',
     '"normal"', and '"t"' are  implemented so far), only the 'normal'
     is assumed in the strata function and should be used at this
     stage.

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

missReport: Matrix containing information on deleted records with
          missing observations.

StrReport: Cross tabulation of counts for different levels of 'obstype'
          and Y-values by X-strata.

xStrReport: Cross tabulation of counts for 'obstype' by X-strata when
          'obstype="xonly"'.

     key: Specify detailed classification for each of the X-strata.

    ykey: Vector containing the names of the Y-variables and the names
          of the  level of Ys the model is being constructed for. The
          sequence is as (name of Y1, name of the level at Y1=1, name
          of Y2).

     fit: 'TRUE' or 'FALSE' as its argument.

   error: The error messages returned by 'mlefn' call. Non-zero values
          indicate an unsuccessful fit.

coefficients: The coefficients matrix with estimates, standard errors,
          z-values and associated p-values.

   loglk: Log-likelihood returned from final 'mlefn' call.

   score: Score vector returned from final 'mlefn' call.

     inf: Observed information matrix returned from final 'mlefn' call.

  fitted: The fitted values of Y2 obtained from the model.

     cov: The asymptotic covariance matrix (inverse of the information
          matrix).

     cor: The asymptotic correlation matrix.

    Qmat: The estimated Pr(Ystratum)=i|Xstratum=j) from the last
          iteration.

_N_o_t_e:

     The function 'summary.bivlocsc2stg' gives a complete summary of
     the regression results  including the Wald tests and a regression
     panel. All related output functions ('print.bivlocsc2stg',
     'summary.bivlocsc2stg' and 'print.summary.bivlocsc2stg') don't
     have help files provided at the moment

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

     Chris Wild, Yannan Jiang

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

     Description of the 'missreg' Library, Wild and Jiang, 2007.

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

     'locsc2stg'; 'bivbin2stg'

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

     ## Data Generation ##
     N <- 5000
     x <- rnorm(N)
     eps <- rnorm(N) 

     theta2 <- c(0.5,1,0)
     y2 <- theta2[1]+theta2[2]*x+exp(theta2[3])*eps

     theta1 <- c(-3,-0.5,1,0.5)
     eta1 <- theta1[1]+theta1[2]*y2+theta1[3]*x+theta1[4]*y2*x
     p1 <- plogis(eta1)
     y1 <- 1*(runif(N)<p1)

     xcut <- c(-30,-1,0,1,30)
     xstrata <- as.numeric(cut(x,xcut))

     indca <- (1:N)[y1==1]
     indct <- sample((1:N)[y1==0],length(indca))
     ind <- sort(c(indca,indct))
     rest <- (1:N)[-ind]
     obstype <- rep("retro",N)
     obstype[rest] <- "strata"
     y2[rest] <- NA; x[rest] <- NA
     dat <- data.frame(y1,y2,x,xstrata,obstype)

     ## Proportion of cases in population (about 0.1) ##
     prca <- length(indca)/N
     prca

     ## Model fit ##
     z <- bivlocsc2stg(y1~y2*x,y2~x,~1,xstrata="xstrata",data=dat,xs.includes=FALSE)
     summary(z)

