swh:1:snp:4a47993778f3ff3fe6e227d2f4c1a7654fd94e50
Tip revision: fba3c5e894d0491d5da7dd7f301361a31b9812d3 authored by Imad Ali on 05 October 2019, 08:04:24 UTC
fixing typo
fixing typo
Tip revision: fba3c5e
hiv_inter.stan
data {
int<lower=0> J;
int<lower=0> N;
int<lower=1,upper=J> person[N];
vector[N] time;
vector[N] treatment;
vector[N] y;
}
parameters {
vector[J] a1;
vector[J] a2;
real beta;
real mu_a1;
real mu_a2;
real<lower=0> sigma_a1;
real<lower=0> sigma_a2;
real<lower=0> sigma_y;
}
transformed parameters {
vector[N] y_hat;
for (i in 1:N)
y_hat[i] = beta * time[i] * treatment[i] + a1[person[i]]
+ a2[person[i]] * time[i];
}
model {
mu_a1 ~ normal(0, 1);
a1 ~ normal (10 * mu_a1, sigma_a1);
mu_a2 ~ normal(0, 1);
a2 ~ normal (0.1 * mu_a2, sigma_a2);
beta ~ normal (0, 1);
y ~ normal(y_hat, sigma_y);
}