You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope you are all well. I am new to using "seminr" and I liked the ease with which the models are specified. However, I find myself performing the estimation of a PSychological model that combines categorical and count variables. I have rescaled the variables to make the estimates, however, I get this error:
Generating the seminr model
Error in data[, all_loc_non_int_items(measurement_model)] :
subscript out of bounds
The code I am using to make the estimation is the following:
Hi @rodolfocasadiego I'm afraid the model is a bit too big for me to quite wrap my head around, and I cannot know what column names are really in your dataset. My suggestion is to start small -- just a model with two constructs, and keep estimating and adding constructs until you find the construct that is causing problems. Then, closely examine if the items are accurately named. If you have an error right at the start with the two-contruct model, we can more easily diagnose what the issue might be.
Hello everyone,
I hope you are all well. I am new to using "seminr" and I liked the ease with which the models are specified. However, I find myself performing the estimation of a PSychological model that combines categorical and count variables. I have rescaled the variables to make the estimates, however, I get this error:
Generating the seminr model
Error in data[, all_loc_non_int_items(measurement_model)] :
subscript out of bounds
The code I am using to make the estimation is the following:
**#==========================================================================
Data
#==========================================================================**
datos <- Base_de_datos_final
dim(datos)
#================================================
#Creation of new database to normalize
#================================================
base.nor <- data.frame(Imperf_Verg,
Estan_inflexi,
Subyuga,
Autoc_insuf,
Estilo_punitivo,
Estilo_perfeccion,
Estilo_imperfecc,
Estilo_sobrep,
Intern_musc,
Intern_Delg,
Pres_pares,
Pres_Medios,
Pens_desid,
Esc,
TotalBDI,
TotalZung,
Antecedentedepresion,
Antecedenteansiedad,
Antefliardepresion,
Antefliaransiedad,
Anorexia,
Bulimia,
YFAS_total,
Abstinencia,
Continuacion,
Crossfit)
#==========================================================================
#Scaling
#==========================================================================
base.nor2 <- apply(X = base.nor, MARGIN = 2, FUN = scale)
attach(base.nor2)
**#==========================================================================
SEM
#==========================================================================**
# Create measurement model
simple_mm <- constructs(
composite("EMTS", multi_items("emts_", 1:4)),
composite("Estilosparentales", multi_items("EP_", 5:8)),
composite("Presiondelgadez", multi_items("PD_", 9:12)),
composite("Afrontamiento", multi_items("AF_", 13:14)),
composite("Psicopatologia", multi_items("SP_", 15:16)),
composite("Antecedentes", multi_items("A_", 17:18)),
composite("Antecedentesfamilia", multi_items("AF_", 19:20)),
composite("RiesgoTCA", multi_items("RTCA_", 21:23)),
composite("Dep_fis", multi_items("DF_", 24:25)),
composite("Habitos", single_item("Crossfit")))
# Create structural model
simple_sm <- relationships(
paths(from = c("EMTS"), to = c("Estilosparentales","Presiondelgadez","Afrontamiento",
"Psicopatologia","Antecedentes","Antecedentesfamilia",
"Habitos")),
paths(from = c("Estilosparentales","Presiondelgadez","Afrontamiento",
"Psicopatologia","Antecedentes","Antecedentesfamilia",
"Habitos"), to = c("RiesgoTCA")),
paths(from = c("Estilosparentales","Presiondelgadez","Afrontamiento",
"Psicopatologia","Antecedentes","Antecedentesfamilia",
"Habitos","Dep_fis"), to = c("RiesgoTCA")))
# Estimate the model
corp_rep_simple_model <- estimate_pls(data = base.nor2,
measurement_model = simple_mm, structural_model = simple_sm,
missing_value = "-99")
Could someone please help me with this error?
I can share the script and data confidentially.
The text was updated successfully, but these errors were encountered: