| bivlocsc2stg {missreg} | R Documentation |
Fits bivariate binary-linear regression models to data with two associated response variables, binary Y1 and continuous Y2, and two-phase missingness structure.
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(...), ...)
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. |
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.
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. |
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
Chris Wild, Yannan Jiang
Description of the missreg Library, Wild and Jiang, 2007.
## 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)