sim_dat | R Documentation |
Function for simulating data either with a single 'predictor' variable with a quadratic relationship with logit(p) or two predictors that interact (see references for examples).
sim_dat(N, a1, a2 = NULL, a3 = NULL)
N |
number of observations to simulate |
a1 |
value of the intercept term (in logits). This must be provided along with either |
a2 |
value of the quadratic coefficient. If specified the linear predictor is simulated as follows: |
a3 |
value of the interaction coefficient. If specified the linear predictor is simulated as follows: |
a simulated data set with N
rows. Can be split into 'development' and 'validation' sets.
Austin, P. C., & Steyerberg, E. W. (2019). The Integrated Calibration Index (ICI) and related metrics for quantifying the calibration of logistic regression models. Statistics in medicine, 38(21), 4051-4065.
Rhodes, S. (2022, November 4). Using restricted cubic splines to assess the calibration of clinical prediction models: Logit transform predicted probabilities first. https://doi.org/10.31219/osf.io/4n86q
library(pmcalibration)
# simulate some data with a binary outcome
n <- 500
dat <- sim_dat(N = n, a1 = .5, a3 = .2)
head(dat) # LP = linear predictor
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.