# NOT RUN {
# Logistic Distribution: mean = 0, variance = 1
seed = 1234
# Find standardized cumulants
stcum <- calc_theory(Dist = "Logistic", params = c(0, 1))
# Simulate without the sixth cumulant correction
# (invalid power method pdf)
Logvar1 <- nonnormvar1(method = "Polynomial", means = 0, vars = 1,
skews = stcum[3], skurts = stcum[4],
fifths = stcum[5], sixths = stcum[6], seed = seed)
# Plot cdf with cumulative probability calculated up to delta = 5
plot_sim_cdf(sim_y = Logvar1$continuous_variable,
title = "Invalid Logistic Empirical CDF",
calc_cprob = TRUE, delta = 5)
# Simulate with the sixth cumulant correction
# (valid power method pdf)
Logvar2 <- nonnormvar1(method = "Polynomial", means = 0, vars = 1,
skews = stcum[3], skurts = stcum[4],
fifths = stcum[5], sixths = stcum[6],
Six = seq(1.5, 2, 0.05), seed = seed)
# Plot cdf with cumulative probability calculated up to delta = 5
plot_sim_cdf(sim_y = Logvar2$continuous_variable,
title = "Valid Logistic Empirical CDF",
calc_cprob = TRUE, delta = 5)
# Simulate one binary and one ordinal variable (4 categories) with
# correlation 0.3
Ordvars = rcorrvar(k_cat = 2, marginal = list(0.4, c(0.2, 0.5, 0.7)),
rho = matrix(c(1, 0.3, 0.3, 1), 2, 2), seed = seed)
# Plot cdf of 2nd variable
plot_sim_cdf(Ordvars$ordinal_variables[, 2])
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab