s2m_B: Perform sequential 2-means variable selection on posterior...

View source: R/903_post_hoc_fns.R

s2m_BR Documentation

Perform sequential 2-means variable selection on posterior draws for B

Description

This is a wrapper function to perform the sequential 2-means variable selection method @li2017variable on the reconstructed tensor from the posterior draws of betas.

Usage

s2m_B(B, sigma = NULL)

Arguments

B

The reconstructed tensor from the posterior draws of betas. This should have dimension D + 1.

sigma

The value for the distance at which two cluster centers are determined to be the same. This value defaults to the median value for the posterior standard deviation of the voxel-wise draws in B.

Value

An array of dimension D + 1.

Examples

# In this case, the value for D is 2
true_B <- rbind(
  c(0,0,0,0,0),
  c(0,0,1,0,0),
  c(0,1,1,1,0),
  c(0,0,1,0,0),
  c(0,0,0,0,0)
)
sim_B <- array(NA, dim = c(5,5,500)) # Simulating 500 draws
for(s in 1:500) {
  sim_B[,,s] <- rnorm(25,mean = c(true_B), sd = 0.3)
}
final_estimate <- s2m_B(sim_B)

danieladamspencer/bayestensorreg documentation built on July 23, 2024, 10:14 a.m.