Skip to content

450: Add horseshoe prior, as well as constant prior#472

Open
danielinteractive wants to merge 30 commits into
mainfrom
450-implement-horseshoe
Open

450: Add horseshoe prior, as well as constant prior#472
danielinteractive wants to merge 30 commits into
mainfrom
450-implement-horseshoe

Conversation

@danielinteractive

Copy link
Copy Markdown
Collaborator

closes #450

danielinteractive and others added 26 commits July 7, 2026 14:29
* slight tangent: add prior_const for surv exp first as a try

* first matching comparison between jmpost and brms for horseshoe prior usage

* first try to reduce to one model.stan file

* let Prior handle parameter declaration in the Stan code together with limits

* adapt documentation

* add snapshot tests for model stan code construction

* add vignette

* few fixes
prior_cauchy(), prior_gamma(), prior_invgamma(), prior_loglogistic(), prior_lognormal()
…rseshoe prior) to avoid warnings about uninitialized parameters
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                           Stmts    Miss  Cover    Missing
-------------------------------  -------  ------  -------  ------------------------------
R/brier_score.R                      173       1  99.42%   272
R/DataJoint.R                         78       0  100.00%
R/DataLongitudinal.R                 126       1  99.21%   251
R/DataSubject.R                       85       1  98.82%   144
R/DataSurvival.R                     106       0  100.00%
R/defaults.R                          13       9  30.77%   17-59, 86
R/generics.R                          40       5  87.50%   53, 431, 452, 515, 533
R/Grid.R                              27       1  96.30%   183
R/GridEven.R                          36       0  100.00%
R/GridEvent.R                         22       0  100.00%
R/GridFixed.R                         30       0  100.00%
R/GridGrouped.R                       54       0  100.00%
R/GridManual.R                        23       3  86.96%   79-81
R/GridObserved.R                      24       0  100.00%
R/GridPopulation.R                    37       4  89.19%   66, 74-76
R/GridPrediction.R                    37       6  83.78%   85, 93-97
R/JointModel.R                       131       9  93.13%   148-153, 203, 207, 252, 325
R/JointModelSamples.R                 96       0  100.00%
R/link_generics.R                     39      16  58.97%   67-70, 93-96, 115-118, 141-144
R/Link.R                              66       4  93.94%   202-205
R/LinkComponent.R                     24       3  87.50%   92, 121-122
R/LongitudinalClaretBruno.R          123       6  95.12%   221-225, 244
R/LongitudinalGSF.R                  138       0  100.00%
R/LongitudinalModel.R                 29       2  93.10%   68, 70
R/LongitudinalQuantities.R            74       0  100.00%
R/LongitudinalRandomEffects.R         65      17  73.85%   86-111
R/LongitudinalRandomSlope.R           62       6  90.32%   139-143, 156
R/LongitudinalSteinFojo.R            117      10  91.45%   204-208, 247-251
R/Parameter.R                         60       0  100.00%
R/ParameterList.R                     62       1  98.39%   209
R/populationHR.R                      63       0  100.00%
R/Prior.R                            494       6  98.79%   421, 453, 948, 1120-1125
R/Promise.R                           29       0  100.00%
R/Quantities.R                        61       0  100.00%
R/QuantityGeneratorPopulation.R       23       0  100.00%
R/QuantityGeneratorPrediction.R       48       0  100.00%
R/QuantityGeneratorSubject.R          21       0  100.00%
R/settings.R                          14      14  0.00%    59-75
R/SimGroup.R                           5       0  100.00%
R/SimJointData.R                     180      10  94.44%   133, 302-310
R/SimLongitudinal.R                    5       2  60.00%   22, 41
R/SimLongitudinalClaretBruno.R       107       0  100.00%
R/SimLongitudinalGSF.R               107       0  100.00%
R/SimLongitudinalRandomSlope.R        55       0  100.00%
R/SimLongitudinalSteinFojo.R          77       0  100.00%
R/SimSurvival.R                      165       0  100.00%
R/simulate.R                         364     364  0.00%    47-551
R/StanModel.R                         16       0  100.00%
R/StanModule.R                       186       6  96.77%   202-203, 247, 258, 409, 437
R/SurvivalExponential.R               15       0  100.00%
R/SurvivalGamma.R                     17       0  100.00%
R/SurvivalLoglogistic.R               17       0  100.00%
R/SurvivalModel.R                     20       0  100.00%
R/SurvivalQuantities.R               172       1  99.42%   127
R/SurvivalWeibullPH.R                 25       0  100.00%
R/utilities.R                        149       2  98.66%   15, 351
R/zzz.R                               31      28  9.68%    3-7, 9-32, 39-48
TOTAL                               4463     538  87.95%

Diff against main

Filename                   Stmts    Miss  Cover
-----------------------  -------  ------  --------
R/DataSurvival.R              +3       0  +100.00%
R/generics.R                  +4       0  +1.39%
R/JointModelSamples.R        +15       0  +100.00%
R/Parameter.R                +46       0  +100.00%
R/ParameterList.R            +20       0  +0.77%
R/Prior.R                   +149      -2  +1.10%
R/SurvivalExponential.R       +1       0  +100.00%
R/SurvivalLoglogistic.R       +2       0  +100.00%
TOTAL                       +240      -2  +0.73%

