Permalink
Browse files

Merge branch 'develop'

# Conflicts:
#	README.md

[ci skip]
  • Loading branch information...
jgabry committed Apr 29, 2018
2 parents 7bbcddd + 2182c75 commit d8ed1b13295cc18c96e5bf7c2b29997ff3fb01d3
View
@@ -1,5 +1,7 @@
language: r
r: devel
r:
- release
- devel
cache: packages
r_github_packages:
View
30 NEWS.md
@@ -1,37 +1,47 @@
### Version 2.4.0
# shinystan 2.5.0
* New website with online documentation: http://mc-stan.org/shinystan
* Fixed problem with extracting info from fits reconstructed from CSV files (#128,#158), thanks to @martinmodrak
# shinystan 2.4.0
* `launch_shinystan` is now an S3 generic with methods. This allows developers
of packages that use __shinystan__ to create their own `launch_shinystan`
methods instead of using a different function name or creating a naming
conflict.
### Version 2.3.0
# shinystan 2.3.0
#### Fixes
### Fixes
* Fix various issues resulting in errors for models fit using static HMC (thanks
to Cole Monnahan).
* Deprecate `burnin` argument to `as.shinystan`. Use `warmup` instead. Only
relevant for models _not_ fit using Stan.
#### New features
### New features
* Add NUTS energy diagnostic plots to Diagnose page
* Allowing passing `sampler_params` to `as.shinystan`. This makes it possible to
display sampler diagnositcs for HMC/NUTS even if not using Stan's implementation
of those algorithms (thanks to Cole Monnahan).
### Version 2.2.1
# shinystan 2.2.1
* Better compatibility with latest releases of 'shinyjs' and 'DT' packages
* `shinystan::launch_shinystan_demo()` now works without first having to load
the package with a call to `library`
* Unless running on a server, the app now stops running when browser tab is
closed
### Version 2.2.0-1
# shinystan 2.2.0-1
* Fix bug in `deploy_shinystan` preventing some ShinyStan apps from being
deployed
### Version 2.2.0
# shinystan 2.2.0
* Add optional argument `pars` to the `as.shinystan` method for stanfit objects,
allowing a subset of parameters to be selected for inclusion in the resulting
shinystan object.
@@ -48,18 +58,18 @@ be used to ensure that old shinystan objects have an internal structure
compatible with this release.
* Improve line coverage of api tests
### Version 2.1.0
# shinystan 2.1.0
* Compatibility with recent ggplot2 update
* Select parameters via regular expressions in parameters plot ('Estimate' page)
* Fix error when selecting an entire parameter group in parameters
plot ('Estimate' page)
### Version 2.0.1
# shinystan 2.0.1
* Fixes small bugs and typos
* Adds support for stanreg objects
* Moves ggplot2 from Depends to Imports
### Version 2.0.0 (major update, initial CRAN release)
# shinystan 2.0.0 (major update, initial CRAN release)
Version 2.0.0 has a new look, a new(ish) name, and a lot of new functionality.
Many bugs have also been fixed (see GitHub issue tracker).
View
@@ -35,7 +35,9 @@
#' @template seealso-as.shinystan
#' @template seealso-update_sso
#' @template seealso-demo
#'
#'
#' @template reference-muth
#' @template reference-bayesvis
#'
#' @examples
#' \dontrun{
View
@@ -40,6 +40,8 @@
#' @template seealso-generate_quantity
#' @seealso \code{\link{shinystan-metadata}} to view or change metadata
#' associated with a \code{shinystan} object.
#'
#' @template reference-muth
#'
shinystan <- setClass(
Class = "shinystan",
@@ -570,7 +572,7 @@ setMethod(
model_code = rstan::get_stancode(X),
misc = list(
max_td = .rstan_max_treedepth(X),
stan_method = .stan_args(X, "method"),
stan_method = .stan_method(X),
stan_algorithm = .stan_algorithm(X),
sso_version = utils::packageVersion("shinystan")
)
@@ -615,6 +617,22 @@ setMethod(
isTRUE("engine" %in% names(.stan_args(x)))
}
# Check if model was restored from a CSV file generated by rstan
# @param x stanfit object
.from_rstan_csv <- function(x) {
isTRUE("sampler_t" %in% names(.stan_args(x)))
}
#Get the stan method (variatinal, sampling,optimization)
.stan_method <- function(x) {
if(.from_rstan_csv(x)) {
"sampling" #I assume there is no way to generate sample file withou sampling
} else {
.stan_args(x, "method")
}
}
# Check if model fit using variational algorithm
# @param x stanfit object
.used_vb <- function(x) {
@@ -624,8 +642,14 @@ setMethod(
# Check which algorithm was used to fit model
# @param x stanfit object
.stan_algorithm <- function(x) {
algo <- if (.from_cmdstan(x))
toupper(.stan_args(x, "engine")) else .stan_args(x, "algorithm")
algo <- if (.from_cmdstan(x)) {
toupper(.stan_args(x, "engine"))
} else if (.from_rstan_csv(x)) {
#When reading the CSV, the engine is of the form NUTS(diag_e) - getting rid of the brackets here
gsub("\\([^)]*\\)","",.stan_args(x, "sampler_t"))
} else {
.stan_args(x, "algorithm")
}
if (.used_vb(x) || !(algo %in% c("NUTS", "HMC")))
warning("Many features are only available for models fit using
View
@@ -11,7 +11,7 @@
# this program; if not, see <http://www.gnu.org/licenses/>.
#' 'ShinyStan' interface and \code{shinystan} R package
#' \pkg{shinystan} R package ('ShinyStan' graphical user interface)
#'
#' @docType package
#' @name shinystan-package
@@ -22,25 +22,27 @@
#' \emph{Stan Development Team}
#' }
#'
#' Applied Bayesian data analysis is primarily implemented through the Markov
#' chain Monte Carlo (MCMC) algorithms offered by various software packages.
#' When analyzing a posterior sample obtained by one of these algorithms the
#' Applied Bayesian data analysis is primarily implemented through the Markov
#' chain Monte Carlo (MCMC) algorithms offered by various software packages.
#' When analyzing a posterior sample obtained by one of these algorithms the
#' first step is to check for signs that the chains have converged to the target
#' distribution and and also for signs that the algorithm might require tuning
#' or might be ill-suited for the given model. There may also be theoretical
#' distribution and and also for signs that the algorithm might require tuning
#' or might be ill-suited for the given model. There may also be theoretical
#' problems or practical inefficiencies with the specification of the model. The
#' 'ShinyStan' app provides interactive plots and tables helpful for analyzing a
#' ShinyStan app provides interactive plots and tables helpful for analyzing a
#' posterior sample, with particular attention to identifying potential problems
#' with the performance of the MCMC algorithm or the specification of the model.
#' 'ShinyStan' is powered by the 'Shiny' web application framework by 'RStudio'
#' and works with the output of MCMC programs written in any programming
#' language (and has extended functionality for models fit using the \pkg{rstan}
#' package and the No-U-Turn sampler).
#' ShinyStan is powered by the Shiny web application framework by RStudio
#' (\url{http://shiny.rstudio.com/}) and works with the output of MCMC programs
#' written in any programming language (and has extended functionality for
#' models fit using the \pkg{rstan} package and the No-U-Turn sampler).
#'
#' @section 'ShinyStan' has extended functionality for 'Stan' models:
#' @section ShinyStan has extended functionality for Stan models:
#'
#' 'Stan' (\url{http://mc-stan.org}) models can be run in \R using the
#' \pkg{\link[rstan]{rstan}} and \pkg{\link[rstanarm]{rstanarm}} packages.
#' Stan (\url{http://mc-stan.org}) models can be run in \R using the
#' \pkg{\link[rstan]{rstan}} package. Other packages like
#' \pkg{\link[rstanarm]{rstanarm}} and \pkg{\link[brms]{brms}} provide
#' higher-level interfaces to Stan that use \pkg{rstan} internally.
#'
#' @section Saving and sharing:
#'
@@ -52,7 +54,7 @@
#' publication.
#'
#' The \code{\link{deploy_shinystan}} function lets you easily deploy your own
#' 'ShinyStan' apps online for any of your models using the shinyapps.io
#' ShinyStan apps online for any of your models using the shinyapps.io
#' service from 'RStudio'. Each of your apps (each of your models) will have a
#' unique url and will be compatible with most web browsers.
#'
@@ -66,15 +68,20 @@
#' Check out the demo using \code{\link{launch_shinystan_demo}} or try it with
#' one of your own models using \code{\link{launch_shinystan}}.
#'
#' @section Help and bug reports:
#' @section Resources:
#' \itemize{
#' \item 'Stan' forums (\url{http://discourse.mc-stan.org})
#' \item 'ShinyStan' issue tracker (\url{https://github.com/stan-dev/shinystan/issues})
#' \item Web page with online documentation
#' (\url{http://mc-stan.org/shinystan})
#' \item Stan Forums on Discourse (\url{http://discourse.mc-stan.org})
#' \item GitHub issue tracker (\url{https://github.com/stan-dev/shinystan/issues})
#' }
#'
#' @template seealso-as.shinystan
#' @template seealso-demo
#' @template seealso-launch
#'
#' @template reference-muth
#' @template reference-bayesvis
#'
#' @import ggplot2
#' @import methods
View
@@ -1,6 +1,4 @@
<a href="http://mc-stan.org">
<img src="https://raw.githubusercontent.com/stan-dev/logos/master/logo.png" width=200 alt="Stan Logo"/>
</a>
[<img src="https://raw.githubusercontent.com/stan-dev/logos/master/logo_tm.png" width=100 alt="Stan Logo"/>](http://mc-stan.org)
# ShinyStan
@@ -15,6 +13,12 @@ MCMC simulations. The ShinyStan interface is coded primarily in R using
the [Shiny](http://shiny.rstudio.com) web application framework and is
available via the **shinystan** R package.
### Resources
* [mc-stan.org/shinystan](http://mc-stan.org/shinystan) (Website with online documentation)
* [Ask a question](http://discourse.mc-stan.org) (Stan Forums on Discourse)
* [Open an issue](https://github.com/stan-dev/shinystan/issues) (GitHub issues for bug reports, feature requests)
### Installation
* Install from CRAN:
@@ -23,13 +27,12 @@ available via the **shinystan** R package.
install.packages("shinystan")
```
If this fails, try adding the arguments `type='source'` and/or `repos='http://cran.rstudio.com'`.
* Install from GitHub (requires [devtools](https://github.com/hadley/devtools) package):
* Install from GitHub (requires [devtools](https://github.com/r-lib/devtools) package):
```r
if (!require("devtools"))
if (!require("devtools")) {
install.packages("devtools")
}
devtools::install_github("stan-dev/shinystan", build_vignettes = TRUE)
```
@@ -77,12 +80,8 @@ which lets you easily deploy your own ShinyStan apps online using RStudio's
your models. Each of your apps (each of your models) will have a unique url
and is compatible with Safari, Firefox, Chrome, and most other browsers.
#### Get help or submit bug report
* [Ask a question at The Stan Forums](http://discourse.mc-stan.org)
* [ShinyStan issue tracker](https://github.com/stan-dev/shinystan/issues)
#### Licensing
### Licensing
The **shinystan** R package and ShinyStan interface are open source licensed under
the GNU Public License, version 3 (GPLv3).
@@ -0,0 +1,4 @@
#' @references Gabry, J., Simpson, D., Vehtari, A., Betancourt, M., and Gelman,
#' A. (2018). Visualization in Bayesian workflow. \emph{Journal of the Royal
#' Statistical Society Series A}, accepted for publication. arXiv preprint:
#' \url{http://arxiv.org/abs/1709.01449}.
@@ -0,0 +1,5 @@
#' @references
#' Muth, C., Oravecz, Z., and Gabry, J. (2018)
#' User-friendly Bayesian regression modeling: A tutorial with rstanarm and shinystan.
#' \emph{The Quantitative Methods for Psychology}. 14(2), 99--119.
#' \url{https://www.tqmp.org/RegularArticles/vol14-2/p099/p099.pdf}
View
Binary file not shown.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit d8ed1b1

Please sign in to comment.