Dear Shu Fai,
Thank you for your prompt response and insightful suggestions.
To provide more context, I've appended my code at the end of this message, and I've highlighted the specific part where the execution halts. The issue doesn't appear to be related to missing data or bootstrapping, as those aren't factors in my current project.
Interestingly, I don't receive any warnings or error messages in R Studio when the process "fails". Other programs don't freeze or slow down during this time, and sometimes, I'm still able to access other parts of R Studio just fine, while at other times, I have to interrupt R. I've noticed that the stop icon at the top right of the console is generally illuminated when this occurs.
I've also tried running my code through the standalone R GUI, as you suggested. However, the issue remains the same - the process stalls when I attempt to run the chunk to "#define the model". I've included one of my scripts below for reference, but I don't believe the issue is stemming from my code. I'm importing my data from an Excel file.
I've also attempted to resolve this by trying different versions (and updates) of my packages and R itself, but to no avail.
Your continued assistance would be greatly appreciated.
Best regards,
Maejda
library("lavaan")
library("tidyverse")
library("semhelpinghands")
library("dplyr")
# Importer le fichier Excel
data_Atti_t2 <- Questionnaire_full
# retrieve data file from excel
data_res_mod_Atti2<-select(data_Atti_t2,
APP1,
APP2,
APP3,
APP4,
APP5,
ANP1,
ANP2,
ANP3,
ANP4,
ANP5,
APS1,
APS2,
APS3,
APS4,
APS5,
ANS1,
ANS2,
ANS3,
ANS4,
ANS5,
So2_it1,
So2_it2,
So2_it3,
So2_it4,
An2_it1,
An2_it2,
An2_it3,
An2_it4,
Ag2_it1,
Ag2_it2,
Ag2_it3,
Ag2_it4,
Dis2_it1,
Dis2_it2,
Dis2_it3,
Dis2_it4,
)
fix(data_res_mod_Atti2)
#Définir le modèle
model_Atti_t2 <-'
# variables latentes
# Pour les attitudes
APP =~ APP5 + APP2 + APP3 + APP4 + APP1
ANP =~ ANP3 + ANP1+ ANP4 + ANP5 + ANP2
# Pour HRIES 2
Sociability_2=~ So2_it3 + So2_it1 + So2_it2 + So2_it4
Animacy_2 =~ An2_it1 + An2_it2 + An2_it3 + An2_it4
Agency_2=~ Ag2_it3 + Ag2_it1 + Ag2_it2 + Ag2_it4
Disturbance_2 =~ Dis2_it3 + Dis2_it1 + Dis2_it2 + Dis2_it4
#regs
Sociability_2~0*ANP
Sociability_2 ~APP
Animacy_2 ~0*ANP
Animacy_2 ~ APP
Agency_2 ~ ANP + APP
Disturbance_2 ~ ANP + APP
#cov
ANP ~~ APP
Sociability_2 ~~ Animacy_2
Sociability_2 ~~ Agency_2
Sociability_2 ~~ Disturbance_2
Animacy_2 ~~ Agency_2
Animacy_2 ~~0*Disturbance_2
Agency_2 ~~0*Disturbance_2
'
#resultats
#Pour forcer modèle
fit_model_Atti_t2 <- sem(model_Atti_t2,
data = data_res_mod_Atti2,
meanstructure=TRUE, optim.method = "BFGS")
# Obtenir les indices d'ajustement, y compris le RMSEA
summary(fit_model_Atti_t2, fit.measures=TRUE, standardized=TRUE, rsquare=F)
#bootstrap
fit_model_Atti_t2 <- sem(model_Atti_t2,
data = data_res_mod_Atti2,
se = "bootstrap",
bootstrap = 5000,
parallel ="snow", ncpus = 8)
#results bootstrap (percentile method)
ci_boot1 <- standardizedSolution_boot_ci(fit_model_Atti_t2)
ci_boot1
# Afficher un résumé des résultats du modèle
summary(fit_model_Atti_t2)
#Définir le modèle