Results for commit: 9576e1d

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Unit Tests Summary

    1 files    208 suites   11m 2s ⏱️
  186 tests   170 ✅ 16 💤 0 ❌
1 248 runs  1 230 ✅ 18 💤 0 ❌

Results for commit 9576e1d.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
LongitudinalRandomEffects 💚 $91.15$ $-39.75$ $0$ $0$ $0$ $0$
initialValues 💚 $1.23$ $-1.01$ $0$ $0$ $0$ $0$
misc_models 💚 $16.78$ $-16.78$ $+3$ $0$ $0$ $0$
model_multi_chain 💚 $61.39$ $-21.56$ $0$ $0$ $0$ $0$
survival_plot 💔 $0.98$ $+1.26$ $+2$ $-1$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
DataSurvival 👶 $+0.00$ model.matrix_for_DataSurvival_preserves_no_intercept_formulas
Grid 💚 $105.73$ $-68.68$ Grid_objects_work_with_QuantityGenerator_and_QuantityCollapser
JointModel 💔 $2.80$ $+2.31$ JointModel_smoke_tests
JointModel 👶 $+0.00$ JointModel_snapshots_assembled_parameter_declarations
JointModelSamples 💔 $11.47$ $+22.29$ print_works_as_expected_for_JointModelSamples
LongitudinalClaretBruno 💚 $1934.08$ $-1926.12$ LongitudinalClaretBruno_works_as_expected_with_default_arguments
LongitudinalGSF 💚 $1719.79$ $-1710.59$ LongitudinalGSF_works_as_expected_with_default_arguments
LongitudinalQuantiles 💚 $50.01$ $-32.27$ Test_that_LongitudinalQuantities_works_as_expected
LongitudinalRandomEffects 💚 $91.15$ $-39.75$ LongitudinalRandomEffects_works_as_expected
LongitudinalRandomSlope 💚 $86.72$ $-84.33$ Print_method_for_LongitudinalRandomSlope_works_as_expected
LongitudinalSteinFojo 💚 $1743.28$ $-1733.19$ LongitudinalSteinFojo_works_as_expected_with_default_arguments
Parameter 👶 $+0.00$ Parameter_declaration_blocks_depend_on_prior_const
Parameter 👶 $+0.00$ Parameter_declaration_helpers_render_Stan_code
Prior 👶 $+0.00$ default_auxiliary_prior_methods_return_empty_lists
Prior 👶 $+0.01$ prior_const_works_as_expected
Prior 👶 $+0.01$ prior_horseshoe_works_as_expected
Prior 👶 $+0.02$ redundant_positive_support_prior_truncation_is_omitted
SimSurvival 💚 $4.28$ $-3.53$ SimSurvivalExponential_creates_a_dataset_with_the_correct_parameter
SurvivalExponential 💚 $73.15$ $-72.45$ Can_load_and_compile_SurvivalExponential_model
SurvivalExponential 👶 $+0.01$ SurvivalExponential_can_fix_lambda_with_prior_const_
SurvivalExponential 👶 $+0.00$ SurvivalExponential_does_not_print_truncation_for_prior_const_
SurvivalGamma 💚 $222.31$ $-220.23$ Print_method_for_SurvivalGamma_works_as_expected
SurvivalLoglogistic 💚 $44.02$ $-42.88$ Can_load_and_compile_SurvivalLogLogistic_model
SurvivalQuantities 💚 $102.45$ $-41.81$ SurvivalQuantities_and_autoplot.SurvivalQuantities_works_as_expected
SurvivalWeibullPH 💚 $15.23$ $-13.48$ Print_method_for_SurvivalWeibullPH_works_as_expected
brierScore 💚 $63.07$ $-58.61$ brierScore_SurvivalQuantities_returns_same_results_as_survreg
brms_compare 👶 $+0.02$ jmpost_and_brms_get_similar_horseshoe_estimates_for_survival_models
brms_compare 💚 $353.18$ $-353.08$ jmpost_and_brms_get_similar_loo_for_longitudinal_models
initialValues 👶 $+0.01$ initialValues_includes_auxiliary_prior_parameters
initialValues 💚 $3.64$ $-1.27$ initialValues_works_as_expected
initialValues 💚 $1.23$ $-1.01$ initial_values_for_fixed_distributions_gives_valid_values
misc_models 💔 $16.78$ $+141.99$ Longitudinal_Model_doesn_t_print_sampler_rejection_messages
misc_models 👶 $+0.00$ Survival_model_can_be_fit_with_a_horseshoe_prior
model_multi_chain 💚 $61.39$ $-21.56$ Can_recover_known_distribution_parameters_from_random_slope_model_when_using_multiple_chains
populationHR 💚 $30.50$ $-11.71$ populationHR_works_as_expected_for_default_parameters
simulate 💚 $267.85$ $-267.77$ simulate_works_with_default_options
stan_functions 💔 $1.47$ $+47.30$ GSF_SLD_function_works_as_expected
survival_plot 💔 $0.98$ $+1.26$ survival_plot_works_as_expected

Results for commit 67741ab

♻️ This comment has been updated with latest results.

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.

Add automated covariate selection for the survival model

2 participants