Repository navigation
Expand file tree
/
Copy pathdraws-brms.Rd
More file actions
76 lines (63 loc) · 2.42 KB
/
Copy pathdraws-brms.Rd
File metadata and controls
76 lines (63 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/posterior.R
\name{draws-brms}
\alias{draws-brms}
\alias{as_draws}
\alias{as_draws_matrix}
\alias{as_draws_array}
\alias{as_draws_df}
\alias{as_draws_rvars}
\alias{as_draws_list}
\alias{as_draws.brmsfit}
\alias{as_draws_matrix.brmsfit}
\alias{as_draws_array.brmsfit}
\alias{as_draws_df.brmsfit}
\alias{as_draws_list.brmsfit}
\alias{as_draws_rvars.brmsfit}
\title{Transform \code{brmsfit} to \code{draws} objects}
\usage{
\method{as_draws}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
\method{as_draws_matrix}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
\method{as_draws_array}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
\method{as_draws_df}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
\method{as_draws_list}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
\method{as_draws_rvars}{brmsfit}(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
}
\arguments{
\item{x}{A \code{brmsfit} object or another \R object for which
the methods are defined.}
\item{variable}{A character vector providing the variables to extract.
By default, all variables are extracted.}
\item{regex}{Logical; Should variable should be treated as a (vector of)
regular expressions? Any variable in \code{x} matching at least one of the
regular expressions will be selected. Defaults to \code{FALSE}.}
\item{inc_warmup}{Should warmup draws be included? Defaults to \code{FALSE}.}
\item{...}{Arguments passed to individual methods (if applicable).}
}
\description{
Transform a \code{brmsfit} object to a format supported by the
\pkg{posterior} package.
}
\details{
To subset iterations, chains, or draws, use the
\code{\link[posterior:subset_draws]{subset_draws}} method after
transforming the \code{brmsfit} to a \code{draws} object.
}
\examples{
\dontrun{
fit <- brm(count ~ zAge + zBase * Trt + (1|patient),
data = epilepsy, family = poisson())
# extract posterior draws in an array format
(draws_fit <- as_draws_array(fit))
posterior::summarize_draws(draws_fit)
# extract only certain variables
as_draws_array(fit, variable = "r_patient")
as_draws_array(fit, variable = "^b_", regex = TRUE)
# extract posterior draws in a random variables format
as_draws_rvars(fit)
}
}
\seealso{
\code{\link[posterior:draws]{draws}}
\code{\link[posterior:subset_draws]{subset_draws}}
}