|
a |
|
b/inst/stan/base0_logit.stan |
|
|
1 |
// |
|
|
2 |
// Gaussian prior on regression coeffs (logistic regression) |
|
|
3 |
// |
|
|
4 |
|
|
|
5 |
data { |
|
|
6 |
|
|
|
7 |
// number of unpenalized columns in model matrix |
|
|
8 |
int U; |
|
|
9 |
|
|
|
10 |
// number of observations |
|
|
11 |
int N; |
|
|
12 |
|
|
|
13 |
// prior standard deviation for the unpenalised variables |
|
|
14 |
real <lower=0> scale_u; |
|
|
15 |
|
|
|
16 |
// design matrix |
|
|
17 |
matrix[N, U] X; |
|
|
18 |
|
|
|
19 |
// binary response variable |
|
|
20 |
array[N] int<lower=0, upper=1> y; |
|
|
21 |
} |
|
|
22 |
|
|
|
23 |
parameters { |
|
|
24 |
|
|
|
25 |
// unpenalized regression parameters |
|
|
26 |
vector[U] beta_u; |
|
|
27 |
} |
|
|
28 |
|
|
|
29 |
model { |
|
|
30 |
|
|
|
31 |
// unpenalized coefficients including intercept |
|
|
32 |
beta_u ~ normal(0, scale_u); |
|
|
33 |
|
|
|
34 |
// likelihood |
|
|
35 |
y ~ bernoulli_logit_glm(X, 0, beta_u); |
|
|
36 |
} |