Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/survival #323

Open
wants to merge 250 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
250 commits
Select commit Hold shift + click to select a range
3e4f612
Add surv.stan with Stan hazard functions
sambrilleman Oct 26, 2018
7c28f64
Add stan_surv function
sambrilleman Oct 26, 2018
9c88853
Add roxygen template for stan_surv model objects
sambrilleman Oct 26, 2018
826322d
Add stansurv function for returning models of class stansurv
sambrilleman Oct 26, 2018
13caaed
Add stan_surv for package documentation of modelling functions
sambrilleman Oct 26, 2018
a18ae33
misc.R: add helper functions for stan_surv and stan_jm
sambrilleman Oct 26, 2018
804507a
Add plot method for stansurv objects
sambrilleman Oct 26, 2018
b8cb081
Add stop to posterior_linpred for stansurv objects
sambrilleman Oct 26, 2018
c3f570a
Add stop to posterior_predict for stansurv objects
sambrilleman Oct 26, 2018
4ca076e
Move offsets to bottom of pp_data.R
sambrilleman Oct 26, 2018
1cdc4e2
pp_data.R: add more obvious subheadings to help organise file
sambrilleman Oct 26, 2018
e433b0a
Add pp_data for stansurv objects
sambrilleman Oct 26, 2018
0d73af6
Get print.stanreg working for stansurv objects
sambrilleman Oct 26, 2018
3698466
Get summary.stanreg working for stansurv objects
sambrilleman Oct 26, 2018
3196062
Add stansurv objects to prior_summary
sambrilleman Oct 26, 2018
932026d
Add stansurv objects to ps_check
sambrilleman Oct 26, 2018
2a804c1
Add some tests for stan_surv
sambrilleman Oct 26, 2018
b406ec8
surv.stan: add += in places and avoid integer division
sambrilleman Oct 26, 2018
a26296d
stan_surv.R: add some missing helper functions
sambrilleman Oct 26, 2018
063b09b
Fix typo in plot.stansurv
sambrilleman Oct 26, 2018
b63626d
log_lik.R: add evaluators for log baseline hazard or survival
sambrilleman Oct 26, 2018
bc7facf
Add splines2 to Imports
sambrilleman Oct 26, 2018
e11f499
Fix typo in plot.stansurv
sambrilleman Oct 26, 2018
249c092
Add stansurv objects to stanreg methods
sambrilleman Oct 26, 2018
6bd1517
print & summary: add more info about censoring type for stansurv objects
sambrilleman Oct 26, 2018
38ce2e5
Allow NA in unstandardise_qpts and unstandardise_qwts functions
sambrilleman Oct 26, 2018
91682ad
Add log_lik method for stansurv objects
sambrilleman Oct 26, 2018
0cde0f7
Add loo for stansurv models with quadrature
sambrilleman Oct 26, 2018
96de0f6
Handle stansurv objects in is_discrete function
sambrilleman Oct 26, 2018
040e4e9
Updated NAMESPACE
sambrilleman Oct 26, 2018
4810fdf
stan_surv.R: make sure data argument is a data frame
sambrilleman Oct 28, 2018
45a9363
Add reloo and kfold for stansurv objects
sambrilleman Oct 28, 2018
27f5ee4
Rename some of the testthat helper functions
sambrilleman Oct 29, 2018
d98fc91
Update NAMESPACE
sambrilleman Oct 29, 2018
2a2db48
Rename get_extrapolation_control function
sambrilleman Oct 29, 2018
3c48f4e
Add WAIC for stansurv objects
sambrilleman Oct 29, 2018
c038e9a
Add tests for stansurv models with time-dependent effects
sambrilleman Oct 29, 2018
16aa332
Stop ps_check for stansurv models with delayed entry
sambrilleman Oct 29, 2018
789f7df
Generate a workaround for stansurv pp_data when all times are NA
sambrilleman Oct 29, 2018
5593f18
Add posterior_survfit for stansurv models
sambrilleman Oct 29, 2018
cad6b1f
Fix small typo
sambrilleman Oct 29, 2018
21c4865
Small bit of reformatting
sambrilleman Oct 29, 2018
9793f0a
Add mice lung tumor data to example datasets
sambrilleman Oct 29, 2018
fc368d1
Update stan_surv documentation
sambrilleman Oct 29, 2018
3172a0e
Add additional models to tests for stan_surv
sambrilleman Oct 29, 2018
126f972
Fix small bug in stan_surv design matrix
sambrilleman Oct 29, 2018
34f8bf1
Fix small bug in surv.stan with interval censoring and quadrature com…
sambrilleman Oct 29, 2018
91bbf82
Add dummy = in a bunch of places to get around Stan parser messages
sambrilleman Oct 29, 2018
d315096
Add simsurv to DESCRIPTION Suggests
sambrilleman Oct 29, 2018
42d5f88
Add the breast cancer survival dataset
sambrilleman Oct 30, 2018
02dfb33
Update stan_surv help documentation
sambrilleman Oct 30, 2018
0e627e9
log_lik.R: fix small bug in baseline survival evaluator for Gompertz
sambrilleman Oct 30, 2018
65aea84
Update aliases for rstanarm datasets documentation
sambrilleman Oct 30, 2018
fe903fa
Drop response from model frame when building x in pp_data_surv
sambrilleman Oct 30, 2018
f2c44ac
Add vignette for stan_surv
sambrilleman Oct 30, 2018
fff4798
Small changes to stan_surv vignette
sambrilleman Oct 30, 2018
446be1d
Add a couple more useful error messages to stan_surv
sambrilleman Oct 31, 2018
3d453ef
Add more tests for stan_surv
sambrilleman Oct 31, 2018
9ee4c3d
Don't check_constant_vars for Surv objects
sambrilleman Oct 31, 2018
c82e683
stan_surv tests: use PBC data for interval censoring test
sambrilleman Oct 31, 2018
af029d3
Add stan_surv test for interval censoring
sambrilleman Oct 31, 2018
b1650fa
stan_surv: disallow event or censoring times equal to zero
sambrilleman Oct 31, 2018
e71a1e6
Add more stan_surv tests
sambrilleman Oct 31, 2018
b84c760
Improve generalisability of the subset_ids function
sambrilleman Oct 31, 2018
c3d8661
Clean up plot.survfit function
sambrilleman Oct 31, 2018
5135e60
Remove icenReg from Suggests
sambrilleman Oct 31, 2018
57838b3
Fix up plot.survfit
sambrilleman Oct 31, 2018
639e525
Comment out stan_surv tests to avoid adding packages to Suggests
sambrilleman Oct 31, 2018
e577c4a
Update rename_e_aux function
sambrilleman Nov 1, 2018
786840c
Tidy up priors documentation for stan_surv
sambrilleman Nov 1, 2018
05643d2
Update mice dataset using negative infinity for left censoring
sambrilleman Nov 1, 2018
f0c7391
Shorten stan_surv examples
sambrilleman Nov 1, 2018
ffebbf8
Fixes to solve R CMD Check warnings
sambrilleman Nov 1, 2018
7cf9833
Fix failing mvmer test
sambrilleman Nov 1, 2018
6a4b42f
Fix small bug in dummy_matrix function
sambrilleman Nov 1, 2018
051625c
Change default df for M-splines to 6
sambrilleman Nov 1, 2018
f441857
Don't attach testthat in test_stan_surv
sambrilleman Nov 1, 2018
9db302a
Remove intercept from spline basis
sambrilleman Nov 19, 2018
23bde3a
Add explicit intercept parameter to baseline hazard and survival for …
sambrilleman Nov 19, 2018
8a92d32
Center predictor matrix, and center intercept using log crude event rate
sambrilleman Nov 19, 2018
14f3bd9
Center intercept, center predictor matrix, and use contrained coeffic…
sambrilleman Nov 19, 2018
69ecf9a
Use array for constrained spline coefficients
sambrilleman Nov 20, 2018
8ff50cb
Use dirichlet prior directly on constrained M-spline coefficients
sambrilleman Nov 21, 2018
6224e75
Add dirichlet prior to handle_glm_prior function
sambrilleman Nov 22, 2018
bffeb93
Add prior_concentration (for dirichlet) to summarize_jm_prior
sambrilleman Nov 22, 2018
33eb7b4
Use dirichlet prior for M-spline coefficients
sambrilleman Nov 22, 2018
ae16e4d
Add exponential rate to summarize_jm_prior function
sambrilleman Nov 22, 2018
dedcf8e
prior_summary: handle exponential and dirichlet distributions for sta…
sambrilleman Nov 22, 2018
f95915c
Update stan_surv documentation and vignette
sambrilleman Nov 22, 2018
7734e30
Update vignette to align with an intercept being included in the spli…
sambrilleman Nov 23, 2018
0368582
Fix type in stan_surv vignette
sambrilleman Nov 23, 2018
937d853
Add AFT models to stan_surv
sambrilleman Nov 23, 2018
2ee2d63
Update stan_surv documentation
sambrilleman Nov 26, 2018
9135559
Add AFT models to vignette
sambrilleman Nov 29, 2018
2e8b22a
Add tests for AFT models
sambrilleman Nov 29, 2018
0f95175
Add AFT models to surv.stan
sambrilleman Nov 29, 2018
514fee1
Add AFT models to hazard_functions.stan
sambrilleman Nov 29, 2018
b23d56c
Add AFT models to stan_surv documentation, and add a few standata items
sambrilleman Nov 29, 2018
e6a744d
Add plots of time-varying acceleration factor to plot.stansurv
sambrilleman Nov 29, 2018
43370aa
Add AFT models to doc on rstanarm modelling functions
sambrilleman Nov 29, 2018
df34a6b
Add Eren Elci as contributor in DESCRIPTION
sambrilleman Nov 29, 2018
b814695
Merge pull request #326 from stan-dev/feature/aft-models
sambrilleman Nov 29, 2018
0b39f00
surv.stan: remove use of cpts
sambrilleman Dec 4, 2018
44699cf
stan_surv: remove remaining cpts code
sambrilleman Dec 4, 2018
c6d6091
surv.stan: fix small typo
sambrilleman Dec 5, 2018
fb02cd4
stan_surv.R: tidy up use of cpts
sambrilleman Dec 6, 2018
0b5d601
plots for stan_surv: fix extraction of tde basis
sambrilleman Dec 6, 2018
f096bc5
Clean up some of stan_surv helper functions
sambrilleman Dec 6, 2018
820cbc5
Use make_x instead of make_s for pp_data.stansurv
sambrilleman Dec 6, 2018
af326f2
Tidy up stan_surv's parse_formula function
sambrilleman Dec 6, 2018
b959811
Update roxygen version
sambrilleman Feb 5, 2019
8b662c3
Remove preclean
sambrilleman Feb 5, 2019
92a90b7
stan_surv.R: start adding prior_covariance and Stan data for random e…
sambrilleman Feb 5, 2019
8591b6c
stan_surv.R: handle group-specific terms
sambrilleman Feb 8, 2019
cacdc42
surv.stan: start adding random effects structure
sambrilleman Feb 11, 2019
d3a985a
surv.stan: add common functions
sambrilleman Feb 11, 2019
2125eda
jm_data_block.R: fix small typo
sambrilleman Feb 11, 2019
96901a8
surv.stan: fix typo in data declaration
sambrilleman Feb 11, 2019
b819f29
Merge branch 'master' into feature/frailty-models
sambrilleman Feb 11, 2019
a5b3c6d
surv.stan: get frailty models working
sambrilleman Feb 11, 2019
0819216
stansurv.R: add some missing elements to returned model object
sambrilleman Feb 11, 2019
b735546
Fix bug in handle_cov_prior
sambrilleman Feb 11, 2019
5cd7150
stan_surv.R: fix reported number of levels for grouping factors
sambrilleman Feb 12, 2019
2a33667
Merge branch 'feature/frailty-models' into revise-priors-for-stansurv
sambrilleman Feb 19, 2019
f2e986c
stan_surv.R: fix stuff related to merging in dirichlet prior
sambrilleman Feb 19, 2019
80d788c
stan_surv.R: add quotes to a switch call
sambrilleman Feb 19, 2019
fe66342
stan_surv.R: add default prior_aux for AFT models
sambrilleman Feb 19, 2019
08e8c7d
Merge pull request #335 from stan-dev/revise-priors-for-stansurv
sambrilleman Feb 19, 2019
499b489
stan_surv.R: fix intercept shift for AFT models
sambrilleman Feb 20, 2019
4a92553
prior_summary: fix auxiliary paramters for AFT survival models
sambrilleman Feb 20, 2019
9a5d6d8
Merge pull request #336 from stan-dev/revise-priors-for-stansurv
sambrilleman Feb 20, 2019
130e6e7
Add an example dataset for frailty models
sambrilleman Feb 28, 2019
1a8569d
Start adding some tests for frailty models
sambrilleman Feb 28, 2019
91343fc
Add formula and terms methods for stansurv objects
sambrilleman Mar 19, 2019
da77d7e
Handle predvars in make_model_frame for stansurv
sambrilleman Mar 19, 2019
9d83be2
pp_data.R: start dealing with random effects for stansurv objects
sambrilleman Mar 19, 2019
920fb40
Allow tde() to be piecewise constant or a B-spline function
sambrilleman May 8, 2019
2485d7c
Add some tests for piecewise tde()
sambrilleman May 9, 2019
a6fe804
Fix small bug in stansurv pp_data
sambrilleman May 9, 2019
fa0faf0
Create make_s function
sambrilleman May 10, 2019
a2787e3
Deal with NAs in stansurv pp_data
sambrilleman May 10, 2019
791f981
Get stansurv loo test passing
sambrilleman May 10, 2019
dbb97f6
Add a couple of tests for prior_aux in stansurv models
sambrilleman May 10, 2019
c55dc03
Fix x_bar for stan_surv when there is just one predictor
sambrilleman May 10, 2019
d0ee8bd
Merge pull request #358 from stan-dev/bugfix/tde-wrapper-for-factors
sambrilleman May 10, 2019
08138db
stan_surv: add an exported tde function with help file
sambrilleman May 10, 2019
34ee65f
stan_surv: small change to tde documentation
sambrilleman May 10, 2019
f36e7f6
Rename tde() as tve()
sambrilleman May 14, 2019
3def4d2
Update stan_surv documentation for tve()
sambrilleman May 14, 2019
1fbf277
Rename tde() to tve() in NAMESPACE
sambrilleman May 14, 2019
0a005d8
Add another stan_surv tve() example
sambrilleman May 15, 2019
dcfc620
Updates to stan_surv vignette
sambrilleman May 15, 2019
08d75aa
More additions to stan_surv vigenette (technical details)
sambrilleman May 15, 2019
c5c0c97
More changes to stan_surv vignette
sambrilleman May 15, 2019
ac67a47
Update examples in stan_surv vignette
sambrilleman May 15, 2019
12d752d
Fix up capitalisation for pbcLong dataset documentation
sambrilleman May 16, 2019
8d4d23d
pp_data.R & log_lik.R: add stan_surv frailty models
sambrilleman May 16, 2019
2232c85
posterior_survfit: handle fraily models & don't condition by default
sambrilleman May 17, 2019
0ae397a
stan_surv.R: remove unnecessary code from parse_formula
sambrilleman May 17, 2019
5316d5a
Tidy up stan_surv tests
sambrilleman May 17, 2019
16171da
plot.stansurv: allow user to specify number of points at which to int…
sambrilleman Jun 4, 2019
d465a97
posterior_survfit: tidy print method
sambrilleman Jun 4, 2019
8193e58
plot.stansurv: don't use geom_smooth
sambrilleman Jun 4, 2019
13a9952
posterior_survfit: fix up last_time when not conditioning
sambrilleman Jun 4, 2019
5712ffd
stan_surv: allow user to specify degree for MS and BS baseline hazards
sambrilleman Jun 4, 2019
df43618
stan_surv: fix bug in M-spline baseline hazard
sambrilleman Jun 4, 2019
9c4312f
plot.stansurv: add more documentation for param n
sambrilleman Jun 6, 2019
b5ef03b
use bSpline function instead of bs
sambrilleman Jun 6, 2019
266de62
Fix small bug in handle_basehaz
sambrilleman Jun 6, 2019
202b7c7
Add frailty models to stan_surv vignette
sambrilleman Jun 6, 2019
7f2fdf0
stan_surv: add example for frailty models
sambrilleman Jun 6, 2019
5c824fb
Fix typo
sambrilleman Jun 6, 2019
25aaaca
stan_surv: update documentation for M-splines
sambrilleman Jun 6, 2019
871d11c
Merge pull request #368 from stan-dev/frailty-models-update-with-master
sambrilleman Jun 6, 2019
7925a17
Fix typo
sambrilleman Jun 6, 2019
a708aa3
stan_surv vignette: fix small typo
sambrilleman Jun 18, 2019
b02b6d7
posterior_survfit: add return_matrix argument
sambrilleman Jul 8, 2019
9926d57
posterior_survfit: document return_matrix argument
sambrilleman Jul 8, 2019
66b5e58
Allow marginalised survival predictions for stan_jm
sambrilleman Jul 9, 2019
ce247c8
Avoid error when using exponential distribution with prior_PD = TRUE
sambrilleman Jul 15, 2019
2de7f20
Change default scale for prior_aux with Gompertz models
sambrilleman Jul 17, 2019
051c0a0
Fix up default df for M-splines & allow degree = 0 for tve function
sambrilleman Jul 24, 2019
5877fce
Fix up renaming of tve coefs
sambrilleman Jul 24, 2019
b6fa276
Add some simulation tests for stan_surv with piecewise constant hazar…
sambrilleman Jul 25, 2019
6af4f2c
Use 200 interpolation points for ps_check
sambrilleman Jul 28, 2019
38cd4ab
psoterior_traj and posterior_survfit: use 100 points by default for i…
sambrilleman Jul 28, 2019
fe4c310
ps_check and posterior_survfit: reduce default number of draws to 400
sambrilleman Aug 9, 2019
2325d3a
Use hexNumeric for deparsing bSpline call
sambrilleman Aug 19, 2019
8628335
Remove type="pw" option for tve function
sambrilleman Aug 19, 2019
12338d1
Merge pull request #381 from stan-dev/feature/frailty-models
sambrilleman Aug 20, 2019
14a7c59
Merge branch 'master' into feature/survival-update-with-master
sambrilleman Aug 20, 2019
3f4ef64
stan_surv.R: allow any number of grouping factors
sambrilleman Sep 25, 2019
cd73314
surv.stan: change dimension of redundant simplex
sambrilleman Sep 26, 2019
f984a70
Merge pull request #388 from stan-dev/feature/survival
sambrilleman Sep 26, 2019
26d537e
Merge branch 'master' into feature/survival-update-with-master
sambrilleman Oct 1, 2019
6bee016
stan_surv.R: fix up get_iknots function
sambrilleman Oct 1, 2019
c2b39c1
test_stan_surv.R: only use simulations that converged (based on Rhat)
sambrilleman Oct 2, 2019
fd1b78b
Merge pull request #391 from stan-dev/feature/survival-update-with-ma…
sambrilleman Oct 2, 2019
fe27541
posterior_survfit.R: fix up validate_newdata
sambrilleman Oct 4, 2019
b91202a
stan_surv vignette: use loo_compare
sambrilleman Oct 4, 2019
f8627b1
stan_surv vignette: some small fixes
sambrilleman Oct 4, 2019
a9775b8
Merge pull request #392 from stan-dev/update-survival-vignette
sambrilleman Oct 4, 2019
77f8a90
stan_surv vignette: updates to vignette
sambrilleman Oct 5, 2019
2218ba8
Merge branch 'master' into feature/survival
bgoodri Jul 24, 2020
7536bba
Don't run stan_surv examples on 32 bit
sambrilleman Jul 26, 2020
f842562
change return type from void to real
jgabry Jul 29, 2020
f931b28
Fix docstring when returning target
sambrilleman Aug 9, 2020
ff0a22b
Remove redundant assignments in hazard_functions.stan
sambrilleman Aug 9, 2020
99eea89
Catch some undesirable inputs that were being absorbed in dots (i.e. …
sambrilleman Aug 9, 2020
d8fea17
Include stansurv objects in is.mer function
sambrilleman Aug 9, 2020
a9ae830
Merge pull request #526 from stan-dev/bugfix-survival
sambrilleman May 12, 2021
dab004f
Merge pull request #527 from stan-dev/update-survival-vignette
sambrilleman May 12, 2021
02cc505
Reverse order of tests to address stan-dev/rstanarm#535
jburos Jun 17, 2021
52260d9
update terms as well
jburos Jun 18, 2021
8f07554
reverse order of checks per #535
jburos Jun 21, 2021
af555ab
Add some more checks for is.surv
jburos Jun 21, 2021
daa4303
Merge pull request #536 from jburos/bugfix/stansurv-formula
sambrilleman Apr 29, 2022
69ef2b6
Merge branch 'master' into survival_2_21_3
sambrilleman Aug 3, 2022
2971684
Fix up the overlapping test helper functions
sambrilleman Aug 3, 2022
43b0796
Remove reference to csr_matrix_times_vector2
sambrilleman Aug 3, 2022
99cdef3
Merge branch 'master' into feature/survival
bgoodri Feb 7, 2023
f9047a0
csr_matrix_times_vector2 -> csr_matrix_times_vector
bgoodri Feb 7, 2023
f2d158d
Use | instead of || for or condition
sambrilleman Jul 9, 2023
3a41b19
Merge pull request #594 from stan-dev/bug_fix_for_or_condition
sambrilleman Jul 9, 2023
52ec452
Merge branch 'master' into survival_2_26_1
sambrilleman Oct 30, 2023
d95d9ee
Run R cmd check from dev branch
sambrilleman Oct 30, 2023
228cae3
Ensure functions don't modify target
sambrilleman Oct 30, 2023
1c6cecd
Use new array syntax
sambrilleman Oct 30, 2023
55325d9
Disable most of the build environments
sambrilleman Oct 30, 2023
9a3d0a0
Fix remaining reference to target in stan functions
sambrilleman Oct 30, 2023
8ff3381
Solve NOTE about broken tve.Rd docs link
sambrilleman Oct 30, 2023
1b84015
Merge remote-tracking branch 'origin/feature/survival' into survival_…
sambrilleman Oct 30, 2023
4dc2c1f
Remove remaining test helpers
sambrilleman Oct 30, 2023
b5af2c5
Add missing doc for prior_covariate in stan_surv.R
sambrilleman Oct 30, 2023
1c2fb5c
Fix doc reference for S3 plot method on stansurv objects
sambrilleman Oct 30, 2023
47b7e02
Fix undefined global reference to xlevs ... how did this not break th…
sambrilleman Oct 30, 2023
bda83b8
Try deal with the xlevs stuff
sambrilleman Oct 31, 2023
46e8c90
Remove if condition from step that uploads artifacts
sambrilleman Oct 31, 2023
67478d4
Fix inherits - broken due to breaking change in splines2 0.5
sambrilleman Oct 31, 2023
4320268
Don't offset sparse parts by -1L
sambrilleman Oct 31, 2023
36a93eb
Merge branch 'master' into survival_2_26_1
sambrilleman Oct 31, 2023
ed73436
Revert temporary changes to CI pipeline
sambrilleman Oct 31, 2023
801cc86
Merge pull request #607 from stan-dev/survival_2_26_1
sambrilleman Oct 31, 2023
e65cc10
Fix mispelling of context() in test_stan_surv.R
sambrilleman Nov 1, 2023
3a7680f
Don't explicitly set knots at boundary
sambrilleman Nov 5, 2023
f2b4d04
Remove use of || in log_lik.R for stan_surv models
sambrilleman Nov 5, 2023
5e405c4
Just try using larger sample sizes for the failing tests
sambrilleman Nov 7, 2023
36a0d06
Merge branch 'master' into feature/survival
sambrilleman Feb 10, 2024
590ba0a
Try deal with reserved naming issue
sambrilleman Feb 10, 2024
17ade30
Update deprecated array syntac
andrjohns May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Authors@R: c(person("Jonah", "Gabry", email = "[email protected]", role = "au
person(given = "Jacqueline Buros", family = "Novik",
role = "ctb", comment = "R/stan_jm.R"),
person("AstraZeneca", role = "ctb", comment = "R/stan_jm.R"),
person("Eren", "Elci", role = "ctb", comment = "R/stan_surv.R"),
person("Trustees of", "Columbia University", role = "cph"),
person("Simon", "Wood", role = "cph", comment = "R/stan_gamm4.R"),
person("R Core", "Deveopment Team", role = "cph",
Expand Down Expand Up @@ -45,6 +46,8 @@ Imports:
rstan (>= 2.32.0),
rstantools (>= 2.1.0),
shinystan (>= 2.3.0),
splines,
splines2 (>= 0.2.7),
stats,
survival (>= 2.40.1),
RcppParallel (>= 5.0.1),
Expand All @@ -61,6 +64,7 @@ Suggests:
mgcv (>= 1.8-13),
rmarkdown,
roxygen2,
simsurv (>= 0.2.2),
StanHeaders (>= 2.21.0),
testthat (>= 1.0.2),
gamm4,
Expand Down
12 changes: 12 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ S3method(fixef,stanmvreg)
S3method(fixef,stanreg)
S3method(formula,stanmvreg)
S3method(formula,stanreg)
S3method(get_surv,stanjm)
S3method(get_surv,stansurv)
S3method(get_x,default)
S3method(get_x,gamm4)
S3method(get_x,lmerMod)
Expand Down Expand Up @@ -56,12 +58,16 @@ S3method(nsamples,stanreg)
S3method(pairs,stanreg)
S3method(plot,predict.stanjm)
S3method(plot,stanreg)
S3method(plot,stansurv)
S3method(plot,survfit.stanjm)
S3method(plot,survfit.stansurv)
S3method(posterior_epred,stanreg)
S3method(posterior_interval,stanreg)
S3method(posterior_linpred,stanreg)
S3method(posterior_predict,stanmvreg)
S3method(posterior_predict,stanreg)
S3method(posterior_survfit,stanjm)
S3method(posterior_survfit,stansurv)
S3method(posterior_vs_prior,stanreg)
S3method(pp_check,stanreg)
S3method(predict,stanreg)
Expand All @@ -79,6 +85,7 @@ S3method(print,stanreg_list)
S3method(print,summary.stanmvreg)
S3method(print,summary.stanreg)
S3method(print,survfit.stanjm)
S3method(print,survfit.stansurv)
S3method(prior_summary,stanreg)
S3method(ranef,stanmvreg)
S3method(ranef,stanreg)
Expand Down Expand Up @@ -115,6 +122,7 @@ export(default_prior_intercept)
export(dirichlet)
export(exponential)
export(fixef)
export(get_surv)
export(get_x)
export(get_y)
export(get_z)
Expand Down Expand Up @@ -182,10 +190,12 @@ export(stan_mvmer)
export(stan_nlmer)
export(stan_polr)
export(stan_polr.fit)
export(stan_surv)
export(stanjm_list)
export(stanmvreg_list)
export(stanreg_list)
export(student_t)
export(tve)
export(waic)
if(getRversion()>='3.3.0') importFrom(stats, sigma) else
importFrom(lme4,sigma)
Expand All @@ -195,6 +205,7 @@ import(bayesplot)
import(methods)
import(rstantools)
import(shinystan)
import(splines2)
import(stats)
importFrom(Matrix,Matrix)
importFrom(Matrix,t)
Expand Down Expand Up @@ -272,6 +283,7 @@ importFrom(rstan,stanc)
importFrom(rstan,vb)
importFrom(rstantools,loo_R2)
importFrom(rstantools,nsamples)
importFrom(splines,bs)
importFrom(stats,cov2cor)
importFrom(stats,getInitial)
importFrom(survival,Surv)
Expand Down
17 changes: 15 additions & 2 deletions R/data_block.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ handle_glm_prior <- function(prior, nvars, default_scale, link,
prior_scale = as.array(rep(1, nvars)),
prior_df = as.array(rep(1, nvars)), prior_dist_name = NA,
global_prior_scale = 0, global_prior_df = 0,
slab_df = 0, slab_scale = 0,
slab_df = 0, slab_scale = 0,
prior_concentration = as.array(rep(1, nvars)),
prior_autoscale = FALSE))

if (!is.list(prior))
Expand All @@ -94,6 +95,7 @@ handle_glm_prior <- function(prior, nvars, default_scale, link,
global_prior_df <- 0
slab_df <- 0
slab_scale <- 0
prior_concentration <- 1
if (!prior_dist_name %in% unlist(ok_dists)) {
stop("The prior distribution should be one of ",
paste(names(ok_dists), collapse = ", "))
Expand All @@ -114,14 +116,24 @@ handle_glm_prior <- function(prior, nvars, default_scale, link,
slab_scale <- prior$slab_scale
} else if (prior_dist_name %in% "exponential") {
prior_dist <- 3L # only used for scale parameters so 3 not a conflict with 3 for hs
} else if (prior_dist_name %in% "dirichlet") {
prior_dist <- 4L # only used by stan_surv for baseline hazard coefficients
prior_concentration <- prior$concentration
if (is.null(prior_concentration)) {
prior_concentration <- rep(1, nvars)
} else {
prior_concentration <- maybe_broadcast(prior_concentration, nvars)
}
}

prior_df <- maybe_broadcast(prior_df, nvars)
prior_df <- as.array(pmin(.Machine$double.xmax, prior_df))
prior_mean <- maybe_broadcast(prior_mean, nvars)
prior_mean <- as.array(prior_mean)
prior_scale <- maybe_broadcast(prior_scale, nvars)

prior_concentration <- maybe_broadcast(prior_concentration, nvars)
prior_concentration <- as.array(prior_concentration)

nlist(prior_dist,
prior_mean,
prior_scale,
Expand All @@ -131,5 +143,6 @@ handle_glm_prior <- function(prior, nvars, default_scale, link,
global_prior_df,
slab_df,
slab_scale,
prior_concentration,
prior_autoscale = isTRUE(prior$autoscale))
}
98 changes: 82 additions & 16 deletions R/doc-datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' Small datasets for use in \pkg{rstanarm} examples and vignettes.
#'
#' @name rstanarm-datasets
#' @aliases kidiq roaches wells bball1970 bball2006 mortality tumors radon pbcLong pbcSurv
#' @aliases bball1970 bball2006 bcancer frail kidiq mice mortality pbcLong pbcSurv tumors radon roaches wells
#' @format
#' \describe{
#' \item{\code{bball1970}}{
Expand Down Expand Up @@ -50,6 +50,42 @@
#' \item \code{K} Number of at-bats
#' }
#' }
#' \item{\code{bcancer}}{
#' The German Breast Cancer Study Group dataset, containing time to death or
#' recurrence for 686 patients with primary node positive breast cancer
#' recruited between 1984-1989.
#'
#' Source: Royston and Parmar (2002)
#'
#' 686 obs. of 4 variables
#' \itemize{
#' \item \code{recdays} Time to death or censoring (in days)
#' \item \code{recyrs} Time to death or censoring (in years)
#' \item \code{status} Event indicator (0 = right censored, 1 = event)
#' \item \code{group} Prognostic group, based on a regression model developed
#' by Sauerbrei and Royston (1999) (\code{Good}, \code{Medium}, \code{Poor})
#' }
#' }
#' \item{\code{frail}}{
#' A simulated dataset of event times (i.e. survival data) for 200 patients
#' clustered within 20 hospital sites (10 patients per hospital site).
#' The event times are simulated from a parametric proportional hazards model
#' under the following assumptions: (i) a constant (i.e. exponential) baseline
#' hazard rate of 0.1; (ii) a fixed treatment effect with log hazard ratio of
#' 0.3; and (iii) a site-specific random intercept (specified on the log
#' hazard scale) drawn from a \eqn{N(0,1)} distribution.
#'
#' 200 obs. of 6 variables
#' \itemize{
#' \item \code{id} ID unique to each patient
#' \item \code{site} ID unique to each hospital site (i.e. cluster)
#' \item \code{trt} Treatment indicator (0 = untreated, 1 = treated)
#' \item \code{b} Cluster-specific random intercept used to simulate the
#' event times
#' \item \code{eventtime} Event or censoring time
#' \item \code{status} Event indicator (0 = right censored, 1 = event)
#' }
#' }
#' \item{\code{kidiq}}{
#' Data from a survey of adult American women and their children
#' (a subsample from the National Longitudinal Survey of Youth).
Expand All @@ -64,6 +100,24 @@
#' \item \code{mom_age} Mother's age
#' }
#' }
#' \item{\code{mice}}{
#' Lung tumor development in 144 RFM mice allocated to either a conventional
#' environment or germ-free environment. Mice were sacrificed and examined
#' for presence of a lung tumor. The outcome variables in the dataset
#' (\code{l} and \code{u}) denote a left-censored or right-censored time
#' interval within which the development of the first lung tumor must have
#' occurred.
#'
#' Source: Hoel and Walburg (1972)
#'
#' 144 obs. of 3 variables
#' \itemize{
#' \item \code{l} Lower limit of the interval.
#' \item \code{u} Upper limit of the interval.
#' \item \code{grp} Experimental group (\code{ce} = conventional environment,
#' \code{ge} = germ-free environment).
#' }
#' }
#' \item{\code{mortality}}{
#' Surgical mortality rates in 12 hospitals performing cardiac surgery
#' in babies.
Expand All @@ -86,21 +140,20 @@
#'
#' 304 obs. of 8 variables (\code{pbcLong}) and 40 obs. of 7 variables (\code{pbcSurv})
#' \itemize{
#' \item \code{age} in years
#' \item \code{albumin} serum albumin (g/dl)
#' \item \code{logBili} logarithm of serum bilirubin
#' \item \code{death} indicator of death at endpoint
#' \item \code{futimeYears} time (in years) between baseline and
#' \item \code{age} Age (in years)
#' \item \code{albumin} Serum albumin (g/dl)
#' \item \code{logBili} Logarithm of serum bilirubin
#' \item \code{death} Indicator of death at endpoint
#' \item \code{futimeYears} Time (in years) between baseline and
#' the earliest of death, transplantion or censoring
#' \item \code{id} numeric ID unique to each individual
#' \item \code{platelet} platelet count
#' \item \code{sex} gender (m = male, f = female)
#' \item \code{status} status at endpoint (0 = censored,
#' 1 = transplant, 2 = dead)
#' \item \code{trt} binary treatment code (0 = placebo, 1 =
#' D-penicillamine)
#' \item \code{year} time (in years) of the longitudinal measurements,
#' taken as time since baseline)
#' \item \code{id} Numeric ID unique to each individual
#' \item \code{platelet} Platelet count
#' \item \code{sex} Gender (m = male, f = female)
#' \item \code{status} Status at endpoint (0 = censored, 1 = transplant,
#' 2 = dead)
#' \item \code{trt} Binary treatment code (0 = placebo, 1 = D-penicillamine)
#' \item \code{year} Time (in years) of the longitudinal measurements,
#' taken as time since baseline
#' }
#' }
#'
Expand Down Expand Up @@ -181,7 +234,20 @@
#' @template reference-gelman-hill
#'
#' @references
#' Spiegelhalter, D., Thomas, A., Best, N., & Gilks, W. (1996) BUGS 0.5
#' Hoel, D. and Walburg, H. (1972) Statistical analysis of survival experiments.
#' \emph{The Annals of Statistics} \strong{18}:1259--1294.
#'
#' Royston, P. and Parmar, M. (2002) Flexible parametric proportional-hazards
#' and proportional-odds models for censored survival data, with application
#' to prognostic modelling and estimation of treatment effects.
#' \emph{Statistics in Medicine} \strong{21}(1):2175--2197.
#'
#' Sauerbrei, W. and Royston, P. (1999) Building multivariable prognostic and
#' diagnostic models: transformation of the predictors using fractional
#' polynomials. \emph{Journal of the Royal Statistical Society, Series A}
#' \strong{162}:71--94.
#'
#' Spiegelhalter, D., Thomas, A., Best, N., and Gilks, W. (1996) BUGS 0.5
#' Examples. MRC Biostatistics Unit, Institute of Public health, Cambridge, UK.
#'
#' Tarone, R. E. (1982) The use of historical control information in testing for
Expand Down
40 changes: 25 additions & 15 deletions R/doc-modeling-functions.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Modeling functions available in \pkg{rstanarm}
#'
#'
#' @name available-models
#'
#'
#' @section Modeling functions:
#' The model estimating functions are described in greater detail in their
#' individual help pages and vignettes. Here we provide a very brief
Expand Down Expand Up @@ -33,9 +33,16 @@
#' appropriate estimates of uncertainty for models that consist of a mix of
#' common and group-specific parameters.
#' }
#' \item{\code{\link{stan_mvmer}}}{
#' A multivariate form of \code{\link{stan_glmer}}, whereby the user can
#' specify one or more submodels each consisting of a GLM with group-specific
#' terms. If more than one submodel is specified (i.e. there is more than one
#' outcome variable) then a dependence is induced by assuming that the
#' group-specific terms for each grouping factor are correlated across submodels.
#' }
#' \item{\code{\link{stan_nlmer}}}{
#' Similar to \code{\link[lme4]{nlmer}} in the \pkg{lme4} package for
#' nonlinear "mixed-effects" models, but the group-specific coefficients
#' Similar to \code{\link[lme4]{nlmer}} in the \pkg{lme4} package for
#' nonlinear "mixed-effects" models, but the group-specific coefficients
#' have flexible priors on their unknown covariance matrices.
#' }
#' \item{\code{\link{stan_gamm4}}}{
Expand Down Expand Up @@ -68,19 +75,22 @@
#' to \code{\link[survival]{clogit}} that allow \code{stan_clogit} to accept
#' group-specific terms as in \code{\link{stan_glmer}}.
#' }
#' \item{\code{\link{stan_mvmer}}}{
#' A multivariate form of \code{\link{stan_glmer}}, whereby the user can
#' specify one or more submodels each consisting of a GLM with group-specific
#' terms. If more than one submodel is specified (i.e. there is more than one
#' outcome variable) then a dependence is induced by assuming that the
#' group-specific terms for each grouping factor are correlated across submodels.
#' \item{\code{\link{stan_surv}}}{
#' Fits models to survival (i.e. time-to-event) data using either a hazard
#' scale or accelerated failure time (AFT) formulation. The user can choose
#' between either a flexible spline-based approximation for the baseline
#' hazard or a standard parametric distributional assumption for the baseline
#' hazard. Covariate effects can then be accommodated under proportional or
#' non-proportional hazards assumptions (for models on the hazard scale) or
#' using time-fixed or time-varying acceleration factors (for models on the
#' AFT scale).
#' }
#' \item{\code{\link{stan_jm}}}{
#' Estimates shared parameter joint models for longitudinal and time-to-event
#' (i.e. survival) data. The joint model can be univariate (i.e. one longitudinal
#' outcome) or multivariate (i.e. more than one longitudinal outcome). A variety
#' of parameterisations are available for linking the longitudinal and event
#' processes (i.e. a variety of association structures).
#' Fits shared parameter joint models for longitudinal and survival (i.e.
#' time-to-event) data. The joint model can be univariate (i.e. one longitudinal
#' outcome) or multivariate (i.e. more than one longitudinal outcome). A variety
#' of parameterisations are available for linking the longitudinal and event
#' processes (i.e. a variety of association structures).
#' }
#' }
#'
Expand Down
Loading
Loading