Description Usage Arguments Details Value See Also Examples
A smcarray object is used by the
biips_smc_samples function to represent SMC output or particles
of a given variable.
A smcarray.fsb object is a named list of smcarray objects with
different types of monitoring for the same variable. Members in this list
have names f (filtering), s (smoothing) or b (backward
smoothing).
A smcarray.fsb.list object is a named list of smcarray.fsb
objects for different monitored variables. It might also contain a member
named log_marg_like with an estimate of the log marginal likelihood.
The methods apply identically to smcarray, smcarray.fsb or
smcarray.fsb.list objects and return a named list with the same named
members as the input object.
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 | is.smcarray(object)
is.smcarray.fsb(object)
is.smcarray.fsb.list(object)
biips_diagnosis(object, ...)
## S3 method for class 'smcarray'
biips_diagnosis(object, ess_thres = 30, quiet = FALSE,
...)
## S3 method for class 'smcarray.fsb'
biips_diagnosis(object, type = "fsb", quiet = FALSE,
...)
## S3 method for class 'smcarray.fsb.list'
biips_diagnosis(object, type = "fsb",
quiet = FALSE, ...)
biips_summary(object, ...)
## S3 method for class 'smcarray'
biips_summary(object, probs = c(), order = ifelse(mode,
0, 1), mode = all(object$discrete), ...)
## S3 method for class 'smcarray.fsb'
biips_summary(object, ...)
## S3 method for class 'smcarray.fsb.list'
biips_summary(object, ...)
biips_table(x, ...)
## S3 method for class 'smcarray'
biips_table(x, ...)
biips_density(x, ...)
## S3 method for class 'smcarray'
biips_density(x, bw = "nrd0", ...)
## S3 method for class 'smcarray.fsb'
biips_table(x, ...)
## S3 method for class 'smcarray.fsb'
biips_density(x, bw = "nrd0", adjust = 1, ...)
## S3 method for class 'smcarray.fsb.list'
biips_table(x, ...)
## S3 method for class 'smcarray.fsb.list'
biips_density(x, bw = "nrd0", ...)
## S3 method for class 'smcarray'
summary(object, ...)
## S3 method for class 'smcarray.fsb'
summary(object, ...)
## S3 method for class 'smcarray.fsb.list'
summary(object, ...)
## S3 method for class 'smcarray'
density(x, ...)
## S3 method for class 'smcarray.fsb'
density(x, ...)
## S3 method for class 'smcarray.fsb.list'
density(x, ...)
|
object, x |
a |
... |
additional arguments to be passed to the default methods. See
|
ess_thres |
integer. Threshold on the Effective Sample Size (ESS). If
all the ESS components are over |
quiet |
logical. Disable message display. (default= |
type |
string containing the characters |
probs |
vector of reals. probability levels in ]0,1[ for quantiles.
(default = |
order |
integer. Moment statistics of order below or equal to
|
mode |
logical. Activate computation of the mode, i.e. the most
frequent value among the particles. (default = |
bw |
either a real with the smoothing bandwidth to be used or a string
giving a rule to choose the bandwidth. See |
adjust |
scale factor for the bandwidth. the bandwidth used is actually
|
Assuming dim is the dimension of the monitored variable, a
smcarray object is a list with the members:
array of dimension c(dim, n_part) with the values of
the particles.
array of dimension c(dim, n_part) with the weights
of the particles.
array of dimension dim with Effective Sample Sizes of
the particles set.
array of dimension dim with logicals indicating
discreteness of each component.
array of dimension dim with sampling iterations
of each component.
lists of the contitioning variables (observations). Its value is:
for filtering: a list of dimension dim. each member is a
character vector with the respective conditioning variables of
the node array component.
for smoothing/backward_smoothing: a character vector, the same for all the components of the node array.
string with the name of the variable.
vector with the lower bounds of the variable.
vector with the upper bounds of the variable.
string with the type of monitor ('filtering',
'smoothing' or 'backward_smoothing').
For instance, if out_smc is a smcarray.fsb.list object, one can
access the values of the smoothing particles for the variable 'x'
with: out_smc$x$s$values.
The methods apply identically to smcarray, smcarray.fsb or
smcarray.fsb.list objects and return a named list with the same
named members as the input object.
The function is.smcarray returns TRUE if the object is of class smcarray.
The function is.smcarray.fsb returns TRUE if the object
is of class smcarray.fsb.
The function is.smcarray.fsb.list returns TRUE if the
object is of class smcarray.fsb.list.
The method biips_diagnosis prints diagnosis of the SMC output
and returns the minimum ESS value.
The method biips_summary returns univariate marginal
statistics. The output innermost members are objects of class
summary.smcarray. Assuming dim is the dimension of the
variable, the summary.smcarray object is a list with the following
members:
mean |
array of size |
var |
array of size |
skew |
array of size |
kurt |
array of size |
probs |
vector of quantile probabilities. |
quant |
list of arrays of size |
mode |
array of size |
The method biips_table returns univariate marginal frequency
tables or probability mass estimates of discrete variables. The output
innermost members are objects of class table.smcarray.
The method biips_density returns univariate marginal kernel
density estimates. The output innermost members are objects of class
density.smcarray.
The method summary is an alias for biips_summary.
The method density is an alias for biips_density.
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 | modelfile <- system.file('extdata', 'hmm.bug', package = 'rbiips')
stopifnot(nchar(modelfile) > 0)
cat(readLines(modelfile), sep = '\n')
data <- list(tmax = 10, p = c(.5, .5), logtau_true = log(1), logtau = log(1))
model <- biips_model(modelfile, data, sample_data = TRUE)
n_part <- 100
out_smc <- biips_smc_samples(model, c('x', 'c[2:10]'), n_part, type = 'fs',
rs_thres = 0.5, rs_type = 'stratified')
#' Manipulate `smcarray.fsb.list` object
is.smcarray.fsb.list(out_smc)
names(out_smc)
out_smc
biips_diagnosis(out_smc)
biips_summary(out_smc)
#' Manipulate `smcarray.fsb` object
is.smcarray.fsb(out_smc$x)
names(out_smc$x)
out_smc$x
biips_diagnosis(out_smc$x)
summ_smc_x <- biips_summary(out_smc$x, order = 2, probs = c(.025, .975))
summ_smc_x
dens_smc_x <- biips_density(out_smc$x, bw = 'nrd0', adjust = 1, n = 100)
par(mfrow = c(2, 2))
plot(dens_smc_x)
is.smcarray.fsb(out_smc[['c[2:10]']])
names(out_smc[['c[2:10]']])
out_smc[['c[2:10]']]
biips_diagnosis(out_smc[['c[2:10]']])
summ_smc_c <- biips_summary(out_smc[['c[2:10]']])
summ_smc_c
table_smc_c <- biips_table(out_smc[['c[2:10]']])
par(mfrow = c(2, 2))
plot(table_smc_c)
#' Manipulate `smcarray` object
is.smcarray(out_smc$x$f)
names(out_smc$x$f)
out_smc$x$f
out_smc$x$s
biips_diagnosis(out_smc$x$f)
biips_diagnosis(out_smc$x$s)
biips_summary(out_smc$x$f)
biips_summary(out_smc$x$s)
par(mfrow = c(2, 2))
plot(biips_density(out_smc$x$f))
par(mfrow = c(2, 2))
plot(biips_density(out_smc$x$s))
par(mfrow = c(2, 2))
plot(biips_table(out_smc[['c[2:10]']]$f))
par(mfrow = c(2, 2))
plot(biips_table(out_smc[['c[2:10]']]$s))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.