R/simBetas.R

Defines functions simBetas

#Simulates betas for each topic
#Takes parameters value from estimateEffect
#nsims is the number of simulations needed

simBetas <- function(parameters, nsims=100){
  simbetas <- list()
  for(i in 1:length(parameters)) {
      simbetas[[i]] <- do.call(rbind, lapply(parameters[[i]],
                                             function(x) rmvnorm(n=nsims, mu=x$est, Sigma=x$vcov)))
    }
  return(simbetas)
}

Try the stm package in your browser

Any scripts or data that you put into this service are public.

stm documentation built on June 24, 2024, 5:18 p.m.