Skip to content

Instantly share code, notes, and snippets.

@drey7925
Last active December 13, 2019 22:12
Show Gist options
  • Save drey7925/a1b9106e2425096eba7a26d393b407b1 to your computer and use it in GitHub Desktop.
Save drey7925/a1b9106e2425096eba7a26d393b407b1 to your computer and use it in GitHub Desktop.
data {
int<lower=0> numLscores; // Number of boulder results
int<lower=0> maxN; // Max climber number observed
int<lower=0> maxML; // Max lead comp number observed
vector[numLscores] lscore;
int<lower=1,upper=maxN> lClimber[numLscores];
int<lower=1,upper=maxML> lComp[numLscores];
real hypersigma_LScore;
}
parameters {
vector[maxN] ls; // Latent lead skill
vector[maxML] al0; // Lead score intercept, per comp
vector[maxML] al1; // lead skill->score slope, per comp
vector<lower=0>[maxML] sigmaL; // Noise in bt, per comp
}
model {
// Model bouldering scores via bouldering skill latents
for (i in 1:numLscores) {
int comp = lComp[i];
int climber = lClimber[i];
lscore[i] ~ normal(al0[comp] + al1[comp] * ls[climber], sigmaL[comp]);
}
ls ~ normal(0, 1);
sigmaL ~ exponential(hypersigma_LScore);
al1 ~ normal(1, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment