Description Usage Arguments Value
Internal function. sample from the mixture distribution q_{α}
1 2 | do.mixture.sample(seed, b, n, J, mixture.param, alpha, fname, rpname, rqname,
dpname, dqname)
|
seed |
seed for sampling |
b |
batch index for the samples |
n |
total number of samples |
J |
number of mixture components, including the defensive one |
mixture.param |
mixture.param = list(p, J, ...), where p is the dimension of the sample, and J is the number of mixture components, including the defensive one. mixture.param should be compatible with user defined functions f(n, j, mixture.param), rp(n, mixture.param), rq(n, j, mixture.param), dp(xmat, mixture.param), dq(xmat, j, mixture.param) |
alpha |
vector of mixture proportions |
fname |
name of user defined function fname(xmat, j, mixture.param). xmat is an n \times p matrix of n samples with p dimensions. fname returns a vector of function values for each row in xmat. fname is defined for j = 1, \cdots, J. j = 1, \cdots, J - 1 corresponds to different proposal mixture components, and j = J corresponds to the defensive mixture component. |
rpname |
name of user definded function rpname(n, mixture.param). It generates n random samples from target distribution pname. Parameters can be specified in mixture.param. rpname returns an n \times p matrix. |
rqname |
name of user defined function rqname(n, j, mixture.param). It generate n random samples from the j^{th} mixture component of proposal mixture distribution. rqname returns an n \times p matrix. rqname is defined for j = 1, \cdots, J - 1. |
dpname |
name of user defined function dpname(xmat, mixture.param). It returns the density of xmat from the target distribution pname as a vector of length nrow(xmat). Note that only the ratio between dpname and dqname matters. So dpname and dqname can return values of C \timesdpname and C \timesdqname respectively. |
dqname |
name of user defined function dqname(xmat, j, mixture.param). It returns the density of xmat from the proposal distribution q_j as a vector of length nrow(xmat). dqname is defined for j = 1, \cdots, J - 1. Note that only the ratio between dpname and dqname matters. So dpname and dqname can return values of C \timesdpname and C \timesdqname respectively. |
a list of
the matrix(size n \times p) of samples from the mixture distribution q_{α}
the vector of fname evaluated at sample matrix x
the matrix of densities under each mixture component, i.e. qx[,j] is the density under q_j. The defensive component is the J^{th} column
the vector of densities under proposal distribution pname
the rounded alpha used for sampling, i.e. alpha2N(n, alpha)/n
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.