Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using the summary() function. #353

Open
enci91 opened this issue Oct 23, 2024 · 0 comments
Open

Error when using the summary() function. #353

enci91 opened this issue Oct 23, 2024 · 0 comments

Comments

@enci91
Copy link

enci91 commented Oct 23, 2024

Hi everyone,

I am encountering an error when using the summary() function on a pls-sem model.
The error message is:

> summary_pls <- summary(pls_model)
Error in `[<-`(`*tmp*`, int_components, dv, value = NA) : 
  subscript out of bounds

The model is calculated as normal, and can even be bootstrapped without issues, however no summary can be generated from it.

My code is as follows:

# Data prep
setwd("[my directory]")
urdf <- read_excel("[my dataset]")

#PLS-SEM
measurements <- constructs(
  composite("Gender", single_item("T1_kjønn")),
  composite("Age", single_item("T1_alder")),
  reflective("Perf_Expectancy_T1", multi_items("T1_pe", 1:4)),
  reflective("Fac_Conditions_T1", multi_items("T1_fc", 1:4)),
  reflective("Beh_Intentions_T1", multi_items("T1_bi", 1:3)),
  reflective("Eff_Expectancy_T1", multi_items("T1_ee", 1:4)),
  reflective("Soc_Influence_T1", multi_items("T1_si", 1:3)),
  reflective("Hed_Motivation_T1", multi_items("T1_hm", 1:3)),
  reflective("Habit_T1", multi_items("T1_ht", 1:4)),
  reflective("Experience", single_item("T1_ex1")),
  reflective("Use_Frequency_T1", single_item("T1_use1")),
  reflective("AIAS-4_T1", multi_items("T1_aias", 1:4)),
  reflective("Perf_Expectancy_T2", multi_items("T2_pe", 1:4)),
  reflective("Fac_Conditions_T2", multi_items("T2_fc", 1:4)),
  reflective("Beh_Intentions_T2", multi_items("T2_bi", 1:3)),
  reflective("Eff_Expectancy_T2", multi_items("T2_ee", 1:4)),
  reflective("Soc_Influence_T2", multi_items("T2_si", 1:3)),
  reflective("Hed_Motivation_T2", multi_items("T2_hm", 1:3)),
  reflective("Habit_T2", multi_items("T2_ht", 1:4)),
  reflective("Experience_T2", single_item("T2_ex1")),
  reflective("Use_Frequency_T2", single_item("T2_use1")),
  reflective("AIAS-4_T2", multi_items("T2_aias", 1:4)),
  interaction_term(iv = "Beh_Intentions_T1", moderator = "Gender"),
  interaction_term(iv = "Beh_Intentions_T1", moderator = "Age"),
  interaction_term(iv = "Beh_Intentions_T1", moderator = "Experience")
)

structure <- relationships(
  paths(from = c("Beh_Intentions_T1", "Beh_Intentions_T1*Gender", "Beh_Intentions_T1*Age", "Beh_Intentions_T1*Experience"), to = "Beh_Intentions_T2"),
  paths(from = "Use_Frequency_T1", to = "Use_Frequency_T2"),
  paths(from = "Beh_Intentions_T1", to = "Use_Frequency_T1"),
  paths(from = "Beh_Intentions_T2", to = "Use_Frequency_T2"),
  paths(from = c("Perf_Expectancy_T1", "Fac_Conditions_T1", "Eff_Expectancy_T1", "Soc_Influence_T1", "Hed_Motivation_T1", "Habit_T1", "AIAS-4_T1"), to = "Beh_Intentions_T1"),
  paths(from = c("Perf_Expectancy_T2", "Fac_Conditions_T2", "Eff_Expectancy_T2", "Soc_Influence_T2", "Hed_Motivation_T2", "Habit_T2", "AIAS-4_T2"), to = "Beh_Intentions_T2")
)  

pls_model <- estimate_pls(data = urdf, 
                          measurement_model = measurements, 
                          structural_model = structure
)

plot_sem <- plot(pls_model)
summary_pls <- summary(pls_model)

I'm running the code on an M1 Macbook Pro using R Studio, with the following version specification:

> version
               _                           
platform       aarch64-apple-darwin20      
arch           aarch64                     
os             darwin20                    
system         aarch64, darwin20           
status                                     
major          4                           
minor          4.1                         
year           2024                        
month          06                          
day            14                          
svn rev        86737                       
language       R                           
version.string R version 4.4.1 (2024-06-14)
nickname       Race for Your Life

Someone else received the same error message (#330), but in that thread the user was attempting to fit a regression path model, which is not this case.

Let me know what you guys think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant