R/sd_fc.R

Defines functions sd_fc

Documented in sd_fc

sd_fc <-
function(ISweight, samples) {
  #INPUT:
  ## ISweight are the importance sampling weights
  ## samples the MCMC samples to calculate the expectation for
  #OUTPUT:
  #computes the sd of an MCMC weighted sample via impotance sampling
  #sd of an MCMC weighted sample 
  #expectation_posterior_altered <- sum(ISweight * samples)
  sdw <- sqrt(expectation_fc(ISweight, samples^2) - (expectation_fc(ISweight, samples))^2)
  
  return(sdw)
}
hunansona/ed4bhm documentation built on June 15, 2022, 6:42 p.m.