Hello - I have a simple ordered logistic model and I’m predicting outcomes with the y_tilda below. I’d like to get the actual probability for each discrete outcome. When I plot the fit, I’m getting continuous density functions for the outcome. Results look great, but how do I get the PMF or actual discrete samples for the predictions y_tilda?
Thank you!!! -Jamie
code = '''
data {
int<lower=2> K; // number of discrete outcomes
int<lower=0> N; // samples
int<lower=1> D; // data row dim
int<lower=1> M; // number of predictions
int<lower=1,upper=K> y[N]; // outcome
row_vector[D] x[N]; // data - record and last six for each boxer
row_vector[D] xx[M]; // data to predict on boxers
}
parameters {
vector[D] beta;
ordered[K-1] c;
}
model {
for (n in 1:N)
y[n] ~ ordered_logistic(x[n] * beta, c);
}
generated quantities {
int<lower=1, upper=K> y_tilda[M];
for (j in 1:M)
y_tilda[j] = ordered_logistic_rng(xx[j] * beta, c);
}
'''
stan_model = StanModel(model_code=code);