diff --git a/R/rbin.R b/R/rbin.R index 166c093..eec8108 100644 --- a/R/rbin.R +++ b/R/rbin.R @@ -102,40 +102,28 @@ #' beta_coefficients <- 0.2 #' latent_correlation_matrix <- toeplitz(c(1, 0.9, 0.9, 0.9)) #' x <- rep(rnorm(sample_size), each = cluster_size) -#' simulated_binary_dataset <- rbin( -#' clsize = cluster_size, +#' simulated_binary_dataset <- rbin(clsize = cluster_size, #' intercepts = beta_intercepts, betas = beta_coefficients, -#' xformula = ~x, cor.matrix = latent_correlation_matrix, link = "probit" -#' ) +#' xformula = ~x, cor.matrix = latent_correlation_matrix, link = "probit") #' library(gee) -#' binary_gee_model <- gee(y ~ x, -#' family = binomial("probit"), id = id, -#' data = simulated_binary_dataset$simdata -#' ) +#' binary_gee_model <- gee(y ~ x, family = binomial("probit"), id = id, +#' data = simulated_binary_dataset$simdata) #' summary(binary_gee_model)$coefficients #' #' ## See Example 3.6 in the Vignette. #' set.seed(8) #' library(evd) -#' simulated_latent_variables1 <- rmvevd(sample_size, -#' dep = sqrt(1 - 0.9), -#' model = "log", d = cluster_size -#' ) -#' simulated_latent_variables2 <- rmvevd(sample_size, -#' dep = sqrt(1 - 0.9), -#' model = "log", d = cluster_size -#' ) +#' simulated_latent_variables1 <- rmvevd(sample_size, dep = sqrt(1 - 0.9), +#' model = "log", d = cluster_size) +#' simulated_latent_variables2 <- rmvevd(sample_size, dep = sqrt(1 - 0.9), +#' model = "log", d = cluster_size) #' simulated_latent_variables <- simulated_latent_variables1 - #' simulated_latent_variables2 -#' simulated_binary_dataset <- rbin( -#' clsize = cluster_size, +#' simulated_binary_dataset <- rbin(clsize = cluster_size, #' intercepts = beta_intercepts, betas = beta_coefficients, -#' xformula = ~x, rlatent = simulated_latent_variables -#' ) -#' binary_gee_model <- gee(y ~ x, -#' family = binomial("logit"), id = id, -#' data = simulated_binary_dataset$simdata -#' ) +#' xformula = ~x, rlatent = simulated_latent_variables) +#' binary_gee_model <- gee(y ~ x, family = binomial("logit"), id = id, +#' data = simulated_binary_dataset$simdata) #' summary(binary_gee_model)$coefficients #' @export rbin <- function(clsize = clsize, intercepts = intercepts, betas = betas, diff --git a/man/rbin.Rd b/man/rbin.Rd index fbdb20d..8fb2990 100644 --- a/man/rbin.Rd +++ b/man/rbin.Rd @@ -99,40 +99,28 @@ beta_intercepts <- 0 beta_coefficients <- 0.2 latent_correlation_matrix <- toeplitz(c(1, 0.9, 0.9, 0.9)) x <- rep(rnorm(sample_size), each = cluster_size) -simulated_binary_dataset <- rbin( - clsize = cluster_size, +simulated_binary_dataset <- rbin(clsize = cluster_size, intercepts = beta_intercepts, betas = beta_coefficients, - xformula = ~x, cor.matrix = latent_correlation_matrix, link = "probit" -) + xformula = ~x, cor.matrix = latent_correlation_matrix, link = "probit") library(gee) -binary_gee_model <- gee(y ~ x, - family = binomial("probit"), id = id, - data = simulated_binary_dataset$simdata -) +binary_gee_model <- gee(y ~ x, family = binomial("probit"), id = id, + data = simulated_binary_dataset$simdata) summary(binary_gee_model)$coefficients ## See Example 3.6 in the Vignette. set.seed(8) library(evd) -simulated_latent_variables1 <- rmvevd(sample_size, - dep = sqrt(1 - 0.9), - model = "log", d = cluster_size -) -simulated_latent_variables2 <- rmvevd(sample_size, - dep = sqrt(1 - 0.9), - model = "log", d = cluster_size -) +simulated_latent_variables1 <- rmvevd(sample_size, dep = sqrt(1 - 0.9), + model = "log", d = cluster_size) + simulated_latent_variables2 <- rmvevd(sample_size, dep = sqrt(1 - 0.9), + model = "log", d = cluster_size) simulated_latent_variables <- simulated_latent_variables1 - simulated_latent_variables2 -simulated_binary_dataset <- rbin( - clsize = cluster_size, +simulated_binary_dataset <- rbin(clsize = cluster_size, intercepts = beta_intercepts, betas = beta_coefficients, - xformula = ~x, rlatent = simulated_latent_variables -) -binary_gee_model <- gee(y ~ x, - family = binomial("logit"), id = id, - data = simulated_binary_dataset$simdata -) + xformula = ~x, rlatent = simulated_latent_variables) +binary_gee_model <- gee(y ~ x, family = binomial("logit"), id = id, + data = simulated_binary_dataset$simdata) summary(binary_gee_model)$coefficients } \references{