# \donttest{
## Independent predictors
# Univariate continuous outcome
set.seed(1)
simul <- SimulateRegression(pk = 15)
summary(simul)
# Univariate binary outcome
set.seed(1)
simul <- SimulateRegression(pk = 15, family = "binomial")
table(simul$ydata)
# Multiple continuous outcomes
set.seed(1)
simul <- SimulateRegression(pk = 15, q = 3)
summary(simul)
## Blocks of correlated predictors
# Simulation of predictor data
set.seed(1)
xsimul <- SimulateGraphical(pk = rep(5, 3), nu_within = 0.8, nu_between = 0, v_sign = -1)
Heatmap(cor(xsimul$data),
legend_range = c(-1, 1),
col = c("navy", "white", "darkred")
)
# Simulation of outcome data
simul <- SimulateRegression(xdata = xsimul$data)
print(simul)
summary(simul)
## Choosing expected proportion of explained variance
# Data simulation
set.seed(1)
simul <- SimulateRegression(n = 1000, pk = 15, q = 3, ev_xy = c(0.9, 0.5, 0.2))
summary(simul)
# Comparing with estimated proportion of explained variance
summary(lm(simul$ydata[, 1] ~ simul$xdata))
summary(lm(simul$ydata[, 2] ~ simul$xdata))
summary(lm(simul$ydata[, 3] ~ simul$xdata))
## Choosing expected concordance (AUC)
# Data simulation
set.seed(1)
simul <- SimulateRegression(
n = 500, pk = 10,
family = "binomial", ev_xy = 0.9
)
# Comparing with estimated concordance
fitted <- glm(simul$ydata ~ simul$xdata,
family = "binomial"
)$fitted.values
Concordance(observed = simul$ydata, predicted = fitted)
# }
Run the code above in your browser using DataLab