Skip to content

Commit 4220f4f

Browse files
committed
Small fixes for the 0.1 release.
1 parent 4375ce1 commit 4220f4f

File tree

9 files changed

+50
-31
lines changed

9 files changed

+50
-31
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Package: bayesboot
22
Type: Package
33
Title: An Implementation of Rubin's (1981) Bayesian Bootstrap
44
Version: 0.1
5-
Date: 2016-01-06
5+
Date: 2016-02-09
66
Authors@R: person("Rasmus", "Bååth", email = "rasmus.baath@gmail.com", role = c("aut", "cre"))
77
Description: Functions for performing the Bayesian bootstrap as introduced by
88
Rubin (1981) and for summarizing the result. The implementation can both handle
9-
statistics that works on a weighted version of the data or that works on
10-
a resampled data set.
9+
summary statistics that works on a weighted version of the data or that works
10+
on a resampled data set.
1111
License: MIT + file LICENSE
1212
LazyData: TRUE
1313
RoxygenNote: 5.0.1

R/bayesboot.R

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) {
169169
#' abline(coef = b5[i, ], col = "grey")
170170
#' }
171171
#' @references
172-
#' Miller, R. G. (1974) The jackknife - a review. \emph{Biometrika}, \bold{61(1)}, 1--15.
172+
#' Miller, R. G. (1974) The jackknife - a review. \emph{Biometrika},
173+
#' \bold{61(1)}, 1--15.
173174
#'
174-
#' Rubin, D. B. (1981). The Bayesian bootstrap. \emph{The annals of statistics}, \bold{9(1)}, 130--134.
175+
#' Rubin, D. B. (1981). The Bayesian bootstrap. \emph{The annals of statistics},
176+
#' \bold{9(1)}, 130--134.
175177
#' @export
176178
bayesboot <- function(data, statistic, R = 4000, R2 = 4000, use.weights = FALSE,
177179
.progress = "none", .parallel = FALSE, ...) {
@@ -196,7 +198,7 @@ bayesboot <- function(data, statistic, R = 4000, R2 = 4000, use.weights = FALSE,
196198
stop("If use.weights == TRUE then statistic should take a weight vector as the second argument.")
197199
}
198200
w <- rep(1 / NROW(data), NROW(data))
199-
tryCatch(stat.result <- statistic(data, w),
201+
tryCatch(stat.result <- statistic(data, w, ...),
200202
error = function(e) {
201203
message("Applying the statistic on the original data and with uniform weights resulted in an error")
202204
stop(e)
@@ -206,7 +208,7 @@ bayesboot <- function(data, statistic, R = 4000, R2 = 4000, use.weights = FALSE,
206208
if(length(R2) != 1 || is.na(R2) || !is.wholenumber(R2) || R2 < 1) {
207209
stop("If use.weights == FALSE then R2 should be a single whole number >= 1.")
208210
}
209-
tryCatch(stat.result <- statistic(data),
211+
tryCatch(stat.result <- statistic(data, ...),
210212
error = function(e) {
211213
message("Applying the statistic on the original data resulted in an error")
212214
stop(e)
@@ -230,7 +232,7 @@ bayesboot <- function(data, statistic, R = 4000, R2 = 4000, use.weights = FALSE,
230232
boot.sample <- plyr::adply(
231233
dirichlet.weights, 1, .progress = .progress, .parallel = .parallel, .id = NULL,
232234
.fun = function(weights) {
233-
statistic(data, weights)
235+
statistic(data, weights, ...)
234236
}
235237
)
236238

@@ -318,11 +320,11 @@ print.summary.bayesboot <- function(x, ...) {
318320
cat("Call:\n", format(attr(x, "call")))
319321
}
320322

321-
#' Coerce to a bayesboot object
323+
#' Coerce to a \code{bayesboot} object
322324
#'
323-
#' This converts an object into a data frame and adds the class \code{bayesboot}.
324-
#' Doing this is only useful in the case you would want to use the \code{plot} and \code{summary} methods
325-
#' for \code{bayesboot} objects.
325+
#' This converts an object into a data frame and adds the class
326+
#' \code{bayesboot}. Doing this is only useful in the case you would want to use
327+
#' the \code{plot} and \code{summary} methods for \code{bayesboot} objects.
326328
#'
327329
#' @param object Any object that can be converted to a data frame.
328330
#'
@@ -342,12 +344,16 @@ as.bayesboot <- function(object) {
342344

343345
#' Plot the result of \code{bayesboot}
344346
#'
345-
#' Produces histograms showing the marginal posterior distributions from a \code{bayesboot} call. Using the \code{\link{plotPost}} function to produce the individual histograms.
347+
#' Produces histograms showing the marginal posterior distributions from a
348+
#' \code{bayesboot} call. Uses the \code{\link{plotPost}} function to produce
349+
#' the individual histograms.
346350
#'
347351
#' @param x The bayesboot object to plot.
348-
#' @param cred.mass the probability mass to include in credible intervals, or NULL to suppress plotting of credible intervals.
352+
#' @param cred.mass the probability mass to include in credible intervals, or
353+
#' NULL to suppress plotting of credible intervals.
349354
#' @param plots.per.page The maximum numbers of plots per page.
350-
#' @param cex,cex.lab,... Further parameters passed on to \code{\link{plotPost}}.
355+
#' @param cex,cex.lab,... Further parameters passed on to
356+
#' \code{\link{plotPost}}.
351357
#'
352358
#' @export
353359
plot.bayesboot <- function(x, cred.mass = 0.95, plots.per.page = 3, cex = 1.2, cex.lab=1.3, ...) {

R/hdi.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
#' \code{q-} prefix, eg. \code{qbeta}. Arguments required by the ICDF must be
4848
#' specified by their (abbreviated) names; see the examples.
4949
#'
50-
#' @aliases hdi hdi.default hdi.function hdi.matrix hdi.data.frame hdi.density
51-
#' hdi.mcmc.list
5250
#' @param object an object specifying the target distribution; see Details.
5351
#' @param credMass a scalar [0, 1] specifying the mass within the credible
5452
#' interval.
@@ -57,6 +55,8 @@
5755
#' @param allowSplit if TRUE and the HDI is discontinuous, the beginning and
5856
#' end of each segment are returned; see Value.
5957
#' @param \dots named parameters to be passed to other methods; see Examples.
58+
#' @aliases hdi hdi.default hdi.function hdi.matrix hdi.data.frame hdi.density
59+
#' hdi.mcmc.list
6060
#' @return a vector of length 2 or a 2-row matrix with the lower and upper
6161
#' limits of the HDI, with an attribute "credMass".
6262
#'
@@ -75,7 +75,6 @@
7575
#'
7676
#' Kruschke, J. K. (2013) Bayesian estimation supersedes the t test.
7777
#' \emph{Journal of Experimental Psychology: General}, \bold{142(2)}, 573.
78-
#' @keywords methods htest
7978
#' @examples
8079
#'
8180
#' # for a vector:

R/plotPost.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
#' The Highest Density Interval (HDI) is shown as a horizontal bar, with labels
1111
#' for the ends of the interval.
1212
#'
13-
#' \figure{plotPost1.jpg} \cr \cr \figure{plotPost2.jpg}
13+
#' \if{html}{\figure{plotPost1.jpg} }
14+
#' \if{latex}{\figure{plotPost1.jpg}{options: width=5cm}}
15+
#' \cr
16+
#' \cr
17+
#' \if{html}{\figure{plotPost2.jpg} }
18+
#' \if{latex}{\figure{plotPost2.jpg}{options: width=5cm}}
1419
#'
1520
#' If values for a ROPE are supplied, these are shown as dark red vertical
1621
#' dashed lines, together with the percentage of probability mass within the

man/as.bayesboot.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bayesboot.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/hdi.Rd

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot.bayesboot.Rd

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plotPost.Rd

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)