diff --git a/.Rbuildignore b/.Rbuildignore index ecdbd1ed8..13b7ffafc 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -22,3 +22,4 @@ dev-notes/* revdep/* ^\.github$ +^_pkgdown\.yml$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 000000000..877722477 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,52 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib actions#where-to-find-help +on: + # build dev site on merged pushes + push: + branches: [main, master] + # build full site on releases + release: + types: [published] + workflow_dispatch: + +name: pkgdown.yaml + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + cancel-in-progress: true + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::., stan-dev/pkgdown-config + + - name: Build site + run: | + pkgdown::build_site_github_pages( + lazy = FALSE, # change to TRUE if runner times out. + run_dont_run = TRUE, + new_process = TRUE + ) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + clean: false + branch: gh-pages + folder: docs \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index 22c38c418..4fd1eefc3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,32 @@ +# rstanarm v2.32.2 + +* Update recommendations for responding to convergence warnings by @jgabry in https://github.com/stan-dev/rstanarm/pull/617 +* Replace Stan R Packages repo with R-Universe by @andrjohns in https://github.com/stan-dev/rstanarm/pull/624 +* Fix mistaken ')' alignment in output test by @MichaelChirico in https://github.com/stan-dev/rstanarm/pull/636 +* Default to not computing r_eff for loo by @jgabry in https://github.com/stan-dev/rstanarm/pull/638 +* migrate formula machinery from lme4 to reformulas by @bbolker in https://github.com/stan-dev/rstanarm/pull/639 +* Fix documentations to address CRAN NOTEs by @yoshidk6 in https://github.com/stan-dev/rstanarm/pull/641 +* Use vectorized abs() by @HPCurtis in https://github.com/stan-dev/rstanarm/pull/632 +* Use rstantools - Fix Build/Export Errors by @andrjohns in https://github.com/stan-dev/rstanarm/pull/625 + +# rstanarm v2.32.1 + +* Avoid error for 1-D unit_vector by @jgabry in https://github.com/stan-dev/rstanarm/pull/606 +* Update .set_nreps by @avehtari in https://github.com/stan-dev/rstanarm/pull/612 +* Use LTO during compilation + + +# rstanarm 2.26.1 + +This release updates rstanarm to use the latest syntax supported by rstan. + +* wells dataset wrong variable name by @storopoli in https://github.com/stan-dev/rstanarm/pull/552 +* add logo to be displayed in r-universe by @avehtari in https://github.com/stan-dev/rstanarm/pull/569 +* Fix CRAN NOTEs and failures by @andrjohns in https://github.com/stan-dev/rstanarm/pull/587 +* Implement posterior::as_draws() for rstanarm objects by @jgabry in https://github.com/stan-dev/rstanarm/pull/596 +* Array syntax by @bgoodri in https://github.com/stan-dev/rstanarm/pull/597 + + # rstanarm 2.21.3 ### Bug fixes diff --git a/R/doc-rstanarm-package.R b/R/doc-rstanarm-package.R index 542e213b6..9abc30957 100644 --- a/R/doc-rstanarm-package.R +++ b/R/doc-rstanarm-package.R @@ -37,7 +37,7 @@ #' #' @description #' \if{html}{ -#' \figure{stanlogo.png}{options: width="50" alt="https://mc-stan.org/about/logo/"} +#' \figure{logo.svg}{options: width="50" alt="https://mc-stan.org/about/logo/"} #' \emph{Stan Development Team} #' } #' diff --git a/R/pp_validate.R b/R/pp_validate.R index ab3fe09a5..d284c3a72 100644 --- a/R/pp_validate.R +++ b/R/pp_validate.R @@ -92,7 +92,7 @@ #' } #' } #' @importFrom ggplot2 rel geom_point geom_segment scale_x_continuous element_line -#' +#' @keywords internal pp_validate <- function(object, nreps = 20, seed = 12345, ...) { # based on Samantha Cook's BayesValidate::validate quant <- function(draws) { diff --git a/R/stan_betareg.R b/R/stan_betareg.R index d4bb3b03d..9284848f6 100644 --- a/R/stan_betareg.R +++ b/R/stan_betareg.R @@ -17,7 +17,7 @@ #' Bayesian beta regression models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Beta regression modeling with optional prior distributions for the #' coefficients, intercept, and auxiliary parameter \code{phi} (if applicable). #' diff --git a/R/stan_biglm.R b/R/stan_biglm.R index b9602fccf..b0c598675 100644 --- a/R/stan_biglm.R +++ b/R/stan_biglm.R @@ -17,7 +17,7 @@ #' Bayesian regularized linear but big models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' This is the same model as with \code{\link{stan_lm}} but it utilizes the #' output from \code{\link[biglm]{biglm}} in the \pkg{biglm} package in order to #' proceed when the data is too large to fit in memory. @@ -92,4 +92,3 @@ stan_biglm <- function(biglm, xbar, ybar, s_y, ..., prior_PD = prior_PD, algorithm = match.arg(algorithm), adapt_delta = adapt_delta) } - diff --git a/R/stan_clogit.R b/R/stan_clogit.R index cb68dc3bc..ac2dec7b4 100644 --- a/R/stan_clogit.R +++ b/R/stan_clogit.R @@ -17,7 +17,7 @@ #' Conditional logistic (clogit) regression models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' A model for case-control studies with optional prior distributions for the #' coefficients, intercept, and auxiliary parameters. #' diff --git a/R/stan_gamm4.R b/R/stan_gamm4.R index 0583cb823..a6380c845 100644 --- a/R/stan_gamm4.R +++ b/R/stan_gamm4.R @@ -19,7 +19,7 @@ #' Bayesian generalized linear additive models with optional group-specific #' terms via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for GAMMs with flexible priors. #' #' @export diff --git a/R/stan_glm.R b/R/stan_glm.R index 8693b093c..3b9d92b31 100644 --- a/R/stan_glm.R +++ b/R/stan_glm.R @@ -17,7 +17,7 @@ #' Bayesian generalized linear models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Generalized linear modeling with optional prior distributions for the #' coefficients, intercept, and auxiliary parameters. #' diff --git a/R/stan_glmer.R b/R/stan_glmer.R index dfa9c27f6..b4a238153 100644 --- a/R/stan_glmer.R +++ b/R/stan_glmer.R @@ -17,7 +17,7 @@ #' Bayesian generalized linear models with group-specific terms via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for GLMs with group-specific coefficients that have #' unknown covariance matrices with flexible priors. #' diff --git a/R/stan_jm.R b/R/stan_jm.R index b1f0ee2d6..2e3998fb4 100644 --- a/R/stan_jm.R +++ b/R/stan_jm.R @@ -18,7 +18,7 @@ #' Bayesian joint longitudinal and time-to-event models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Fits a shared parameter joint model for longitudinal and time-to-event #' (e.g. survival) data under a Bayesian framework using Stan. #' @@ -650,4 +650,3 @@ stan_jm <- function(formulaLong, dataLong, formulaEvent, dataEvent, time_var, out <- stanmvreg(fit) return(out) } - diff --git a/R/stan_lm.R b/R/stan_lm.R index 825d581d8..576066f0c 100644 --- a/R/stan_lm.R +++ b/R/stan_lm.R @@ -17,7 +17,7 @@ #' Bayesian regularized linear models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for linear modeling with regularizing priors on the model #' parameters that are driven by prior beliefs about \eqn{R^2}, the proportion #' of variance in the outcome attributable to the predictors. See diff --git a/R/stan_mvmer.R b/R/stan_mvmer.R index 9c3b81c31..e9a58bab9 100644 --- a/R/stan_mvmer.R +++ b/R/stan_mvmer.R @@ -19,7 +19,7 @@ #' Bayesian multivariate generalized linear models with correlated #' group-specific terms via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for multivariate GLMs with group-specific coefficients #' that are assumed to be correlated across the GLM submodels. #' @@ -209,4 +209,3 @@ stan_mvmer <- function(formula, data, family = gaussian, weights, out <- stanmvreg(fit) return(out) } - diff --git a/R/stan_nlmer.R b/R/stan_nlmer.R index a215551aa..bbde44d52 100644 --- a/R/stan_nlmer.R +++ b/R/stan_nlmer.R @@ -17,7 +17,7 @@ #' Bayesian nonlinear models with group-specific terms via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for NLMMs with group-specific coefficients that have #' unknown covariance matrices with flexible priors. #' diff --git a/R/stan_polr.R b/R/stan_polr.R index ebfbc9b08..96439f6f9 100644 --- a/R/stan_polr.R +++ b/R/stan_polr.R @@ -18,7 +18,7 @@ #' Bayesian ordinal regression models via Stan #' -#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}} +#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}} #' Bayesian inference for ordinal (or binary) regression models under a #' proportional odds assumption. #' diff --git a/R/stan_polr.fit.R b/R/stan_polr.fit.R index a26a4bb20..736fe5cb8 100644 --- a/R/stan_polr.fit.R +++ b/R/stan_polr.fit.R @@ -191,4 +191,3 @@ summarize_polr_prior <- function(prior, prior_counts, shape=NULL, rate=NULL) { return(prior_list) } - diff --git a/README.md b/README.md index 7e63ba1e0..2692261e3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rstanarm +# rstanarm [![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/rstanarm?color=blue)](https://cran.r-project.org/package=rstanarm) diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 000000000..21a5856d9 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,107 @@ +url: https://mc-stan.org/rstanarm + +destination: "." + +development: + mode: auto + +template: + package: pkgdownconfig + +navbar: + title: "rstanarm" + + structure: + left: [home, vignettes, functions, news, pkgs, stan] + right: [search, bluesky, forum, github, lightswitch] + + components: + pkgs: + text: Other Packages + menu: + - text: bayesplot + href: https://mc-stan.org/bayesplot + - text: cmdstanr + href: https://mc-stan.org/cmdstanr + - text: loo + href: https://mc-stan.org/loo + - text: posterior + href: https://mc-stan.org/posterior + - text: projpred + href: https://mc-stan.org/projpred + - text: rstan + href: https://mc-stan.org/rstan + - text: rstantools + href: https://mc-stan.org/rstantools + - text: shinystan + href: https://mc-stan.org/shinystan + +articles: + - title: "Getting Started" + desc: > + These vignettes provide a preliminary introduction to rstanarm and + discuss the prior distributions available. + contents: + - rstanarm + - priors + - title: "Modeling functions" + desc: > + These vignettes provide instructions on how to use the modeling + functions in rstanarm. + contents: + - binomial + - count + - continuous + - aov + - lm + - betareg + - polr + - glmer + - jm + - title: "Additional tutorials on specific modeling techniques and applications" + desc: > + These vignettes provide additional tutorials on using rstanarm + for specific purposes once you are comfortable using the package + in general. + contents: + - mrp + - pooling + - ab-testing + +reference: + - title: "About rstanarm" + desc: > + These pages provides a summary of the functionality available in rstanarm. + contents: + - rstanarm-package + - available-models + - available-algorithms + - title: "Fitting models" + desc: > + Functions for model fitting. + contents: + - starts_with("stan_") + - priors + - title: "Methods" + desc: > + Functions to work with fitted model objects. + contents: + - stanreg-objects + - ends_with("stanreg") + - starts_with("posterior_") + - ps_check + - ends_with("stanmvreg") + - ends_with("stanjm") + - title: "Additional documentation" + desc: > + Misc. other help pages. + contents: + - rstanarm-datasets + - example_model + - example_jm + - stanreg_list + - adapt_delta + - QR-argument + - neg_binomial_2 + - rstanarm-deprecated + - logit diff --git a/man/figures/logo.svg b/man/figures/logo.svg index b4c09fc5d..496f04025 100644 --- a/man/figures/logo.svg +++ b/man/figures/logo.svg @@ -1,96 +1 @@ - - - - + \ No newline at end of file diff --git a/man/figures/stanlogo.png b/man/figures/stanlogo.png deleted file mode 100644 index 4a4f06aa9..000000000 Binary files a/man/figures/stanlogo.png and /dev/null differ diff --git a/man/pp_validate.Rd b/man/pp_validate.Rd index 5027f3f6e..0a2672a50 100644 --- a/man/pp_validate.Rd +++ b/man/pp_validate.Rd @@ -85,3 +85,4 @@ distribution. \code{\link[bayesplot:bayesplot-colors]{color_scheme_set}} to change the color scheme of the plot. } +\keyword{internal} diff --git a/man/rstanarm-datasets.Rd b/man/rstanarm-datasets.Rd index 7659f5091..70c617b01 100644 --- a/man/rstanarm-datasets.Rd +++ b/man/rstanarm-datasets.Rd @@ -189,7 +189,7 @@ generalizations. \emph{Journal of the American Statistical Association} Gelman, A. and Hill, J. (2007). \emph{Data Analysis Using Regression and Multilevel/Hierarchical Models.} Cambridge University Press, - Cambridge, UK. \url{https://stat.columbia.edu/~gelman/arm/} + Cambridge, UK. \url{https://sites.stat.columbia.edu/gelman/arm/} Spiegelhalter, D., Thomas, A., Best, N., & Gilks, W. (1996) BUGS 0.5 Examples. MRC Biostatistics Unit, Institute of Public health, Cambridge, UK. diff --git a/man/rstanarm-package.Rd b/man/rstanarm-package.Rd index e608213ee..acaae097f 100644 --- a/man/rstanarm-package.Rd +++ b/man/rstanarm-package.Rd @@ -197,11 +197,11 @@ mixed-Effects models using lme4. \emph{Journal of Statistical Software}. Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., and Rubin, D. B. (2013). \emph{Bayesian Data Analysis.} Chapman & Hall/CRC - Press, London, third edition. \url{https://stat.columbia.edu/~gelman/book/} + Press, London, third edition. \url{https://sites.stat.columbia.edu/gelman/book/} Gelman, A. and Hill, J. (2007). \emph{Data Analysis Using Regression and Multilevel/Hierarchical Models.} Cambridge University Press, - Cambridge, UK. \url{https://stat.columbia.edu/~gelman/arm/} + Cambridge, UK. \url{https://sites.stat.columbia.edu/gelman/arm/} Stan Development Team. \emph{Stan Modeling Language Users Guide and Reference Manual.} \url{https://mc-stan.org/users/documentation/}. @@ -242,7 +242,7 @@ User-friendly Bayesian regression modeling: A tutorial with rstanarm and shinyst Authors: \itemize{ - \item Jonah Gabry \email{jsg2201@columbia.edu} + \item Jonah Gabry \email{jgabry@gmail.com} } Other contributors: diff --git a/vignettes/lm.Rmd b/vignettes/lm.Rmd index 497195b57..c704908d0 100644 --- a/vignettes/lm.Rmd +++ b/vignettes/lm.Rmd @@ -250,7 +250,9 @@ clouds_cf$seeding[] <- "yes" y1_rep <- posterior_predict(post, newdata = clouds_cf) clouds_cf$seeding[] <- "no" y0_rep <- posterior_predict(post, newdata = clouds_cf) -qplot(x = c(y1_rep - y0_rep), geom = "histogram", xlab = "Estimated ATE") +ggplot(data.frame(x = c(y1_rep - y0_rep))) + + geom_histogram(aes(x)) + + labs(x = "Estimated ATE", y = NULL) ``` As can be seen, the treatment effect is not estimated precisely and is as @@ -283,17 +285,18 @@ __loo__ package. ```{r lm-clouds-loo, warning=TRUE} (loo_post <- loo(post)) -loo_compare(loo_post, loo(simple)) +(loo_simple <- loo(simple)) +loo_compare(loo_post, loo_simple) ``` The results indicate that the first approach is expected to produce better out-of-sample predictions but the Warning messages are at least as important. -Many of the estimated shape parameters for the Generalized Pareto distribution -are above $0.5$ in the model with Cauchy priors, which indicates that these +Some of the estimated shape parameters for the Generalized Pareto distribution +are above $0.7$ in the model with Cauchy priors, which indicates that these estimates are only going to converge slowly to the true out-of-sample deviance measures. Thus, with only $24$ observations, they should not be considered reliable. The more complicated prior derived above is stronger --- as -evidenced by the fact that the effective number of parameters is about half +evidenced by the fact that the effective number of parameters `p_loo` is about half of that in the simpler approach and $12$ for the maximum likelihood estimator --- and only has a few of the $24$ Pareto shape estimates in the "danger zone". We might want to reexamine these observations