View source: R/903_post_hoc_fns.R
s2m | R Documentation |
Sequential 2-means number of nonzero-values parameters for an iteration
s2m(x, b)
x |
A vector of parameters from a single draw from a posterior distribution |
b |
The maximum distance at which two clusters of parameters are considered equal |
A scalar representing the number of nonzero-valued parameters in a particular draw from a posterior distribution
post_sample <- numeric(100)
for(k in 1:100) {
g <- runif(1)
if(g < 0.8) {
post_sample[k] <- rnorm(1,0,0.2)
} else {
post_sample[k] <- rnorm(1,0,0.2)
}
}
how_many_nonzero <- s2m(post_sample, b = sd(post_sample))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.