View source: R/testDensRatioGOF.R
testDensRatioGOF | R Documentation |
testDensRatioGoF
implements the complete-case goodness-of-fit test of Qin and Zhang (1997) for evaluating the validity of the specified mark density ratio model used for modeling a component of
the mark-specific hazard ratio model in Juraska and Gilbert (2013). Multivariate marks are accommodated. Subjects who experienced the event of interest but their mark is missing are discarded.
testDensRatioGOF(
eventInd,
mark,
tx,
DRcoef = NULL,
DRlambda = NULL,
iter = 1000
)
eventInd |
a numeric vector indicating the event of interest (1 if event, 0 if right-censored) |
mark |
either a numeric vector specifying a univariate continuous mark or a data frame specifying a multivariate continuous mark.
For subjects with a right-censored time-to-event, the value(s) in |
tx |
a numeric vector indicating the treatment group (1 if treatment, 0 if placebo) |
DRcoef |
a numeric vector of the coefficients |
DRlambda |
the Lagrange multiplier in the profile score functions for |
iter |
the number of bootstrap iterations (1000 by default) |
testDensRatioGoF
performs a goodness-of-fit test for the exponential form of the weight function, i.e., g(v, \phi) = \exp\{\phi^T (1, v)\}
. Other weight functions are not considered.
Returns a list containing the following components:
teststat
: the value of the Kolmogorov-Smirnov-type test statistic
pval
: the bootstrap p-value from the Kolmogorov-Smirnov-type test of validity of the mark density ratio model
DRcoef
: the input object if different from NULL
or a numeric vector of estimates of coefficients \phi
in the weight function g(v, \phi)
in the density ratio model
DRlambda
: the input object if different from NULL
or an estimate of the Lagrange multiplier in the profile score functions for \phi
Qin, J., & Zhang, B. (1997). A goodness-of-fit test for logistic regression models based on case-control data. Biometrika, 84(3), 609-618.
Juraska, M. and Gilbert, P. B. (2013), Mark-specific hazard ratio model with multivariate continuous marks: an application to vaccine efficacy. Biometrics 69(2):328-337.
Qin, J. (1998), Inferences for case-control and semiparametric two-sample density ratio models. Biometrika 85, 619-630.
n <- 500
tx <- rep(0:1, each=n/2)
tm <- c(rexp(n/2, 0.2), rexp(n/2, 0.2 * exp(-0.4)))
cens <- runif(n, 0, 15)
eventTime <- pmin(tm, cens, 3)
eventInd <- as.numeric(tm <= pmin(cens, 3))
mark1 <- ifelse(eventInd==1, c(rbeta(n/2, 2, 5), rbeta(n/2, 2, 2)), NA)
mark2 <- ifelse(eventInd==1, c(rbeta(n/2, 1, 3), rbeta(n/2, 5, 1)), NA)
# test goodness-of-fit for a univariate mark
testDensRatioGOF(eventInd, mark1, tx, iter=15)
# test goodness-of-fit for a bivariate mark
testDensRatioGOF(eventInd, data.frame(mark1, mark2), tx, iter=15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.