Closed lindeloev closed 5 years ago
This is the correct behaviour; what has happened is that by setting nullInterval, you've restricted the posterior to values between -.1 and .1. If you look at the histogram of the samples in the nullInterval case, you'll see they're right up against the upper bound that was set (.1). That's because IF the value is between -.1 and .1, then it certainly MUST be close to .1 (because the data are consistent with large values).
Thanks for the explanation, @richarddmorey! I see what you're saying, but maybe it would be helpful to clarify this behavior in the documentation or as a footnote to the summary output. I would expect the sampler to visit both the null and the alternative. What you're describing I would only expect if the prior was set to zero outside nullInterval
. Clearly, my expectations were wrong, but maybe others would have the same misconception.
Anyway, thanks - it's a great package!
Yes, you're right, it could be clearer. Specifically, it samples from the numerator model, which could be either the null or the alternative. I see this is only mentioned in help for the posterior() function, not for the posterior arguments.
I will note, however, that if you look at the samples object:
s = correlationBF(D$a, D$b, nullInterval=c(-0.1, 0.1), posterior=TRUE, iterations=10000)
the model is specified at the end of the output:
# > s
# [lines of output snipped]
---
Model:
Type: BFcorrelation, Jeffreys-beta*
Alternative, r = 0.333333333333333, rho =/= 0 -0.1<rho<0.1
But the summary() function strips that out, since it is not a BayesFactor function.
rho is remarkably lower when setting
nullInterval
incorrelationBF
. Here is a pretty strong correlation of around rho=0.95:But it is estimated to be around 0.09 when setting a nullInterval:
Not so if it is a point-null:
The BFs seem to be consistent, though.