Exemple #1
0
// BinomPiQtlFPri returns posterior quantile function for Binomial proportion, Flat prior.
func BinomPiQtlFPri(k, n int64) func(p float64) float64 {
	if k > n {
		panic(fmt.Sprintf("The number of observed successes (k) must be <= number of trials (n)"))
	}
	α := 1.0
	β := 1.0
	return dst.BetaQtl(α+float64(k), β+float64(n-k))
}
Exemple #2
0
// BinomPiQtlBPri returns posterior quantile function forBinomial proportion, general Beta prior.
func BinomPiQtlBPri(k, n int64, α, β float64) func(p float64) float64 {
	if k > n {
		panic(fmt.Sprintf("The number of observed successes (k) must be <= number of trials (n)"))
	}
	if α < 0 || β < 0 {
		panic(fmt.Sprintf("The parameters of the prior must be non-negative"))
	}
	return dst.BetaQtl(α+float64(k), β+float64(n-k))
}
Exemple #3
0
// BinomPiQtlHPri returns posterior quantile function for Binomial proportion, Haldane prior.
// see Aitkin 2010: 143 for cautions
func BinomPiQtlHPri(k, n int64) func(p float64) float64 {
	var α, β float64
	α = 0.0
	β = 0.0
	if k > n {
		panic(fmt.Sprintf("The number of observed successes (k) must be <= number of trials (n)"))
	}
	return dst.BetaQtl(α+float64(k), β+float64(n-k))
}