BoundedDensity {bde} | R Documentation |
Class "BoundedDensity"
Description
This class deals with generic estimations of a bounded densities. The probability density function is approximated by providing a set of data points in a lower and upper bounded interval and their associated densities. Using this information, the methods implemented in the class can be used to compute densities, values of the distribution function, quantiles, sample the distribution and obtain graphical representations.
Objects from the Class
Objects can be created by using the generator function boundedDensity
.
Slots
dataPointsCache
:a numeric vector containing points within the
[lower.limit,upper.limit]
intervaldensityCache
:a numeric vector containing the density for each point in
dataPointsCache
distributionCache
:a numeric vector used to cache the values of the distribution function. This slot is included to improve the performance of the methods when multiple calculations of the distribution function are used
lower.limit
:a numeric value for the lower limit of the bounded interval for the data
upper.limit
:a numeric value for the upper limit of the bounded interval for the data
Methods
- density
See
"density"
for details- distribution
See
"distribution"
for details- quantile
See
"quantile"
for details- rsample
See
"rsample"
for details- plot
See
"plot"
for details- getdataPointsCache
See
"getdataPointsCache"
for details- getdensityCache
See
"getdensityCache"
for details- getdistributionCache
See
"getdistributionCache"
for details
Author(s)
Guzman Santafe, Borja Calvo and Aritz Perez
Examples
# data points and its densities
a <- seq(0,1,0.01)
b <- dbeta(a,5,10)
# create the density model
model <- boundedDensity(x=a,densities=b)
# examples of usual functions
density(model,0.5)
distribution(model,0.2,discreteApproximation=FALSE)
distribution(model,0.2,discreteApproximation=TRUE)
# graphical representation
hist(b,freq=FALSE)
lines(model, col="red",lwd=2)