Description Usage Arguments Details Value Examples
A method for ranking models based on an invariance score.
1 |
M |
A list of models. The models may be the result of a call to
|
method |
The method used for calculating invariance scores. At the
moment only two ranking methods have been implemented, namely the |
... |
additional arguments to be passed to the internal
|
The IMR
function takes a list of fitted models as input and computes
an invariance ranking. The invariance scoring method is specified via
method
. It is the users responsibility to input comparable models in
M
and choose a suiteble ranking scheem via method
; only
rudimentery sanity check of the inputted models in M
is conducted.
At the moment the IMR
function only takes hazard models as input, and
only two ranking methods have been implementd, namely the BS
and the
rss
methods:
The BS
method:
For each model a basis spline is fitted to the cumulative coefficients
and the integrated curvature is reported as a measure of invariance. Before
the spline is fitted the cumulative coefficients are normalized. A smaller
score is evidence of a more invariant model.
The rss
method:
For each model the corresponding invariant model is found and the residual
square error is found and reported as a measure of invariance. Before the
invariant model and residual square error is found the cumulative
coefficients are normalized. A smaller score is evidence of a more invariant
model.
IMR
returns an object of class
"IMR
"
with the following components:
ranking |
A data.frame summarizing the findings. For detailes on how to interpret this see the method specific details above. |
results |
A list with the detailed results of the analysis. |
method |
A list with the |
call |
The matched call. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Generate Data
n <- 1000
E <- sample(4L, n, replace = TRUE)
X <- data.frame(X1 = rnorm(n, 2 * E, 1),
X2 = rnorm(n, 2 * (E == 1) + 5 * (E == 4) , 1),
X3 = rbinom(n, 1, 0.7))
Y <- rexp(n, exp(4 - 0.6 * X$X1 + 0.4 * X$X2))
C <- rexp(n, exp(0.5))
time <- pmin(Y, C)
status <- time == Y
# Note that X1 and X2 are the true causal predictors
## Fit Models
m1 <- survival::coxph(survival::Surv(time, status) ~ X1, data = X)
m2 <- survival::coxph(survival::Surv(time, status) ~ X2, data = X)
m3 <- survival::coxph(survival::Surv(time, status) ~ X3, data = X)
m12 <- survival::coxph(survival::Surv(time, status) ~ X1 + X2, data = X)
m13 <- survival::coxph(survival::Surv(time, status) ~ X1 + X3, data = X)
# Ranking via Basis Splines
IMR(list(m1, m2, m3, m12, m13), method = "BS")
# Ranking via Residual Square Error
IMR(list(m1, m2, m3, m12, m13), method = "rss")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.