sns.make.part | R Documentation |
Utility functions for creating and validating state space partitions, to be used in SNS for improving the mixing of sampled chains for high-dimensional posteriors.
sns.make.part(K, nsubset, method = "naive") sns.check.part(part, K)
K |
Dimensionality of state space. |
nsubset |
Number of subsets to partition the state space dimensions into. |
method |
Method used for state space partitioning. Currently, only |
part |
A list of length |
sns.make.part
produces a list of integer vectors, each containing coordinates belonging to the same subset. sns.check.part
produces a boolean flag, indicating whether or not the partition list is valid or not. The subset members must constitute a mutually-exclusive, collectively-exhaustive set relative to 1:K
.
Alireza S. Mahani, Asad Hasan, Marshall Jiang, Mansour T.A. Sharabiani
Mahani A.S., Hasan A., Jiang M. & Sharabiani M.T.A. (2016). Stochastic Newton Sampler: The R Package sns. Journal of Statistical Software, Code Snippets, 74(2), 1-33. doi:10.18637/jss.v074.c02
sns
, sns.run
# creating a valid partition of a 6-dimensional state space my.part.valid <- list(c(1,2,3), c(4,5,6)) is.valid.1 <- sns.check.part(my.part.valid, 6) cat("is partition valid: ", is.valid.1, "\n") # creating an invalid partition of a 6-dimensional state space # (coordinate 4 is missing) my.part.invalid <- list(c(1,2,3), c(5,6)) is.valid.2 <- sns.check.part(my.part.invalid, 6) cat("is partition valid: ", is.valid.2, "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.