BirteT
1
Hello, I am inexperienced with using the Stan syntax and would like to ask for help with the implementation of the following model:

with

is the below implementation in Stan correct?

```
model {
// priors:
target += inv_gamma_lpdf(sigma_sq | 2, 0.5);
target += normal_lpdf(beta | 0, sqrt(lambda*sigma_sq));
// likelihood:
target += normal_id_glm_lpdf(y | to_matrix(X), 0, beta, sqrt(sigma_sq));
}
```

I’m sorry if this is trivial, but I am still getting used to Stan (and modelling in general).

BirteT
2
As a follow-up to this question, if I want to sample beta from a standard normal distribution, would this be the right way to do it?

```
parameters {
vector[1] beta_norm;
real<lower = 0> sigma_sq; // variance
}
transformed parameters {
real lambda = 2;
vector[1] beta = beta_norm*sqrt(lambda*sigma_sq);
}
model {
// priors:
target += inv_gamma_lpdf(sigma_sq | 2, 0.5);
target += std_normal_lpdf(beta_norm);
// likelihood:
target += normal_id_glm_lpdf(y | to_matrix(X), 0, beta, sqrt(sigma_sq));
}
```