Description Usage Arguments Value Author(s) References Examples
Search Box-Cox transformation parameter.
1 | search_delta(s, y, type = "ML", dmin = -2, dmax = 2)
|
s |
Integer vector. Parsonnet Score values within a range of |
y |
Double. Binary ( |
type |
Character. If |
dmin |
Double. Minimum value for the grid search. |
dmax |
Double. Maximum value for the grid search. |
Returns a single value for the Box-Cox transformation parameter.
Philipp Wittenberg
Knoth S, Wittenberg P and Gan FF (2019). Risk-adjusted CUSUM charts under model error. Statistics in Medicine, 38(12), pp. 2206–2218..
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 | ## Not run:
## load data
data("cardiacsurgery", package = "spcadjust")
## preprocess data to 30 day mortality and subset data to
## phase I (In-control) and phase II (monitoring)
SALL <- cardiacsurgery %>% rename(s = Parsonnet) %>%
mutate(y = ifelse(status == 1 & time <= 30, 1, 0),
phase = factor(ifelse(date < 2*365, "I", "II")))
## subset phase I (In-control)
SI <- filter(SALL, phase == "I") %>% select(s, y)
## search delta
dML <- search_delta(SI$s, SI$y, type = "ML")
dQQ <- search_delta(SI$s, SI$y, type = "Pearson")
## show Log-likelihood (ell()) and Pearson measure (QQ()) for each delta
delta <- c(-2, -1, 0, dML, dQQ, 0.5, 1, 2)
r <- sapply(delta, function(i) rbind(i, ell(SI$s, SI$y, i), QQ(SI$s, SI$y, i)))
rownames(r) <- c("d", "l", "S")
t(r)
data.frame(t(r)) %>% filter(l == max(l) | S == min(S))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.