The switcheroo idea can run, but you need to add the second non linear equation within the nlf() function. This is because in brms, when you add nl=T, it only treate the main (first) equation as non linear. Then any other non-linear equations need to be specify by nlf
But when I tested this, the model doesnt converged for a couple of tries
I don’t think there is a reason to write a whole other model for dep, because I just want to get the mean (for the sole purpose of using it in the first non-linear formula). So I edited your suggestion a bit to just estimate the mean with a nlf() spec:
So the real “trick” here is to wrap the predicted parameter in nlf(), and this should be a general solution.
The results are not identical to the MPlus ones reported in the target paper, but I am not too worried about that, because there will be some differences in the priors and I could run longer chains etc. I’m going to test this a bit more before marking your post as a solution.
I’ve done some checks and this works afaict. I was cheeky and marked my own post as the solution (it was closest to my original question and works with the original code provided), but want to recognize that I wouldn’t have been able to do so without @Mauricio_Garnier-Villarre’s example code!
I’ve started a GitHub repository working on a tutorial-style manuscript for a psychology audience (not statisticians) on this topic with Joran Jongerling (who might be @Joran here [? 😀]). It is currently private but as I said before, I would be glad to invite people who would like to contribute to the manuscript as coauthors. @Mauricio_Garnier-Villarre@simonbrauer@e.m.mccormick please let me know if you’d like to join—I currently list you only in the acknowledgements section of draft 0.0001😀.
In any case this is marked as solved, huge thanks to everyone!