Código
R> Sigma <- matrix(0.3, 4, 4); diag(Sigma) <- 1
R> sim_grupo <- function(n, mu, g) {
+ MASS::mvrnorm(n, mu, Sigma) |>
+ as_tibble(.name_repair = ~ c("pib", "educ", "internet", "desigualdad")) |>
+ mutate(grupo_real = g)
+ }
R> set.seed(2026)
R> datos <- bind_rows(
+ sim_grupo(30, c( 2.5, 2.5, 2.5, -1.0), "alto"),
+ sim_grupo(30, c( 0.0, 0.0, 0.0, 2.5), "medio"),
+ sim_grupo(30, c(-2.5, -2.5, -2.5, -1.0), "bajo")
+ )