View source: R/SpecPrior-generators.R
Known | R Documentation |
Specify a 'Known' prior. The prior comes in two forms. With the first
form, the corresponding main effect or interaction equals the mean
exactly,
parameter[j] = mean[j]
.
With the second form,
parameter[j] ~ N(mean[j], sd[j])
.
The second form is obtained by supplying a sd
argument
to function Known
.
Known(mean, sd = 0)
mean |
The mean of the prior distribution. An object of
class |
sd |
The standard deviation of the prior distribution.
If omitted, it is assumed to be 0. |
Internally, the mean
and sd
arguments are permuted and
subsetted to make them compatible with the corresponding main effect or
interaction. Thus, for example, if mean
has values for regions
A
, B
, and C
, but data y
only includes
regions A
and B
, then C
is silently ignored.
The original mean
and sd
arguments are, however,
stored, and can be used for prediction. For example, we might
supply a mean
argument with values for years 2005,
2010, 2015, 2020, and 2025, then call estimateModel
with data for 2005, 2010, and 2015, and finally call
predictModel
to obtain forecasts for 2020 and 2025.
An object of class SpecKnown
.
ExchFixed
creates a normal prior centered at 0.
mean <- ValuesOne(c(0.1, 0.2, 0.3),
labels = c("A", "B", "C"),
name = "region")
sd <- ValuesOne(c(0.02, 0.03, 0.02),
labels = c("A", "B", "C"),
name = "region")
## No uncertainty
Known(mean)
## Some uncertainty
Known(mean = mean, sd = sd)
## Single standard deviation
Known(mean = mean, sd = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.