createModelMatrix <- function(
covariates,
transformations
) {
res <- diag(sapply(transformations, mapply, covariates))
return(res)
}
createLinearPredictor <- function(
modelMatrix,
beta,
intercept
) {
beta <- matrix(
beta,
ncol = 1
)
linearPredictor <- modelMatrix %*% beta + intercept
return(linearPredictor)
}
logisticProbability <- function(
linearPredictor
) {
res <- 1 / (1 + exp(-linearPredictor))
return(round(100 * res, 1))
}
extractQuantiles <- function(
calibrationQuantiles,
outcome,
center
) {
calibrationQuantiles %>%
dplyr::filter(
!!outcome == outcome,
!!center == center
) %>%
dplyr::select(
quant20, quant40, quant60, quant80
) %>%
unlist()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.