simsem / semTools

Useful tools for structural equation modeling
75 stars 36 forks source link

Using probe2wayRC() function, but showing error pertaining to probe2wayMC() #92

Closed HarmanjitS closed 3 years ago

HarmanjitS commented 3 years ago

I used following code as part of moderation analysis:

result2WayRC <- probe2WayRC(fit, nameX = c("Ad","Fed","AdXFed"), nameY = "Pon", modVar = "Fed", valProbe = c(-1,0,1))

It showed following error: Error: The probe2WayMC() function requires the model to be fit with a mean structure.

NOTE: Why it is showing error related to a function different than called for?

schoam4 commented 3 years ago

What version of semTools are you using? In the current version the error should read "This function requires the model to be fit with a mean structure" If you want to use probe2WayRC you will need to refit the model with a mean structure (the means are needed in the calculations of the simple slopes with residual centering).

Alex

HarmanjitS commented 3 years ago

@schoam4 I am using semTools 0.5-4 Problem here is that I am calling upon probe2WayRC() function (as I am using the residual centering approach for moderation analysis); while the error being showcased is for probe2WayMC() function, which I am not even calling in the syntax. Is there any way out?

TDJorgensen commented 3 years ago

Visit the Wiki to see the syntax for installing the latest development version--

Terrence D. Jorgensen Assistant Professor, Methods and Statistics Research Institute for Child Development and Education, the University of Amsterdam http://www.uva.nl/profile/t.d.jorgensen

HarmanjitS commented 3 years ago

@TDJorgensen I don't understand how to install syntax which is under development. Please guide.

schoam4 commented 3 years ago

The wiki can be found here: https://github.com/simsem/semTools/wiki see the section on Installation and use the instructions for installing with the devtools package.

The error you got is a typo in the version of semTools. The bigger issue with your analysis is that you need to fit your model with a mean structure before probing. See this page for details on including a mean structure with lavaan: https://lavaan.ugent.be/tutorial/means.html

HarmanjitS commented 3 years ago

Thanks Alexander,

Just adding the argument meanstructure = TRUE in the fitting function solved my problem. Did not require installing the under development package. Thanks for guiding me.

On Fri, May 7, 2021 at 5:40 PM Alexander M. Schoemann < @.***> wrote:

The wiki can be found here: https://github.com/simsem/semTools/wiki see the section on Installation and use the instructions for installing with the devtools package.

The error you got is a typo in the version of semTools. The bigger issue with your analysis is that you need to fit your model with a mean structure before probing. See this page for details on including a mean structure with lavaan: https://lavaan.ugent.be/tutorial/means.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/simsem/semTools/issues/92#issuecomment-834318023, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT7FM3VQTPMP5OJKBGFQUGLTMPKDTANCNFSM44HLNTDA .