R/Prior.R
, R/ContinuousPrior.R
, R/PointMassPrior.R
condition.Rd
Restrict an object of class Prior
to a sub-interval and
re-normalize the PDF.
condition(dist, interval, ...)
# S4 method for ContinuousPrior,numeric
condition(dist, interval, ...)
# S4 method for PointMassPrior,numeric
condition(dist, interval, ...)
a univariate distribution
object
length-two numeric vector giving the parameter interval to condition on
further optional arguments
conditional Prior
on given interval
tmp <- condition(
ContinuousPrior(function(x) dunif(x, .2, .4), c(.2, .4)),
c(.3, .5)
)
bounds(tmp) # c(.3, .4)
#> [1] 0.3 0.4
tmp <- condition(PointMassPrior(c(0, .5), c(.3, .7)), c(-1, .25))
expectation(tmp, identity) # 0
#> [1] 0