## Not run:
# # example
# n <- 1000
# set.seed(17)
# age <- rnorm(n, 50, 10)
# blood.pressure <- rnorm(n, 120, 15)
# cholesterol <- rnorm(n, 200, 25)
# sex <- factor(sample(c('female', 'male'), n, TRUE))
# label(age) <- 'Age' # label is in Hmisc
# label(cholesterol) <- 'Total Cholesterol'
# label(blood.pressure) <- 'Systolic Blood Pressure'
# label(sex) <- 'Sex'
# units(cholesterol) <- 'mg/dl'
# units(blood.pressure) <- 'mmHg'
#
# ch <- cut2(cholesterol, g = 40, levels.mean = TRUE)
#
# d <- data.frame(age = seq(0, 90, by = 10))
#
# L <- .4 * (sex == 'male') + .045 * (age - 50) +
# (log(cholesterol - 10) - 5.2) * ( -2 * (sex == 'female') + 2 * (sex == 'male'))
# y <- ifelse(runif(n) < plogis(L), 1, 0)
# cholesterol[1:3] <- NA
#
# ddist <- datadist(age, blood.pressure, cholesterol, sex)
# options(datadist = 'ddist')
#
# data = data.frame(y = y, blood.pressure = blood.pressure, sex = sex, age = age,
# cholesterol = cholesterol)
# model <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol, 4)),
# x = TRUE, y = TRUE)
#
# DynNom.lrm(model, data)
# ## End(Not run)
if (interactive()) {
fit <- lrm(formula = vs ~ wt + disp, data = mtcars)
DynNom.lrm(fit, mtcars, clevel = 0.9)
}
Run the code above in your browser using DataLab