data { int N; vector[N] y; vector[N] X; } parameters { real a; real b; real sigma; } model { target+= normal_lpdf(y|a+X*b, sigma); // data model target+=(-log(sigma)); // log prior for p(sigma) propto 1/sigma } generated quantities { vector[N] log_lik; // pointwise log-likelihood for (n in 1:N){ log_lik[n] = normal_lpdf(y[n]| a+X[n]*b, sigma); } }