File: default_prior.default.Rd

package info (click to toggle)
r-cran-brms 2.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,208 kB
  • sloc: sh: 13; makefile: 2
file content (98 lines) | stat: -rw-r--r-- 4,109 bytes parent folder | download
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/priors.R
\name{default_prior.default}
\alias{default_prior.default}
\title{Default Priors for \pkg{brms} Models}
\usage{
\method{default_prior}{default}(
  object,
  data,
  family = gaussian(),
  autocor = NULL,
  data2 = NULL,
  knots = NULL,
  drop_unused_levels = TRUE,
  sparse = NULL,
  ...
)
}
\arguments{
\item{object}{An object of class \code{\link[stats:formula]{formula}},
\code{\link{brmsformula}}, or \code{\link{mvbrmsformula}} (or one that can
be coerced to that classes): A symbolic description of the model to be
fitted. The details of model specification are explained in
\code{\link{brmsformula}}.}

\item{data}{An object of class \code{data.frame} (or one that can be coerced
to that class) containing data of all variables used in the model.}

\item{family}{A description of the response distribution and link function to
be used in the model. This can be a family function, a call to a family
function or a character string naming the family. Every family function has
a \code{link} argument allowing to specify the link function to be applied
on the response variable. If not specified, default links are used. For
details of supported families see \code{\link{brmsfamily}}. By default, a
linear \code{gaussian} model is applied. In multivariate models,
\code{family} might also be a list of families.}

\item{autocor}{(Deprecated) An optional \code{\link{cor_brms}} object
describing the correlation structure within the response variable (i.e.,
the 'autocorrelation'). See the documentation of \code{\link{cor_brms}} for
a description of the available correlation structures. Defaults to
\code{NULL}, corresponding to no correlations. In multivariate models,
\code{autocor} might also be a list of autocorrelation structures.
It is now recommend to specify autocorrelation terms directly
within \code{formula}. See \code{\link{brmsformula}} for more details.}

\item{data2}{A named \code{list} of objects containing data, which
cannot be passed via argument \code{data}. Required for some objects
used in autocorrelation structures to specify dependency structures
as well as for within-group covariance matrices.}

\item{knots}{Optional list containing user specified knot values to be used
for basis construction of smoothing terms. See
\code{\link[mgcv:gamm]{gamm}} for more details.}

\item{drop_unused_levels}{Should unused factors levels in the data be
dropped? Defaults to \code{TRUE}.}

\item{sparse}{(Deprecated) Logical; indicates whether the population-level
design matrices should be treated as sparse (defaults to \code{FALSE}). For
design matrices with many zeros, this can considerably reduce required
memory. Sampling speed is currently not improved or even slightly
decreased. It is now recommended to use the \code{sparse} argument of
\code{\link{brmsformula}} and related functions.}

\item{...}{Other arguments for internal usage only.}
}
\value{
A \code{brmsprior} object. That is, a data.frame with specific
  columns including \code{prior}, \code{class}, \code{coef}, and \code{group}
  and several rows, each providing information on a parameter (or parameter
  class) on which priors can be specified. The prior column is empty except
  for internal default priors.
}
\description{
Get information on all parameters (and parameter classes) for which priors
may be specified including default priors.
}
\examples{
# get all parameters and parameters classes to define priors on
(prior <- default_prior(count ~ zAge + zBase * Trt + (1|patient) + (1|obs),
                        data = epilepsy, family = poisson()))

# define a prior on all population-level effects a once
prior$prior[1] <- "normal(0,10)"

# define a specific prior on the population-level effect of Trt
prior$prior[5] <- "student_t(10, 0, 5)"

# verify that the priors indeed found their way into Stan's model code
stancode(count ~ zAge + zBase * Trt + (1|patient) + (1|obs),
         data = epilepsy, family = poisson(),
         prior = prior)

}
\seealso{
\code{\link{default_prior}}, \code{\link{set_prior}}
}