Compute the ratio of two densities at given points based on draws of the corresponding distributions.
Arguments
- x
Vector of draws from the first distribution, usually the posterior distribution of the quantity of interest.
- y
Optional vector of draws from the second distribution, usually the prior distribution of the quantity of interest. If
NULL(the default), only the density ofxwill be evaluated.- point
Numeric values at which to evaluate and compare the densities. Defaults to
0.- n
Single numeric value. Influences the accuracy of the density estimation. See
densityfor details.- ...
Further arguments passed to
density.
Value
A vector of length equal to length(point). If y is
provided, the density ratio of x against y is returned. Else,
only the density of x is returned.