Skip to content

Commit 3b477a5

Browse files
committed
Merge pull request #102 from stan-dev/version-2.0.2
Version 2.1.0
2 parents 31c5d1a + 75cab62 commit 3b477a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+620
-400
lines changed

DESCRIPTION

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Package: shinystan
2-
Title: Interactive Visual and Numerical Diagnostics and Posterior Analysis for Bayesian Models
3-
Version: 2.0.1
4-
Date: 2015-09-17
2+
Title: Interactive Visual and Numerical Diagnostics and Posterior Analysis for
3+
Bayesian Models
4+
Version: 2.1.0
5+
Date: 2016-01-06
56
Authors@R: c(person("Jonah", "Gabry", role = c("aut", "cre"),
67
email = "[email protected]"),
78
person(family = "Stan Development Team", role = "ctb"),
@@ -15,28 +16,29 @@ Authors@R: c(person("Jonah", "Gabry", role = c("aut", "cre"),
1516
person("Dongying", "Song", role = "ctb"),
1617
person("Rob", "Trangucci", role = "ctb"))
1718
Maintainer: Jonah Gabry <[email protected]>
18-
Description: We provide a graphical user interface for interactive Markov chain
19-
Monte Carlo (MCMC) diagnostics and plots and tables helpful for analyzing a
20-
posterior sample. The interface is powered by RStudio's Shiny web application
21-
framework and works with the output of MCMC programs written in any
22-
programming language (and has extended functionality for Stan models fit
23-
using the rstan package and the No-U-Turn sampler).
24-
URL: https://github.com/stan-dev/shinystan, http://mc-stan.org/
25-
BugReports: https://github.com/stan-dev/shinystan/issues
26-
Depends:
19+
Description: We provide a graphical user interface for interactive Markov chain
20+
Monte Carlo (MCMC) diagnostics and plots and tables helpful for analyzing a
21+
posterior sample. The interface is powered by RStudio's Shiny web application
22+
framework and works with the output of MCMC programs written in any programming
23+
language (and has extended functionality for Stan models fit using the rstan
24+
package and the No-U-Turn sampler).
25+
URL: https://github.com/stan-dev/shinystan/, http://mc-stan.org/
26+
BugReports: https://github.com/stan-dev/shinystan/issues/
27+
Depends:
2728
R (>= 3.1.0),
2829
shiny (>= 0.12.1)
2930
License: GPL (>=3)
3031
LazyData: true
31-
Suggests:
32+
Suggests:
3233
coda,
3334
knitr (>= 1.9),
3435
rstan (>= 2.7),
36+
rmarkdown (>= 0.8.1),
3537
testthat
36-
Imports:
38+
Imports:
3739
DT (>= 0.1),
3840
dygraphs (>= 0.4.5),
39-
ggplot2 (>= 1.0.0),
41+
ggplot2 (>= 2.0.0),
4042
gridExtra,
4143
gtools,
4244
markdown (>= 0.7.4),
@@ -50,3 +52,4 @@ Imports:
5052
xtable,
5153
xts (>= 0.9-7)
5254
VignetteBuilder: knitr
55+
RoxygenNote: 5.0.1

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by roxygen2 (4.1.1): do not edit by hand
1+
# Generated by roxygen2: do not edit by hand
22

33
export(as.shinystan)
44
export(deploy_shinystan)

NEWS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# `shinystan news`
22

3+
### Version 2.1.0
4+
* Compatibility with recent ggplot2 update
5+
* Select parameters via regular expressions in parameters plot ('Estimate' page)
6+
* Fix error when selecting an entire parameter group in parameters
7+
plot ('Estimate' page)
8+
39
### Version 2.0.1
410
* Fixes small bugs and typos
511
* Adds support for stanreg objects
612
* Moves ggplot2 from Depends to Imports
713

8-
### Version 2.0.0 (major update)
14+
### Version 2.0.0 (major update, initial CRAN release)
915

1016
Version 2.0.0 has a new look, a new(ish) name, and a lot of new functionality.
1117
Many bugs have also been fixed (see GitHub issue tracker).
1218

13-
It's also now [available on CRAN](https://cran.rstudio.com/web/packages/shinystan/index.html).
19+
[Available on CRAN](https://cran.rstudio.com/web/packages/shinystan/index.html).
1420

1521
### New names
1622
* The name of the R package is **shinystan** and the app/GUI is **ShinyStan**.

R/array2shinystan.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software

R/as.shinystan.R

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software
@@ -15,10 +15,12 @@
1515

1616
#' Create and test shinystan objects
1717
#'
18+
#' @export
1819
#' @param X An object to be converted to a shinystan object. Can be
1920
#' one of the following:
2021
#' \describe{
2122
#' \item{stanfit}{An object of class stanfit (\pkg{rstan})}
23+
#' \item{stanreg}{An object of class stanreg (\pkg{rstanarm})}
2224
#' \item{mcmc.list}{An object of class \code{mcmc.list} (\pkg{coda})}
2325
#' \item{3D array}{A 3D array of posterior simulations with dimensions corresponding
2426
#' to iterations, chains, and parameters, in that order.}
@@ -35,7 +37,15 @@
3537
#'
3638
#' @details If \code{X} is a stanfit object then no additional arguments should
3739
#' be specified in \code{...} (they are taken automatically from the stanfit
38-
#' object). If \code{X} is not a stanfit object then the following arguments
40+
#' object).
41+
#'
42+
#' If \code{X} is a stanreg object the argument \code{ppd} (logical)
43+
#' can be specified indicating whether to draw from the posterior predictive
44+
#' distribution before launching ShinyStan. The default is \code{TRUE},
45+
#' although for large objects it can be wise to set it to \code{FALSE} as
46+
#' drawing from the posterior predictive distribution can be time consuming.
47+
#'
48+
#' If \code{X} is not a stanfit or stanreg object then the following arguments
3949
#' can be specified but are not required:
4050
#'
4151
#' \describe{
@@ -50,7 +60,6 @@
5060
#' }
5161
#'
5262
#' @seealso \code{\link{launch_shinystan}}, \code{\link{launch_shinystan_demo}}
53-
#' @export
5463
#'
5564
#' @examples
5665
#' \dontrun{
@@ -94,16 +103,14 @@ as.shinystan <- function(X, ...) {
94103
}
95104
X_is <- get_type(X)
96105
if (X_is == "stanfit") return(stan2shinystan(X, ...))
97-
if (X_is == "stanreg") return(stan2shinystan(X$stanfit, ...))
106+
if (X_is == "stanreg") return(stanreg2shinystan(X, ...))
98107
if (X_is == "mcmclist") return(mcmc2shinystan(X, ...))
99108
if (X_is == "chainlist") return(chains2shinystan(X, ...))
100109
if (X_is == "other") {
101110
if (!is.array(X))
102-
stop(paste(Xname, "is not a valid input type. See ?as.shinystan"),
103-
call. = FALSE)
111+
stop(paste(Xname, "is not a valid input type. See ?as.shinystan"))
104112
array2shinystan(X, ...)
105113
}
106-
107114
}
108115

109116
#' @rdname as.shinystan

R/chains2shinystan.R

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software
@@ -26,19 +26,22 @@
2626
#
2727

2828
chains2shinystan <- function(chain_list, ...) {
29-
3029
if (!is.list(chain_list)) {
3130
name <- deparse(substitute(chain_list))
3231
stop(paste(name, "is not a list."), call. = FALSE)
3332
}
34-
3533
nChain <- length(chain_list)
34+
for (i in 1:nChain) {
35+
nms <- colnames(chain_list[[i]])
36+
if (is.null(nms) || !all(nzchar(nms)))
37+
stop("Some parameters are missing names. ",
38+
"Check the column names for the matrices in your list of chains.")
39+
}
3640
if (nChain > 1) {
3741
nIter <- sapply(chain_list, nrow)
3842
same_iters <- length(unique(nIter)) == 1
3943
if (!same_iters)
4044
stop("Each chain should contain the same number of iterations.")
41-
4245
cnames <- sapply(chain_list, colnames)
4346
if (is.array(cnames)) {
4447
same_params <- identical(cnames[,1], cnames[,2])
@@ -48,8 +51,8 @@ chains2shinystan <- function(chain_list, ...) {
4851
param_names <- cnames
4952
}
5053
if (!same_params)
51-
stop("The parameters for each chain should be in the same order and have the same names.")
52-
54+
stop("The parameters for each chain should be in the same order ",
55+
"and have the same names.")
5356
nIter <- nIter[1]
5457
} else {
5558
if (nChain == 1) {
@@ -59,19 +62,14 @@ chains2shinystan <- function(chain_list, ...) {
5962
stop("You don't appear to have any chains.")
6063
}
6164
}
62-
6365
param_names <- unique(param_names)
6466
nParam <- length(param_names)
65-
6667
out <- array(NA, dim = c(nIter, nChain, nParam))
6768
for(i in 1:nChain) {
6869
out[,i,] <- chain_list[[i]]
6970
}
70-
7171
dimnames(out) <- list(iterations = NULL,
72-
chains = paste0("chain:",1:nChain),
72+
chains = paste0("chain:", 1:nChain),
7373
parameters = param_names)
74-
75-
out <- array2shinystan(out, ...)
76-
out
74+
array2shinystan(out, ...)
7775
}

R/convenience.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software

R/deploy_shinystan.R

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software
@@ -14,20 +14,19 @@
1414
# this program; if not, see <http://www.gnu.org/licenses/>.
1515

1616

17-
#' Deploy a ShinyStan app to shinyapps.io
17+
#' Deploy a ShinyStan app on the web using shinyapps.io by RStudio
1818
#'
19-
#' Requires a (free or paid) ShinyApps account. Visit
20-
#' \url{http://www.shinyapps.io/} to sign up.
19+
#' Requires a (free or paid) shinyapps.io account. Visit
20+
#' \url{http://www.shinyapps.io/} to sign up and for details on how to configure
21+
#' your account on your local system using RStudio's \pkg{rsconnect} package.
2122
#'
2223
#' @export
23-
#'
24-
#' @param sso shinystan object.
24+
#' @param sso A shinystan object.
2525
#' @param appName The name to use for the application. Application names must be
2626
#' at least four characters long and may only contain letters, numbers, dashes
2727
#' and underscores.
28-
#' @param account ShinyApps account username. Only required if more than one
29-
#' ShinyApps account is configured on the system. See
30-
#' \url{http://www.shinyapps.io/} for help configuring your account.
28+
#' @param account shinyapps.io account username. Only required if more than one
29+
#' account is configured on the system.
3130
#' @param ... Optional arguments. See Details.
3231
#'
3332
#' @details In \code{...}, the arguments \code{ppcheck_data} and
@@ -45,24 +44,23 @@
4544
#'
4645
#' @examples
4746
#' \dontrun{
48-
#' # For this example assume my_sso is the name of the shinystan object for
47+
#' # For this example assume sso is the name of the shinystan object for
4948
#' # the model you want to use. Assume also that you want to name your app
50-
#' # 'my-model' and that your ShinyApps username is 'username'.
49+
#' # 'my-model' and that your shinyapps.io username is 'username'.
5150
#'
52-
#' deploy_shinystan(sso = my_sso, appName = "my-model", account = "username")
51+
#' deploy_shinystan(sso, appName = "my-model", account = "username")
5352
#'
5453
#' # If you only have one ShinyApps account configured then you can also omit
5554
#' # the 'account' argument.
5655
#'
57-
#' deploy_shinystan(sso = my_sso, appName = "my-model")
56+
#' deploy_shinystan(sso, appName = "my-model")
5857
#' }
5958
#'
6059

6160
deploy_shinystan <- function(sso, appName, account = NULL, ...) {
6261
sso_check(sso)
6362
if (missing(appName))
64-
stop("Please specify a name for your app using the 'appName' argument",
65-
call. = FALSE)
63+
stop("Please specify a name for your app using the 'appName' argument")
6664

6765
# copy contents to temporary directory and write necessary additional lines to
6866
# ui, server, and global
@@ -93,7 +91,7 @@ deploy_shinystan <- function(sso, appName, account = NULL, ...) {
9391
# save shinystan_object to deployDir
9492
object <- sso
9593
save(object, file = file.path(deployDir, "shinystan_temp_object.RData"))
96-
deploy <- getFromNamespace("deployApp", "shinyapps")
94+
deploy <- getFromNamespace("deployApp", "rsconnect")
9795
# save ppcheck_data and set ppcheck defaults
9896
pp <- list(...)
9997
if ("ppcheck_data" %in% names(pp)) {
@@ -103,6 +101,5 @@ deploy_shinystan <- function(sso, appName, account = NULL, ...) {
103101
set_ppcheck_defaults(appDir = deployDir, yrep_name = pp$ppcheck_yrep,
104102
y_name = "y")
105103
}
106-
deploy(appDir = deployDir, appName = appName,
107-
account = account, lint = FALSE)
104+
deploy(appDir = deployDir, appName = appName, account = account, lint = TRUE)
108105
}

R/eight_schools.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software

R/generate_quantity.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is part of shinystan
2-
# Copyright (C) Jonah Gabry
2+
# Copyright (C) 2015 Jonah Gabry
33
#
44
# shinystan is free software; you can redistribute it and/or modify it under the
55
# terms of the GNU General Public License as published by the Free Software
@@ -16,16 +16,18 @@
1616

1717
#' Add to shinystan object a new parameter as a function of one or two
1818
#' existing parameters
19-
#'
19+
#'
20+
#' @export
2021
#' @param sso shinystan object.
2122
#' @param fun Function to call, i.e. \code{function(param1)} or
2223
#' \code{function(param1,param2)}. See \strong{Examples}, below.
2324
#' @param param1 Name of first parameter as character string.
2425
#' @param param2 Optional. Name of second paramter as character string.
2526
#' @param new_name Name for the new parameter as character string.
27+
#'
2628
#' @return sso, updated. See Examples.
29+
#'
2730
#' @seealso \code{\link{as.shinystan}}
28-
#' @export
2931
#'
3032
#' @examples
3133
#' \dontrun{

0 commit comments

Comments
 (0)