List of valid PDF strings for Stan?

Hi,

I am interested if there is a list of all valid PDFs implemented in Stan. Ideally this list would be available in R via some package.

If useful, the use case I have is that I am writing a function which takes a string as input (here family) and alters the Stan function below using regex to replace the text family with the specified PDF.

real latent_family_lpdf(vector y, vector mu, vector sigma, vector pwindow,
                           vector swindow, array[] real obs_t) {
  int n = num_elements(y);
  vector[n] d = y - pwindow + swindow;
  vector[n] obs_time = to_vector(obs_t) - pwindow;
  return family_lpdf(d | mu, sigma) - family_lcdf(obs_time | mu, sigma);
}

I’d like to add a check that the string provided is in fact a valid PDF. (This is all then passed into brms). I think it would be nice to do this, but I imagine Stan might complain in a somewhat obvious way later down the line if the string provided isn’t a valid PDF, so it might not be too hard for a user to figure out the issue.

Let me know if anyone has any ideas, or if it’s unclear what I mean / I could be more specific.

Thanks!
Adam

Does rstan::lookup("pdf") give you what you need? rstan is still a few releases behind Stan itself (although more caught up than it’s been in a while!) so any brand new pdfs (that brms could access via the cmdstanr backend) may not be included, but pdfs aren’t added too frequently.

1 Like

Amazing! Thank you.

And thanks for the additional information: for my case I think a nice solution is to provide a warning that the PDF isn’t in rstan and mention that it might be in the latest version of cmdstanr.

1 Like