Please also provide the following information in addition to your question:

- Operating System: MacOS
- brms Version: brms_2.4.0

I have the following simple model:

```
# simple model = regress yield against temperature
string_stan <- make_stancode(yield ~ temperature, data=random_data, family=gaussian)
stan_data <- make_standata(yield ~ temperature, data= random_data, family=gaussian)
# write string to seperate .stan file
fileConn<-file("crop_model3.stan")
writeLines(string_stan_, fileConn)
close(fileConn)
```

Which produces the following Stan Code:

```
// generated with brms 2.4.0 - crop_model3.stan
// SIMPLE - Regress crop yield against temperature
functions {
}
data {
int<lower=1> N; // total number of observations
vector[N] Y; // response variable
int<lower=1> K; // number of population-level effects
matrix[N, K] X; // population-level design matrix
int prior_only; // should the likelihood be ignored?
}
transformed data {
int Kc = K - 1;
matrix[N, K - 1] Xc; // centered version of X
vector[K - 1] means_X; // column means of X before centering
for (i in 2:K) {
means_X[i - 1] = mean(X[, i]);
Xc[, i - 1] = X[, i] - means_X[i - 1];
}
}
parameters {
vector[Kc] b; // population-level effects
real temp_Intercept; // temporary intercept
real<lower=0> sigma; // residual SD
}
transformed parameters {
}
model {
vector[N] mu = temp_Intercept + Xc * b;
// priors including all constants
target += student_t_lpdf(temp_Intercept | 3, 1, 10);
target += student_t_lpdf(sigma | 3, 0, 10)
- 1 * student_t_lccdf(0 | 3, 0, 10);
// likelihood including all constants
if (!prior_only) {
target += normal_lpdf(Y | mu, sigma);
}
}
generated quantities {
// actual population-level intercept
real b_Intercept = temp_Intercept - dot_product(means_X, b);
}
```

My question is about this produced code.

## What is the prior on Sigma? Why does it have two distributions, one subtracted from the other?

```
target += student_t_lpdf(sigma | 3, 0, 10)
- 1 * student_t_lccdf(0 | 3, 0, 10);
```

Why `- 1 * student_t_lccdf(0 | 3, 0, 10);`

?

What is `_lccdf(...)`

in this context? In my understanding it is a ‘survival function’ of `1 - student_t_lccdf()`

. Why is that relevant here?

How would I write this in the syntax using the tilde (~)? If I were writing the stancode myself I might look for something like:

```
sigma ~ student_t(3,0,10)
```

I have read the `?brmsformula`

page & *brms: An R Package for Bayesian Multilevel Models using Stan* but did not find an answer that I could understand in there.

Thank you for the help! The tools brms and Stan are awesome!

Tommy