Tutorial:https://github.com/immerse-ucsb/lca_enum Package:https://cran.r-project.org/web/packages/MplusAutomation/index.html ————————————————————————

#DATA ##Load packages

##Variable LPA RESS = ress_rum, ress_eng, ress_reap, ress_sup, ress_rel, ress_dis average frequency of use of each strategy (average of 4 items per strategy)

##Prepare Data

# Load your dataset
getwd()
[1] "C:/Users/Lenovo/Documents/data"

#Descriptive Analysis

Descriptive Statistics for Continuous Variables
Variable N Mean SD Min Max Median
ress_rum 244 4.34 1.51 1 7.00 4.50
ress_eng 244 2.73 1.18 1 6.25 2.50
ress_reap 244 3.75 1.33 1 7.00 3.75
ress_sup 244 4.12 1.64 1 7.00 4.00
ress_rel 244 3.36 1.54 1 7.00 3.25
ress_dis 244 4.18 1.63 1 7.00 4.25
descriptives_table <- purrr::map_dfr(
  c("ress_rum", "ress_eng", "ress_reap", "ress_sup", "ress_rel", "ress_dis"),
  ~ df_ress %>%
    summarise(
      variable = .x,
      n    = sum(!is.na(.data[[.x]])),
      mean = mean(.data[[.x]], na.rm = TRUE),
      sd   = sd(.data[[.x]], na.rm = TRUE),
      min  = min(.data[[.x]], na.rm = TRUE),
      max  = max(.data[[.x]], na.rm = TRUE),
      med  = median(.data[[.x]], na.rm = TRUE)
    )
) %>%
  dplyr::mutate(
    dplyr::across(
      c(mean, sd, min, max, med),
      ~ round(.x, 2)
    )
  ) %>%
  gt::gt(rowname_col = "variable") %>%
  gt::tab_stubhead(label = md("*Variable*")) %>%
  gt::tab_header(
    md("Descriptive Statistics for Continuous Variables")
  ) %>%
  gt::cols_label(
    n    = md("*N*"),
    mean = md("*Mean*"),
    sd   = md("*SD*"),
    min  = md("*Min*"),
    max  = md("*Max*"),
    med  = md("*Median*")
  )

# Display table
descriptives_table


# Save table as image
gtsave(descriptives_table, here::here("figures", "descriptives_table.png"))

#NUMERATION

IMPORTANT: Before moving forward, make sure to open each output document to ensure models were estimated normally. Review: files> data>enum los output (.out) revisar que no salga error (warning esta bien), que el n muestral es correcto y que diga “THE MODEL ESTIMATION TERMINATED NORMALLY”

Model Fit Summary Table1
Classes Par LL BIC aBIC CAIC AWE BLRT VLMR BF cmPk
1-Class 12 −2,630.01 5,325.99 5,287.95 5,337.99 5,427.96 0.00 <.001
2-Class 19 −2,545.99 5,196.43 5,136.20 5,215.43 5,357.88 <.001 <.001 0.00 <.001
3-Class 26 −2,515.47 5,173.86 5,091.44 5,199.86 5,394.78 <.001 0.14 0.00 <.001
4-Class 33 −2,485.63 5,152.66 5,048.05 5,185.66 5,433.07 <.001 0.24 0.14 0.12
5-Class 40 −2,464.42 5,148.73 5,021.93 5,188.73 5,488.61 <.001 0.10 >100 0.88
6-Class 47 −2,451.95 5,162.26 5,013.28 5,209.26 5,561.63 0.02 0.65 0.00
1 Note. Par = Parameters; LL = model log likelihood; BIC = Bayesian information criterion; aBIC = sample size adjusted BIC; CAIC = consistent Akaike information criterion; AWE = approximate weight of evidence criterion; BLRT = bootstrapped likelihood ratio test p-value; VLMR = Vuong-Lo-Mendell-Rubin adjusted likelihood ratio test p-value; cmPk = approximate correct model probability.

##Information Criteria Plot

#LPA

p3 <- plot_lpa(output_ress$c3_ress.out)
p3
ggsave(filename = here::here("figures", "plot_3ps.png"),plot = p3, dpi = 300,
  height = 6, width = 9, units = "in")


p4 <- plot_lpa(output_ress$c4_ress.out)
p4

ggsave(filename = here::here("figures", "plot_4ps.png"),plot = p4, dpi = 300,
  height = 6, width = 9, units = "in")



p5 <- plot_lpa(output_ress$c5_ress.out)
p5
ggsave(filename = here::here("figures", "plot_5ps.png"),plot = p5, dpi = 300,
  height = 6, width = 9, units = "in")



p6 <- plot_lpa(output_ress$c6_ress.out)
p6
ggsave(filename = here::here("figures", "plot_6ps.png"),plot = p6, dpi = 300,
  height = 6, width = 9, units = "in")

LS0tDQp0aXRsZTogIkxQQSBDbGFzc2lmaWNhdGlvbi1NcGx1cyBBdG9tYXRpb24iDQpvdXRwdXQ6DQogIGh0bWxfbm90ZWJvb2s6IGRlZmF1bHQNCi0tLQ0KVHV0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