Hello,
My code (see the end of this post for the whole version) produces the following warning:
Messages from stanc:
Warning: The parameter beta_author has no priors.
Warning: The parameter alpha_author has no priors.
Sampling: 0% (4/4400)
However, these messages are gone if I replace this part of the model block:
alpha_author[i,j] ~ normal(mu_alpha[categories[i]], sigma_alpha[categories[i]]);
beta_author[i,j] ~ normal(mu_beta[categories[i]], sigma_beta[categories[i]]);
With these:
alpha_author[i,j] ~ normal(0, 1);
beta_author[i,j] ~ normal(0, 1);
What am I doing wrong?
Full-code below:
data {
int n_authors;
int n_years;
int n_obs;
int n_topics;
int n_categories;
int totals[n_obs];
int articles[n_obs, n_topics];
real years[n_obs];
int authors[n_obs];
int categories[n_authors];
}
parameters {
matrix [n_authors, n_topics] alpha_author;
matrix [n_categories, n_topics] mu_alpha;
matrix<lower=0> [n_categories, n_topics] sigma_alpha;
matrix [n_authors, n_topics] beta_author;
matrix [n_categories, n_topics] mu_beta;
matrix<lower=0> [n_categories, n_topics] sigma_beta;
}
model {
for (i in 1:n_categories) {
for (j in 1:n_topics) {
mu_alpha[i,j] ~ normal(0, 1);
sigma_alpha[i,j] ~ exponential(1);
mu_beta[i,j] ~ normal(0, 1);
sigma_beta[i,j] ~ exponential(1);
}
}
for (i in 1:n_authors) {
for (j in 1:n_topics) {
alpha_author[i,j] ~ normal(mu_alpha[categories[i]], sigma_alpha[categories[i]]);
beta_author[i,j] ~ normal(mu_beta[categories[i]], sigma_beta[categories[i]]);
// alpha_author[i,j] ~ normal(0, 1);
// beta_author[i,j] ~ normal(0, 1);
}
}
for (i in 1:n_obs) {
for (j in 1:n_topics) {
real p = Phi(alpha_author[authors[i],j]*years[i] + beta_author[authors[i],j]);
articles[i,j] ~ binomial(totals[i], p);
}
}
}
Thank you for your help (and for this wonderful piece of software!)