View source: R/mis_rnorm.par.R
rnorm.par | R Documentation |
This function initializes an array of class "param_block
" containing samples from
standard normal distribuion (i.e., mean 0 and standard deviation 1). There are most helpful for
calculating distributions of expected rates over some time interval.
rnorm.par(
niter = 1,
n = 1,
nchains = 1,
simplify = TRUE,
fit = NULL,
chain.names = paste("chain", seq_len(nchains))
)
niter |
The number of iterations/rows of the resulting |
n |
The number of parameters/columns of the resulting |
nchains |
The number of chains/slices of the reuslting |
simplify |
|
fit |
An object of class " |
chain.names |
A character vector of names for the chains/slices of the resulting
|
The resulting normal samples may be transformed to have different means/standard deviations by multiplying with and adding constants–see examples below.
An array of class "param_block
" with a param_type
of "chains
".
The dimension of these arrays will generally go in the order of
iterations, then parameters, then chains. Any dimensions of length 1 are
collapsed and stored as attributes if simplify
is TRUE
. Parameters
are all named "N(0;1)i
", where i
denotes the i
th column of the resulting array.
param_block-class for general information on param_block
arrays and
%chains%()
,
%quantiles%()
,
%means%()
,
%diagnostics%()
,
and %select%()
for more information on
param_block
operators.
rnorm.par(1500, 1, 4)
#compare without simplification
rnorm.par(1500, 1, 4, simplify = FALSE)
#using a fitted evorates model to automatically determine dimensions/names
data("cet_fit")
rnorm.par(n = 2, fit = cet_fit)
#or a param_block
parblock <- rnorm.par(500, 3, 1)
rnorm.par(n = 5, fit = parblock)
#transforming to non-standard normal distribution
means <- c(-1, 5, 2)
sds <- c(2, 0.5, 1)
prof.plot(parblock * sds + means, alpha = 0.5, smooth = TRUE)
#distribution of fold-changes expected after 1 million years
rates.per.my<-exp(setNames(sqrt(cet_fit %chains% "R_sig2") * rnorm.par(fit = cet_fit) + cet_fit %chains% "R_mu",
"rates_per_my"))
prof.plot(rates.per.my)
#after 10 million years
rates.per.10my<-exp(setNames(sqrt(cet_fit %chains% "R_sig2") * sqrt(10) * rnorm.par(fit = cet_fit) + 10 * cet_fit %chains% "R_mu",
"rates_per_10my"))
prof.plot(rates.per.10my)
#easier to interpret on log scale maybe
prof.plot(log(rates.per.10my))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.