Error estimate in "Hierarchical Bayesian Linear Regression" example #199
Replies: 3 comments 12 replies
-
Hi @leostenzel! Thanks for the question! We are a little busy at the moment, but we noted your problem. |
Beta Was this translation helpful? Give feedback.
-
@leostenzel I've reviewed this nb once more. It seems to me that likelihood_var = inv(mean(results.posteriors[:σ]))
# rest of the code
pv = var(patient_α) + var(patient_β) * week ^ 2 + likelihood_var Resulting in higher variance in predictions: @bartvanerp @ismailsenoz , would you agree with that? I also think whether we can include the missing observations inside the model so we can generate predictions during the inference without having this extra piece of code as shown here. Writing down the formula for predictions manually is not user friendly. @leostenzel, as for the shift, can you explain a bit more what you mean that you've shifted data by -100 weeks? |
Beta Was this translation helpful? Give feedback.
-
Hi @leostenzel. I'm sorry for not getting back to you sooner. As for In principle, this should give the same result as I was hoping to get when performing predictions within the inference function, but a "bug" has been detected. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm still learning how to use this cool package:
Working through the Hierarchical Bayesian Linear Regression example, I was wondering about the computation of the prediction's error.
Comparing with the
numpyro
notebook, the error ofFVC
seems a bit off; the values are reasonable, but the smallest variance is always at week 0.I understand this is coming from computing the variance as
var(patient_α) + var(patient_β) * week ^ 2
, and I think I get the formula, but that doesn't always seem to match the data?In particular, if you offset the "Weeks" in the input, the predicted error changes, and that does not seem to be the case with
numpyro
.Is there any way you can fix this in RxInfer, or should you transform your input, or…?
It's not an urgent question, just trying to understand RxInfer's capabilities and limitations.
Edit: I guess I could try to be clearer. Taking a patient who isn't already shown in the examples,
ID00042637202184406822975
, the original input data give in RxInfer (left) and numpyro (right) the prediction:Things get worse when I shift the data by, e.g.,
-100
weeks.I have to admit that the numpyro result changes more than I first realized. I guess that could just be because I did not adjust the priors?
But RxInfer's prediction (left) is clearly worse, and variance just doesn't make any sense.
I suppose this got something to do with
patient_α
andpatient_β
not being independent?Maybe that doesn't matter too much for the overall prediction…
Just, reading the tutorial, I don't know if I agree with "The results match our expectations perfectly!".
And I think it could be quite instructive if you could elaborate on the assumptions, and how one can estimate the error more accurately.
Thanks, Leo
Beta Was this translation helpful? Give feedback.
All reactions