Skip to content

Adding Heaps Stationary VAR Models - #333

Draft
Sliderland wants to merge 8 commits into
stan-dev:masterfrom
Sliderland:add-var-models-draws
Draft

Sliderland wants to merge 8 commits into
stan-dev:masterfrom
Sliderland:add-var-models-draws

Conversation

@Sliderland

@Sliderland Sliderland commented Sep 18, 2026 •

Copy link
Copy Markdown

With regards to Issue #330

This is a draft PR and is currently incomplete (some draws are still being sampled).

Reference draw currently added:

  • heaps_small3-statprior_var
  • heaps_small3_semiconj_var-semiconj_var
  • heaps_small3_statrml_var-statrml_var
  • heaps_med10_semiconj_var-semiconj_var

Including

  • data objects and info
  • models objects and code
  • posterior objects and info
  • reference draws as .json.zip files, info and diagnostics/checks made
  • reference draw summary point estimates: mean_value and mean_squared_value

Additional reference draws: specifically same models on larger data, will be added to my fork as they complete and hopefully added to the pull request.

Future considerations:

  • heaps_med10-statprior_var requires > 100Mb of storage, so we should discuss how to deal with these in the future
  • heaps_med10_statrml_var-statrml_var produces some divergent transitions so I need to figure out why this is occurring and what I can do to make sure it passes the quality checks
  • heaps_med20_statinvert_varma-statinvert_varma is intentionally excluded for now because its initialization is quite expensive. It would likely also suffer from storage issues that need to be addressed
  • heaps_med20_statinvert_varma data object was added even though its resulting posterior reference draws are likely not to be added for a while. I will update this.

@Sliderland
Sliderland marked this pull request as draft September 18, 2026 09:22

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a better name for data like qusm10 or so. Heaps is in the reference. Especially if we have additional quarterly.

Also, the hyperparameters should exist in the stan model and not in the data.

@@ -0,0 +1,307 @@
functions {
/* Function to compute the matrix square root */
matrix sqrtm(matrix A) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does similar functions exist in stan? I think we should try to reuse functionality as much as possible.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is this the original code from Heaps?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code was (mostly) taken directly from the paper, but it was written for an older version of stan (specifically the syntax is slightly different). There is a function called canonicalize that converts older versions of stan code that use deprecated functions to use the newer syntax. I added the generated quantities to compute the eigenvalues of the companion matrix as well. Outside of these changes, everything else was left the same.

None of the variables in the generated quantities block are saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants