The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Table of contents:
This package is still under active development. If you have features you would like to have added, please submit your suggestions (and bug-reports) at: https://github.com/talgalili/edfun/issues
As mentioned in CRAN Task View: Probability Distributions
Empirical distribution : Base R provides functions for univariate analysis: (1) the empirical density (see density()), (2) the empirical cumulative distribution function (see ecdf()), (3) the empirical quantile (see quantile()) and (4) random sampling (see sample()).
This package aims to easily wrap these into a single function
edfun
(short for Empirical Distribution FUNctions). Also,
since quantile is generally a slow function to perform, the default for
creating a quantile function (inverse-CDF) is by approximating the
function of predicting the data values (x) from their quantiles (CDF).
This is done using the approxfun
function. It takes a bit
longer to create qfun, but it is MUCH faster to run than quantile (and
is thus much better for simulations). Special care is taken for dealing
with the support of the distribution (if it is known upfront).
The added speed allows to use these functions to run simulation studies for unusual distributions.
To install the stable version on CRAN:
# install.packages('edfun') # not on CRAN yet
To install the latest (“cutting-edge”) GitHub version run:
# You'll need devtools
if (!require(devtools)) install.packages("devtools");
::install_github('talgalili/edfun') devtools
And then you may load the package using:
library("edfun")
Quick example:
library(edfun)
set.seed(123)
<- rnorm(1000)
x <- edfun(x)
x_dist
<- x_dist$dfun
f curve(f, -2,2)
<- x_dist$pfun
f curve(f, -2,2)
<- x_dist$qfun
f curve(f, 0,1)
<- x_dist$rfun(1000)
new_x hist(new_x)
This is especially useful for cases where we can simulate numbers or have their density, but don’t have their CDF or inv-CDF. For example, for the double exponential distribution, or a bi-modal normal distribution.
This package is thanks to the amazing work done by MANY people in the (open source) R community.
You are welcome to:
You can see the most recent changes to the package in the NEWS.md file
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.