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 summarizing the estimate_pls() #289

Closed
alibezzaa opened this issue May 20, 2022 · 5 comments
Closed

Error when summarizing the estimate_pls() #289

alibezzaa opened this issue May 20, 2022 · 5 comments

Comments

@alibezzaa
Copy link

Hello,

When summarizing a PLS model, I get the following error:
Error in if (construct[[1]] %in% unique(as.vector(orig_sm))) { :
argument is of length zero

The bootstrap works fine and I can plot the model. However, I can not summarize the model to assess validity.
Here's the code I used:

`mm3 = constructs(
composite("Overload", single_item("TS_2")),
composite("Invasion", multi_items("TS_", 4:5)),
composite("Complexity", c("TS_6", "TS_8")),
higher_composite("Technostress", c("Overload", "Invasion", "Complexity"), weights=mode_B),
composite("InterWB", multi_items("WB_", 1:4)),
composite("IntraWB", multi_items("WB_", 5:8)),
higher_composite("Wellbeing", c("IntraWB", "InterWB")),
composite("Engagement", multi_items("Eng_", 2:9))
)

sm3 = relationships(
paths("Technostress", "Wellbeing"),
paths("Wellbeing", "Engagement")
)

eng_model3 = estimate_pls(new_data, mm3, sm3)
sum_eng3 = summary(eng_model3)`

Any help will be appreciated.

@yanxiang-yang
Copy link

Got the same problem, have you solved this?
@NicholasDanks @soumyaray @Sumidu Could you please help provide some suggestions? Thank you all very much.

@soumyaray
Copy link
Contributor

@NicholasDanks is this related to the HOC code issue you mentioned to me recently?

@NicholasDanks
Copy link
Collaborator

This is another edge case :)

So I identified the bug in the code and I have committed a bug fix

Dear @yanxiang-yang and @alibezzaa

Thank you very much for pointing out a bug in our code. I believe that I now have resolved the bug. It had to do with the calculation of fSquared on HOc models which consisted of only single paths. Please do run the following code:

devtools::install_github(repo = "https://github.com/sem-in-r/seminr", ref = "bugfixes_aug_2022")

Then test your model and confirm that the bug is resolved and then let us know.

If the issue is resolved, please do close the issue.
Many thanks and happy modelling!

Nicholas

@FranDot
Copy link

FranDot commented Oct 9, 2022

Hello,
I'm new to seminr and getting the following summary error
Error in if ((mmMatrix[mmMatrix[, "construct"] == construct, "type"][1] == :
missing value where TRUE/FALSE needed

I don't know how to resolve the error and any help is appreciated.

Here's my code.
corp_rep_mm <- constructs(
composite("Empowerment", multi_items("Empower_",1:5)))

corp_rep_sm <- relationships(
paths(from = "Empowerment", to = c("Satisfaction", "OrgCommit", "Leadership")),
paths(from = "Satisfaction", to = c("Leadership")),
paths(from = "OrgCommit", to = c("PersonEffort")),
paths(from = "Leadership", to = c("PersonEffort")))

corp_rep_pls_model <- estimate_pls(data = Datafile,
measurement_model = corp_rep_mm,
structural_model = corp_rep_sm,
inner_weights = path_weighting)

@soumyaray
Copy link
Contributor

Hi @FranDot are you missing some code above? It seems you have never defined the measurement of all the constructs except for Empowerment. All constructs used in your structural model must be defined in the constructs() list.

Also, I believe this is a separate issue -- so if the problem lingers, please open a new issue. Alternatively, you can also share your code (upon fixing my above suggestions) in our Facebook group where more users can help you with your syntax: https://www.facebook.com/groups/seminr

Best of luck!

NicholasDanks added a commit that referenced this issue Oct 12, 2022
#308)

* changes to indexing in get_sm_nodes() to fix a bug that arises from using a single letter construct name. Issue #305

* Attend issue #309 regarding bug in total_effects() function

* Addresses issue #289 - bug when calculating fSquared on HOC models

* Addreswses issue #310

* refactor to use smMatrix helper function

* Remove browser() from code

* final changes to bugfixes

Co-authored-by: Nicholas Danks <nicholasdanks@Nicholass-MacBook-Pro-2.local>
Co-authored-by: Nicholas Danks <you@example.com>
Co-authored-by: Soumya Ray <soumya.ray@gmail.com>
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

5 participants