Genentech / jmpost

https://genentech.github.io/jmpost/
17 stars 4 forks source link

Population summary for longitudinal model #309

Closed gowerc closed 6 months ago

gowerc commented 6 months ago

Closes #296

This PR implements the ability to generate summary quantities for the population level statistics. The general API for this is:

samples <- sampleStanModel(
    jm,
    data = jdat,
    iter_sampling = 100,
    iter_warmup = 100,
    chains = 1,
    refresh = 0,
    parallel_chains = 1
)

quants <- LongitudinalQuantities(
    samples,
    grid = GridPopulation(
        times = seq(-60, 400, by = 20)
    )
)

summary(quants)
                     group time   median    lower    upper
1  arm=Arm-A; study=Study-X  -60 47.73305 46.92316 48.73246
2  arm=Arm-B; study=Study-Y  -60 49.81595 48.91486 50.76750
3  arm=Arm-B; study=Study-X  -60 48.06070 47.13105 48.87656
4  arm=Arm-A; study=Study-X  -40 48.47935 47.94130 49.10514
5  arm=Arm-B; study=Study-Y  -40 50.43400 49.83822 51.11639
6  arm=Arm-B; study=Study-X  -40 48.67265 48.05981 49.23550
7  arm=Arm-A; study=Study-X  -20 49.21345 48.95950 49.48072
8  arm=Arm-B; study=Study-Y  -20 51.06070 50.76445 51.55347
9  arm=Arm-B; study=Study-X  -20 49.31010 48.99000 49.61108
10 arm=Arm-A; study=Study-X    0 49.95610 49.84432 50.01385
github-actions[bot] commented 6 months ago

Unit Tests Summary

  1 files   41 suites   10m 35s :stopwatch: 128 tests  97 :white_check_mark: 31 :zzz: 0 :x: 894 runs  863 :white_check_mark: 31 :zzz: 0 :x:

Results for commit 5cd50125.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 6 months ago

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
Grid 💔 $105.42$ $+149.43$ $+10$ $0$ $0$ $0$
JointModelSamples 💚 $33.83$ $-27.98$ $0$ $0$ $0$ $0$
LongitudinalGSF 💚 $229.84$ $-228.57$ $-5$ $+1$ $0$ $0$
LongitudinalQuantiles 💔 $42.78$ $+1.61$ $0$ $0$ $0$ $0$
LongitudinalSteinFojo 💚 $2.62$ $-1.44$ $0$ $+1$ $0$ $-1$
SurvivalExponential 💔 $27.66$ $+1.12$ $0$ $0$ $0$ $0$
SurvivalLoglogistic 💔 $29.17$ $+1.04$ $0$ $0$ $0$ $0$
SurvivalQuantities 💔 $13.37$ $+36.13$ $0$ $0$ $0$ $0$
SurvivalWeibullPH 💔 $28.95$ $+1.49$ $0$ $0$ $0$ $0$
extract_quantities 💔 $14.84$ $+1.19$ $0$ $0$ $0$ $0$
model_multi_chain 💔 $42.63$ $+1.71$ $0$ $0$ $0$ $0$
stan_functions 💔 $47.16$ $+1.35$ $0$ $0$ $0$ $0$
Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | Grid | 💚 | $105.14$ | $-22.79$ | GridObservered_Constructs_correct_quantities | | Grid | 👶 | | $+40.68$ | GridPopulation_works_as_expected_for_GSF_models | | Grid | 👶 | | $+30.41$ | GridPopulation_works_as_expected_for_Longitudinal_models | | Grid | 💔 | $0.24$ | $+101.13$ | Grid_objects_work_with_QuantityGenerator_and_QuantityCollapser | | JointModelSamples | 💚 | $33.83$ | $-27.98$ | print_works_as_expected_for_JointModelSamples | | LongitudinalGSF | 💚 | $228.59$ | $-228.58$ | Can_recover_known_distributional_parameters_from_a_full_GSF_joint_model | | LongitudinalSteinFojo | 💚 | $1.48$ | $-1.47$ | Can_recover_known_distributional_parameters_from_a_SF_joint_model | | SurvivalExponential | 💔 | $27.57$ | $+1.14$ | SurvivalExponential_can_recover_true_parameter_including_covariates_ | | SurvivalLoglogistic | 💔 | $29.03$ | $+1.05$ | SurvivalLogLogistic_can_recover_known_values | | SurvivalQuantities | 💔 | $7.13$ | $+33.71$ | SurvivalQuantities_and_autoplot.SurvivalQuantities_works_as_expected | | SurvivalQuantities | 💔 | $3.17$ | $+1.25$ | autoplot.SurvivalSamples_works_as_expected | | SurvivalWeibullPH | 💔 | $28.87$ | $+1.49$ | SurvivalWeibullPH_can_recover_known_values | | extract_quantities | 💔 | $14.84$ | $+1.19$ | extract_quantities_works_as_expected | | model_multi_chain | 💔 | $42.63$ | $+1.71$ | Can_recover_known_distribution_parameters_from_random_slope_model_when_using_multiple_chains |

