approx_sb: lower bound of a vector of probabilities that sum to one

View source: R/utils.R

approx_sbR Documentation

lower bound of a vector of probabilities that sum to one

Description

the lower bound is based on the best set of local variational parameters which comprise of logit of the stick-breaking form of the supplied vector

Usage

approx_sb(x)

Arguments

x

a vector of probabilities that sum to one

Value

approximation to a vector of probabilities

References

See Also

Other VI functions: g_fun.vec(), g_fun0(), g_fun(), lower_bd()

Examples


# based on Tsiatis 2016 NeuroIPS
approx <- function(x){
  res = rep(NA,length=length(x))
  for (i in 1:length(res)){
    curr_v <- x[i] - x[-i]
    res[i]  = prod(expit(curr_v))
  }
  res
}

tau = rep(0.25,4)
barplot(rbind(tau,approx_sb(tau),approx(tau)),beside=TRUE,
        legend.text=c("truth","sb + quad (lotR)","1 vs other + quad"),
        main="truth 1")

tau = c(0.5,0.3,0.15,0.05)
barplot(rbind(tau,approx_sb(tau),approx(tau)),beside=TRUE,
        legend.text=c("truth","sb + quad (lotR)","1 vs other + quad"),
        main="truth 2")


zhenkewu/lotR documentation built on April 24, 2022, 2:36 a.m.