Displaying 1 result from an estimated 1 matches for "current_smoker".
2010 May 22
0
multiple imputation based on a condition
...e a fictitional dataset is defined as...
set.seed(110)
n <- 500
test <- data.frame(smoke_status = rbinom(n, 2, 0.6), smoke_amount =
rbinom(n, 2, 0.5), rf1 = rnorm(n), rf2 = rnorm(n), outcome = rbinom(n,
1, 0.3))
# smoke_status (0, 1, 2) is c("non-smoker, "ex-smoker",
"current_smoker"), and
# smoke_amount (0, 1, 2) is c("light", "moderate", "heavy")
# rf1 and rf2 are two other risk factors (for illustration purposes -
real data set has more risk factors)
# artificially NA some of these values
test$smoke_status[sample(1:nrow(test), 60)] <-...