add new functions for group means and correlations #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I discovered an issue with how group mean parameters were being calculated (post hoc in the
generated quantities
block) that traces back tohBayesDM
. As described in the issue I opened here, the method where we simply do, e.g.,mu_Arew = Phi_approx(mu_p[1])
inStan
actually gives us an estimate of the group median rather than group mean. This is a rather subtle bug, so I don't expect it to change results much (if at all).I opened this PR with a new custom function in the Stan codes called
Phi_approx_group_mean_rng
which computes the group mean as intended. It involves a simulation step as described in the issue I linked. I also added a new function termedPhi_approx_corr_rng
that will simulate the test-retest correlations on the scale of interest, which avoids the need for us to do thepop_correct_MCMC
step post-hoc. Now, we can just do:and the resulting correlation we get from
Stan
will be of the correlation on the parameters with the correct transformation. So, no more need to do the iterative correlations part outside ofStan
!@hollysully @jeremy-haynes I know this is a strange change—let me know if you have any questions! Going forward, this should be more robust given that we have had some trouble with the
pop_correct_MCMC
code before.NOTE: I still need to update the R analysis code that computes the iterative correlations/runs the
pop_correct_MCMC
step, as it is no longer necessary. That said, I was not sure what all we want to save in that analysis file. If anyone wants to update that before we merge these changes, feel free to! (and push changes to this branch)