Results for commit e8455c2d7f0da8a7b0f8d961111ca82ed36e2387

♻️ This comment has been updated with latest results.

github-actions[bot] commented 6 months ago

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  --------------------------------
R/brier_score.R                     166       0  100.00%
R/DataJoint.R                        76       2  97.37%   264, 270
R/DataLongitudinal.R                119       1  99.16%   244
R/DataSubject.R                      85       1  98.82%   142
R/DataSurvival.R                     77       0  100.00%
R/defaults.R                         10       6  40.00%   18-57, 84
R/generics.R                         26       2  92.31%   51, 394
R/Grid.R                             32       0  100.00%
R/GridEven.R                         32       0  100.00%
R/GridFixed.R                        30       0  100.00%
R/GridGrouped.R                      52       0  100.00%
R/GridManual.R                       23       3  86.96%   78-80
R/GridObserved.R                     20       0  100.00%
R/GridPopulation.R                   31       4  87.10%   61, 69-71
R/JointModel.R                      123       8  93.50%   141-143, 193, 197, 239, 285, 291
R/JointModelSamples.R                80       1  98.75%   76
R/link_generics.R                    10       2  80.00%   59, 76
R/Link.R                             62       4  93.55%   200-203
R/LinkComponent.R                    19       3  84.21%   88, 120-121
R/LongitudinalGSF.R                  76       0  100.00%
R/LongitudinalModel.R                19       0  100.00%
R/LongitudinalQuantities.R           67       0  100.00%
R/LongitudinalRandomSlope.R          35       0  100.00%
R/LongitudinalSteinFojo.R            69      20  71.01%   116-147
R/Parameter.R                        14       0  100.00%
R/ParameterList.R                    42       1  97.62%   184
R/Prior.R                           236       8  96.61%   480, 576, 588-606
R/Promise.R                          25       0  100.00%
R/Quantities.R                       60       0  100.00%
R/settings.R                         12      12  0.00%    55-69
R/SimGroup.R                          5       0  100.00%
R/SimJointData.R                     72       1  98.61%   103
R/SimLongitudinal.R                   5       2  60.00%   22, 40
R/SimLongitudinalGSF.R               51       0  100.00%
R/SimLongitudinalRandomSlope.R       42       0  100.00%
R/SimLongitudinalSteinFojo.R         48       0  100.00%
R/SimSurvival.R                     104       0  100.00%
R/StanModel.R                        15       0  100.00%
R/StanModule.R                      179       6  96.65%   199-200, 242, 253, 390, 418
R/SurvivalExponential.R              10       0  100.00%
R/SurvivalLoglogistic.R              11       0  100.00%
R/SurvivalModel.R                    19       0  100.00%
R/SurvivalQuantities.R              166       1  99.40%   128
R/SurvivalWeibullPH.R                11       0  100.00%
R/utilities.R                       143       1  99.30%   13
R/zzz.R                              28      25  10.71%   3, 8-12, 14-35, 47
TOTAL                              2637     114  95.68%

Diff against main

Filename                 Stmts    Miss  Cover
---------------------  -------  ------  --------
R/DataSubject.R            +16       0  +0.27%
R/Grid.R                    +2       0  +100.00%
R/GridPopulation.R         +31      +4  +87.10%
R/JointModel.R              +1       0  +0.05%
R/JointModelSamples.R      +15      +1  -1.25%
TOTAL                      +65      +5  -0.09%

Results for commit: 5cd5012565052331111a61d20573231fb7102608

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results