Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about y_pred in model bart_ewmv #159

Open
Airyyy opened this issue Oct 8, 2023 · 5 comments
Open

question about y_pred in model bart_ewmv #159

Airyyy opened this issue Oct 8, 2023 · 5 comments

Comments

@Airyyy
Copy link

Airyyy commented Oct 8, 2023

I feel confused about how the simulation score for each participant is calculated. How can we determine whether the balloon exploded in the simulated data when original pump limit for each balloon is not given?
In bart_ewmv.stan, the decision for pumping or not-pumping a balloon on trial k for pump l is simulated, but why the range of k is [1, pumps[j, k] + 1 - explosion[j, k]? And if the simulated decision of trial k is [1, 1, 1, 0, 1, ..., 1, nan,...], is it right to regard the number of pumping of trial k as 3?

@JeunghyunLee
Copy link

Could you explain which simulation score or simulated data you are referring to?

If you are asking about l, which is used to compute the utility of lth balloon pump, this value falls between the range of max pump for each balloon, noted as P. Still, please specify the simulation that you are asking about for a clearer answer!

@Airyyy
Copy link
Author

Airyyy commented Oct 11, 2023

I am asking about the trial-level posterior predictive simulations y_pred.

for (l in 1:(pumps[j, k] + 1 - explosion[j, k])) {
          // u_gain always equals r ^ rho.
          u_loss = (l - 1);

          u_pump = (1 - p_burst) * u_gain - lambda[j] * p_burst * u_loss +
          rho[j] * p_burst * (1 - p_burst) * (u_gain + lambda[j] * u_loss)^2;
          // u_stop always equals 0.

          delta_u = u_pump - u_stop;

          log_lik[j] += bernoulli_logit_lpmf(d[j, k, l] | tau[j] * delta_u);
          y_pred[j, k, l] = bernoulli_logit_rng(tau[j] * delta_u);
}

In the above code block, y_pred[j, k, l] means the lth pump on trail k of the jth person. I am confused about why can't l be larger than pumps[j, k] + 1 - explosion[j, k]).
Secondly, if the simulated y_pred[j, k] is [1, 1, 1, 0, 1, ..., 1, nan, ...] for kth trail of the jth person, is it right to regard the number of pumping of trial k as 3?
Thirdly, if the kth trail of the 'j'th person exploded at the 5th pump, but the simulated y_pred[j, k] is [1, 1, 0, 1, 1, nan, ...], is it right to regard the simulated y_pred[j, k] not exploded?

@JeunghyunLee
Copy link

  1. It’s because l is updated per pump, until the last pump available. If you trace back to the top of the stan file, pumps[j,k] refers to the number of pumps made so far and explosion[j, k] is a binary value (0/1) of whether the balloon exploded.
  2. The posterior prediction y_pred refers to the probability of the subject pumping the balloon. If you are looking for the probability of the balloon explosion, that would be p_burst.

@Airyyy
Copy link
Author

Airyyy commented Oct 12, 2023

  1. If the max number of pump in bart is 60, and for the kth balloon of jth person, the jth person stop pumping at the 30th pump, so pumps[j, k] is 30 and explosion[j, k] is 0, which means l <= 31. But why can't l be larger than 31 cause it may not exploded at 31th pump?
  2. In your code, y_pred is a binary value (0/1)

@JeunghyunLee
Copy link

  1. If the given pumps[j, k] is 30, that means the subject already pumped the balloon 30 times in that trial, which rules out the possibility of the 31th pump. Looking into the sample data should help?
  2. Yes, the posterior prediction y_pred should save the model’s prediction for each choice made by the participants (whether they choose to pump or not to pump at each moment). So it should be a binary value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants