Prior objects can be conditioned on lower or upper boundaries, intervals, or single values to restrict their support. Various shorthand notations are supported (see examples).

condition(prior, low = 0, high = 1)

# S4 method for Prior
condition(prior, low = 0, high = 1)

prior %|% interval

# S4 method for Prior,numeric
%|%(prior, interval)

Arguments

prior

Prior distribution object representing a prior on the unit interval [0,1]

low

[optional] lower boundary to condition on

high

[optional] upper boundary to condition on

See also

Prior, updating for Bayesian updating

Examples

badr::load_julia_package() load_julia_package() condition(Beta(2, 3), low = 0.2)
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.20,1.00](a=2.00,b=3.00)
condition(Beta(2, 3), high = 0.9)
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.00,0.90](a=2.00,b=3.00)
condition(Beta(2, 3), low = 0.2, high = 0.9)
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.20,0.90](a=2.00,b=3.00)
Beta(5, 7) %|% c(0.2, 0.7) # shorthand for conditioning on interval
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.20,0.70](a=5.00,b=7.00)
Beta(5, 7) %|% 0.5 # condition on single point
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type PointMass{Float64}. #> PointMass(0.50)
Beta(5, 7) <= 0.5 # = condition(Beta(5, 7), high = 0.5)
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.00,0.50](a=5.00,b=7.00)
0.2 <= Beta(5, 7) # = condition(Beta(5, 7), low = 0.2)
#> An object of class "Beta" #> Slot "jprior": #> Julia Object of type Beta{Float64}. #> Beta|[0.20,1.00](a=5.00,b=7.00)