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
Describe the bug
When trying to run a mediation analysis having more than 1 mediation path using brms (2.16.1) and bayestestR (0.11.0), I get the following messages:
Error in .subset2(x, i, exact = exact) : subscript out of bounds
In addition: Warning messages:
1: In response == mediator :
longer object length is not a multiple of shorter object length
2: In response != mediator :
longer object length is not a multiple of shorter object length
3: In if (variable %in% colnames(mf)) { :
the condition has length > 1 and only the first element will be used
Running a simpler model, with only 1 mediator, works fine.
To Reproduce
Here is the R code for that produces the brms fit object - the model compiles and runs fine:
There are 3 endogenous variables (CESD_Factor, PQSI_Global_Score_scaled, and Total_PSS_scaled) and 2 mediators (PQSI_Global_Score_scaled and Total_PSS_scaled).
I have tried several ways to write the mediation() statement, such as:
Error in .subset2(x, i, exact = exact) : subscript out of bounds
In addition: Warning messages:
1: In response == mediator :
longer object length is not a multiple of shorter object length
2: In response != mediator :
longer object length is not a multiple of shorter object length
3: In if (variable %in% colnames(mf)) { :
the condition has length > 1 and only the first element will be used
Expected behaviour
I expected that analyses of the mediation paths operating through each of the 2 mediators would be produced.
Specifiations (please complete the following information):
RStudio 2021.09.0 Build 351
R version 4.1.1 (2021-08-10) -- "Kick Things"
brms version 2.16.1
bayestestR version 0.11.0
The text was updated successfully, but these errors were encountered:
I just encountered the same problem, with exactly the same error message as @MichaelWeaver01 encountered.
A slight twist:
A brms model composed of three equations and two mediators runs into the error.
A brms model composed of two equations (but still two mediators) runs fine.
Describe the bug
When trying to run a mediation analysis having more than 1 mediation path using brms (2.16.1) and bayestestR (0.11.0), I get the following messages:
Running a simpler model, with only 1 mediator, works fine.
To Reproduce
Here is the R code for that produces the brms fit object - the model compiles and runs fine:
There are 3 endogenous variables (CESD_Factor, PQSI_Global_Score_scaled, and Total_PSS_scaled) and 2 mediators (PQSI_Global_Score_scaled and Total_PSS_scaled).
I have tried several ways to write the mediation() statement, such as:
but get error messages such as:
** The simpler model (1 mediator) that runs fine:
Expected behaviour
I expected that analyses of the mediation paths operating through each of the 2 mediators would be produced.
Specifiations (please complete the following information):
RStudio 2021.09.0 Build 351
R version 4.1.1 (2021-08-10) -- "Kick Things"
brms version 2.16.1
bayestestR version 0.11.0
The text was updated successfully, but these errors were encountered: