Skip to content

Store the actual posterior dimension #294

Description

@avehtari

One measure of how difficult a posterior is, is the number of dimensions,
For example posterior_database/posteriors/GLM_Poisson_Data-GLM_Poisson_model.json reports "dimensions",

{
  "keywords": ["bpa book", "Poisson model"],
  "urls": "https://github.com/stan-dev/example-models/tree/master/BPA/Ch.03",
  "references": "kery2011population",
  "dimensions": {
    "alpha": 1,
    "beta1": 1,
    "beta2": 1,
    "beta3": 1,
    "log_lambda": 40,
    "lambda": 40
  },
  "reference_posterior_name": null,
  "added_date": "2021-07-01",
  "added_by": "Kane Lindsay",
  "name": "GLM_Poisson_Data-GLM_Poisson_model",
  "model_name": "GLM_Poisson_model",
  "data_name": "GLM_Poisson_Data"
}

but looking at the code, these "dimensions" include transformed parameters and generated quantities which have high dimensions, but not influence how difficult the posterior is

parameters {
  real<lower=-20, upper=20> alpha;
  real<lower=-10, upper=10> beta1;
  real<lower=-10, upper=10> beta2;
  real<lower=-10, upper=10> beta3;
}
transformed parameters {
  vector[n] log_lambda;
  
  log_lambda = alpha + beta1 * year + beta2 * year_squared
               + beta3 * year_cubed;
}
generated quantities {
  vector[n] lambda;
  
  lambda = exp(log_lambda);
}

It would be good to report the actual posterior dimensionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions