library(minvariance)
library(tidyverse)
#> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
#> ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
#> ✓ tibble  3.1.0     ✓ dplyr   1.0.5
#> ✓ tidyr   1.1.3     ✓ stringr 1.4.0
#> ✓ readr   1.4.0     ✓ forcats 0.5.1
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag()    masks stats::lag()
library(lavaan)
#> This is lavaan 0.6-8
#> lavaan is FREE software! Please report any bugs.
library(semPlot)

Load data


filepath <- "https://osf.io/ajgx5/download"
df <- load(file = url(filepath))

Select data

# Only take 20 to start

phq_items_wide_20pct <- phq_items_wide %>% 
  as_tibble() %>% 
  dplyr::sample_frac(.1)
# minvariance_test <- minvariance(data = phq_items_wide_20pct,  
#                                 var_list = list(t1 = c(paste0("i", 1:9, "_1")),
#                                                 t2 = c(paste0("i", 1:9, "_2")),
#                                                 t3 = c(paste0("i", 1:9, "_3")),
#                                                 t4 = c(paste0("i", 1:9, "_4")),
#                                                 t5 = c(paste0("i", 1:9, "_5")),
#                                                 t6 = c(paste0("i", 1:9, "_6")),
#                                                 t7 = c(paste0("i", 1:9, "_7")),
#                                                 t8 = c(paste0("i", 1:9, "_8")),
#                                                 t9 = c(paste0("i", 1:9, "_9")),
#                                                 t10 = c(paste0("i", 1:9, "_10"))),
#                                 return = "lavaan_syntax")