Created
November 30, 2018 20:44
-
-
Save ericnovik/90e1c2377743135827d50e3313ae8968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data { | |
int<lower=2> K; // number of categories | |
int<lower=0> N; // number of observations | |
int<lower=1> D; // number of predictors | |
int<lower=1, upper=K> y[N]; | |
matrix[N, D] x; | |
} | |
parameters { | |
vector[D] beta; | |
ordered[K-1] c; // cutpoints | |
} | |
model { | |
beta ~ normal(0, 1); | |
c ~ normal(0, 5); | |
y ~ ordered_logistic(x * beta, c); | |
} | |
generated quantities { | |
vector[N] y_rep; | |
for(n in 1:N) { | |
y_rep[n] = ordered_logistic_rng(x[n, ] * beta, c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment