Skip to content

Commit

Permalink
prepare for release of version 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Jun 29, 2015
1 parent 3eceaab commit aa02a64
Show file tree
Hide file tree
Showing 29 changed files with 74 additions and 54 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: brms
Type: Package
Title: Bayesian Regression Models using Stan
Version: 0.2.0.9000
Date: 2015-05-26
Version: 0.3.0
Date: 2015-06-29
Authors@R: person("Paul-Christian", "Buerkner", email = "[email protected]",
role = c("aut", "cre"))
Depends: R (>= 3.1.0), ggplot2 (>= 1.0.1), Rcpp (>= 0.11.5)
Imports: methods, stats, abind, parallel (>= 3.1.3), coda (>= 0.17-1), ggmcmc (>= 0.6), gridExtra (>= 0.9.1)
Suggests: rstan (>= 2.6.0), R2jags (>= 0.05-03), testthat (>= 0.9.1)
Description: Fit Bayesian generalized linear and ordinal mixed models using Stan for full Bayesian inference.
Description: Fit Bayesian generalized linear mixed models using Stan for full Bayesian inference.
LazyData: true
NeedsCompilation: no
License: GPL (>= 2)
Expand Down
9 changes: 5 additions & 4 deletions News.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ title: "News"
output: html_document
---

# brms 0.2.0.9000
# brms 0.3.0
----------------------------------------------------------------

* introduced new methods 'par.names' and 'posterior.samples' for class 'brmsfit' to extract parameter names and posterior samples for given parameters.
* introduced new methods 'par.names' and 'posterior.samples' for class 'brmsfit' to extract parameter names and posterior samples for given parameters, respectively.
* introduced new method 'hypothesis' for class 'brmsfit' allowing to test non-linear hypotheses concerning fixed effects
* introduced new argument 'addition' in function brm to get a more flexible approach in specifying additional information on the response variable (e.g., standard errors for meta-analysis). Alternatively, this information can also be passed to the formula argument directly.
* introduced weighted and censored regressions through argument 'addition' of function brm
* introduced new argument 'cov.ranef' in function brm allowing for customized covariance structures of random effects
* amended parametrization of random effects to increase efficiency of the sampling algorithms
* improved vectorization of sampling statements
* introduced new argument 'autocor' in function brm allowing for autocorrelation of the response variable.
* introduced new functions 'cor.ar', 'cor.ma', and 'cor.arma', to be used with argument 'autocor' for modeling autoregressive, moving-average, and autoregressive-moving-average models.
* amended parametrization of random effects to increase efficiency of the sampling algorithms
* improved vectorization of sampling statements
* fixed a bug that could cause an error when fitting poisson models while predict = TRUE
* fixed a bug that caused an error when sampling only one chain while silent = TRUE

Expand Down
2 changes: 2 additions & 0 deletions R/extract.old.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#'
#' @return NULL
#'
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @import ggplot2
#' @export
brm.plot <- function(fit, family = "^[^(r_)]") {
Expand Down
16 changes: 10 additions & 6 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@
#' @return An object of class \code{brmsfit}, which contains the posterior samples along with many other useful information about the model.
#' If rstan is not installed, \code{brmsfit} will not contain posterior samples.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @details Fit a generalized linear mixed model, which incorporates both fixed-effects parameters and random effects in a linear predictor
#' via full bayesian inference using Stan. During warmup aka burnin phase, Stan may print out quite a few informational
#' messages that \code{"the current Metropolis proposal is about the be rejected ..."}. These messages can be ignored in nearly all cases.
#' messages that \cr
#' \code{"the current Metropolis proposal is about the be rejected ..."}. \cr
#' These messages can be ignored in nearly all cases.
#' Use \code{silent = TRUE} to stop these messages from being printed out. \cr
#'
#' \bold{Formula syntax}
Expand All @@ -84,7 +86,7 @@
#' using the formulae \code{yi | se(sei) ~ 1} and \code{yi | se(sei) ~ 1 + (1|study)}, respectively, where
#' \code{study} is a variable uniquely identifying every study.
#' If desired, meta-regressen can be performed via \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1|study)}
#' or \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1 + mod1 + mod2|study)}, where
#' or \cr \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1 + mod1 + mod2|study)}, where
#' \code{mod1} and \code{mod2} represent moderator variables.
#'
#' For all families, weighted regression may be performed using
Expand All @@ -102,9 +104,11 @@
#'
#' With the expection of \code{categorical} and ordinal families, left and right censoring can be modeled through \code{yi | cens(censored) ~ predictors}.
#' The censoring variable (named \code{censored} in this example) should contain the values \code{'left'}, \code{'none'}, and \code{'right'}
#' (or equivalenty -1, 0, and 1) to indicate that the corresponding observation is left censored, not censored, or right censored. \cr
#' (or equivalenty -1, 0, and 1) to indicate that the corresponding observation is left censored, not censored, or right censored.
#'
#' Mutiple \code{addition} terms may be specified at the same time, for instance \code{yi | se(sei) | cens(censored) ~ 1} for a censored meta-analytic model.
#' Mutiple \code{addition} terms may be specified at the same time, for instance \cr
#' \code{formula = yi | se(sei) | cens(censored) ~ 1} for a censored meta-analytic model, equivalent to
#' \code{formula = yi ~ 1} and \code{addition = list(se = ~sei, cens = ~censored)} when using argument \code{addition}. \cr
#'
#' \bold{Families and link functions}
#'
Expand Down Expand Up @@ -159,7 +163,7 @@
#'
#' The autocorrelation parameters currently implemented are named \code{ar} (autoregression) and \code{ma} (moving average).
#' The default prior for autocorrelation parameters is an improper flat prior over the reals. It should be noted that \code{ar} will
#' only take one values between -1 and 1 if the response variable is wide-sence stationay, i.e. if there is no drift in the responses.
#' only take one values between -1 and 1 if the response variable is wide-sence stationay, i.e. if there is no drift in the responses. \cr
#'
#' 3. Standard deviations of random effects
#'
Expand Down
6 changes: 3 additions & 3 deletions R/s3.correlations.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'
#' @return An object of class \code{cor.arma}, representing an autoregression-moving average correlation structure.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' cor.arma(~visit|patient, p = 2, q = 2)
Expand Down Expand Up @@ -43,7 +43,7 @@ cor.arma <- function(formula = ~ 1, p = 0, q = 0) {
#'
#' @return An object of class \code{cor.arma} containing solely autoregression terms.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @seealso \code{\link{cor.arma}}
#'
Expand All @@ -67,7 +67,7 @@ cor.ar <- function(formula = ~ 1, p = 1) {
#'
#' @return An object of class \code{cor.arma} containing solely moving average terms.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @seealso \code{\link{cor.arma}}
#'
Expand Down
14 changes: 7 additions & 7 deletions R/s3.generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ brmssummary <- function(formula = NULL, family = "", link = "", data.name = "",
#'
#' @return A matrix with one row per fixed effect and one column per calculated estimate.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -67,7 +67,7 @@ fixef <- function(x, estimate = "mean", ...)
#' @return A list of matrices (one per grouping factor), each with one row per level
#' and one single column for the estimate (either mean or median).
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -104,7 +104,7 @@ ranef <- function(x, estimate = "mean", var = FALSE, center.zero = TRUE, ...)
#' @return A list of lists (one per grouping factor), each containing 3 elements:
#' a matrix containing the standard deviations, a list of correlation matrices, and a list of covariance matrices.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -133,7 +133,7 @@ VarCorr <- function(x, estimate = "mean", as.list = TRUE, ...)
#' @details Currently there are methods for \code{brmsfit} objects.
#' @return Number(s) of levels
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @export
ngrps <- function(object, ...)
Expand All @@ -152,7 +152,7 @@ ngrps <- function(object, ...)
#' @details Currently there are methods for \code{brmsfit} objects.
#' @return Summary statistics of the posterior distributions related to the hypotheses
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -183,7 +183,7 @@ hypothesis <- function(x, hypothesis, ...)
#' @details Currently there are methods for \code{brmsfit} objects.
#' @return A data frame containing the posterior samples, with one column per parameter.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -212,7 +212,7 @@ posterior.samples <- function(x, parameters = NA, ...)
#' @details Currently there are methods for \code{brmsfit} objects.
#' @return A character vector containing the parameter names of the model
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @export
par.names <- function(x, ...)
Expand Down
6 changes: 3 additions & 3 deletions R/s3.methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ posterior.samples.brmsfit <- function(x, parameters = NA, ...) {
#' @param object An object of class \code{brmsfit}
#' @param ... Other potential arguments
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @export
summary.brmsfit <- function(object, ...) {
Expand Down Expand Up @@ -282,7 +282,7 @@ print.brmssummary <- function(x, digits = 2, ...) {
#' The effective sample size is always rounded to integers.
#' @param ... Additional arguments that would be passed to method \code{summary} of \code{brmsfit}.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @export
print.brmsfit <- function(x, digits = 2, ...) {
Expand Down Expand Up @@ -387,7 +387,7 @@ print.brmshypothesis <- function(x, digits = 2, ...) {
#'
#' @return NULL
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' \dontrun{
Expand Down
4 changes: 2 additions & 2 deletions R/support.export.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @return A vector of character strings specifying parameters of interest for models produced by the \code{brms} package.
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' brm.pars(rating ~ treat + period + carry + (1|subject),
Expand Down Expand Up @@ -67,7 +67,7 @@ brm.pars = function(formula, data = NULL, family = "gaussian", autocor = NULL, p
#'
#' @return A named list of objects containing the required data to fit a \code{brms} model
#'
#' @author Paul-Christian Buerkner <\email{paul.buerkner@@gmail.com}>
#' @author Paul-Christian Buerkner \email{paul.buerkner@@gmail.com}
#'
#' @examples
#' data1 <- brm.data(rating ~ treat + period + carry + (1|subject),
Expand Down
2 changes: 1 addition & 1 deletion R/support.internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rmNULL <- function(x) {

rmNum <- function(x) x[sapply(x, Negate(is.numeric))]

#removes matchs in x appearing also in y
#removes all elements in x appearing also in y
rmMatch <- function(x, y) {
att <- attributes(x)
keep <- which(!(x %in% y))
Expand Down
3 changes: 0 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
## Update
This update contains some important bug fixes and greatly improves usability of the outputs. I am sorry for sending you an update only 20 days after the initial release.

## Test environments
* local Windows 8.1 install, R 3.2.0, R 3.3.0
* win-builder (devel and release)
Expand Down
2 changes: 1 addition & 1 deletion man/VarCorr.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ VarCorr(fit_e, estimate = "quantile", probs = c(0.025, 0.975))
}
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

16 changes: 10 additions & 6 deletions man/brm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ Fit a Bayesian generalized linear or ordinal mixed model using Stan
\details{
Fit a generalized linear mixed model, which incorporates both fixed-effects parameters and random effects in a linear predictor
via full bayesian inference using Stan. During warmup aka burnin phase, Stan may print out quite a few informational
messages that \code{"the current Metropolis proposal is about the be rejected ..."}. These messages can be ignored in nearly all cases.
messages that \cr
\code{"the current Metropolis proposal is about the be rejected ..."}. \cr
These messages can be ignored in nearly all cases.
Use \code{silent = TRUE} to stop these messages from being printed out. \cr

\bold{Formula syntax}
Expand All @@ -119,7 +121,7 @@ Fit a generalized linear mixed model, which incorporates both fixed-effects para
using the formulae \code{yi | se(sei) ~ 1} and \code{yi | se(sei) ~ 1 + (1|study)}, respectively, where
\code{study} is a variable uniquely identifying every study.
If desired, meta-regressen can be performed via \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1|study)}
or \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1 + mod1 + mod2|study)}, where
or \cr \code{yi | se(sei) ~ 1 + mod1 + mod2 + (1 + mod1 + mod2|study)}, where
\code{mod1} and \code{mod2} represent moderator variables.

For all families, weighted regression may be performed using
Expand All @@ -137,9 +139,11 @@ Fit a generalized linear mixed model, which incorporates both fixed-effects para

With the expection of \code{categorical} and ordinal families, left and right censoring can be modeled through \code{yi | cens(censored) ~ predictors}.
The censoring variable (named \code{censored} in this example) should contain the values \code{'left'}, \code{'none'}, and \code{'right'}
(or equivalenty -1, 0, and 1) to indicate that the corresponding observation is left censored, not censored, or right censored. \cr
(or equivalenty -1, 0, and 1) to indicate that the corresponding observation is left censored, not censored, or right censored.

Mutiple \code{addition} terms may be specified at the same time, for instance \code{yi | se(sei) | cens(censored) ~ 1} for a censored meta-analytic model.
Mutiple \code{addition} terms may be specified at the same time, for instance \cr
\code{formula = yi | se(sei) | cens(censored) ~ 1} for a censored meta-analytic model, equivalent to
\code{formula = yi ~ 1} and \code{addition = list(se = ~sei, cens = ~censored)} when using argument \code{addition}. \cr

\bold{Families and link functions}

Expand Down Expand Up @@ -194,7 +198,7 @@ Fit a generalized linear mixed model, which incorporates both fixed-effects para

The autocorrelation parameters currently implemented are named \code{ar} (autoregression) and \code{ma} (moving average).
The default prior for autocorrelation parameters is an improper flat prior over the reals. It should be noted that \code{ar} will
only take one values between -1 and 1 if the response variable is wide-sence stationay, i.e. if there is no drift in the responses.
only take one values between -1 and 1 if the response variable is wide-sence stationay, i.e. if there is no drift in the responses. \cr

3. Standard deviations of random effects

Expand Down Expand Up @@ -269,6 +273,6 @@ plot(fit_k)
}
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

2 changes: 1 addition & 1 deletion man/brm.data.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ data2 <- brm.data(count ~ log_Age_c + log_Base4_c * Trt_c + (1|patient) + (1|vis
names(data2)
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

2 changes: 1 addition & 1 deletion man/brm.pars.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ brm.pars(rating ~ treat + period + carry + (1|subject),
data = inhaler, family = "cumulative")
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

3 changes: 3 additions & 0 deletions man/brm.plot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ Trace and density plots for MCMC samples (deprecated)
This function is deprecated and will soon be defunct. For models created with brms 0.2.0 or higher,
we recommend using the S3 plot method for class \code{brmsfit} (see also \code{\link[brms:plot.brmsfit]{plot.brmsfit}}).
}
\author{
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

6 changes: 5 additions & 1 deletion man/brmsfit-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Models fitted with the \code{\link[brms:brms]{brms}} package are represented as
\code{\link[brms:plot.brmsfit]{plot}}, \code{\link[brms:fixef.brmsfit]{fixef}}
\code{\link[brms:ranef.brmsfit]{ranef}}, \code{\link[brms:VarCorr.brmsfit]{VarCorr}},
\code{\link[stats:predict]{predict}}, \code{\link[stats:formula]{formula}},
\code{\link[stats:nobs]{nobs}}, \code{\link[brms:ngrps.brmsfit]{ngrps}}.
\code{\link[stats:nobs]{nobs}}, \code{\link[brms:ngrps.brmsfit]{ngrps}},
\code{\link[brms:hypothesis]{hypothesis}}, \code{\link[brms:par.names]{par.names}},
\code{\link[brms:posterior.samples]{posterior.samples}}
}

\section{Slots}{
Expand All @@ -28,6 +30,8 @@ Models fitted with the \code{\link[brms:brms]{brms}} package are represented as
\item{\code{data}:}{the data passed to Stan; a list of vectors and matrices}
\item{\code{model}:}{the model in Stan language; a character string}
\item{\code{pars}:}{the parameters of interest; a character vector}
\item{\code{autcor}:}{an object of class 'cor.brms' containing the autocorrelation structure}
\item{\code{partial}:}{the formula of the partial effects applied in categorical and ordinal models}
\item{\code{fit}:}{the fitted results including the posterior samples; (usually) an object of class \code{stanfit}}
}
}
Expand Down
2 changes: 1 addition & 1 deletion man/cor.ar.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This function is a constructor for the \code{cor.arma} class, allowing for autor
cor.ar(~visit|patient, p = 2)
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}
\seealso{
\code{\link{cor.arma}}
Expand Down
2 changes: 1 addition & 1 deletion man/cor.arma.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ This functions is a constructor for the \code{cor.arma} class, representing an a
cor.arma(~visit|patient, p = 2, q = 2)
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

2 changes: 1 addition & 1 deletion man/cor.ma.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This function is a constructor for the \code{cor.arma} class, allowing for movin
cor.ma(~visit|patient, q = 2)
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}
\seealso{
\code{\link{cor.arma}}
Expand Down
2 changes: 1 addition & 1 deletion man/fixef.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fixef(brm(time | cens ~ age + sex + disease, data=kidney, family="exponential"),
}
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

2 changes: 1 addition & 1 deletion man/hypothesis.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ hypothesis(fit_i, c("treat = period + carry", "exp(treat) - 3 = 0"))
}
}
\author{
Paul-Christian Buerkner <\email{paul.buerkner@gmail.com}>
Paul-Christian Buerkner \email{paul.buerkner@gmail.com}
}

Loading

0 comments on commit aa02a64

Please sign in to comment.