PoissonBinomial()
distribution, a generalization of the binomial distribution. The Poisson
binomial is characterized by n independent Bernoulli trials but with potentially different
success probabilities. The d
/p
/q
/r
functions employ the efficient implementation from
the PoissonBinomial package, if available.
In case it is not available, fallback computation based on a normal approximation are provided - with
a warning, by default (#100).prodist()
methods for various count regression objects now distinguish between computations
for the classic pscl package and the newer
countreg package (currently on R-Forge, soon
to be released to CRAN).simulate()
method for distribution
objects is now better aligned with simulate.lm()
in base R: It now always returns a data.frame
with seed
attribute.simulate()
default method which leverages prodist()
and subsequently uses the
simulate()
method for distribution
objects.prodist()
methods for distribution
objects which just returns the unmodified
distribution
object itself.format()
method - and hence the print()
method - for distribution
objects has been
simplified. For example, now Normal(mu = 0, sigma = 1)
is used instead of
Normal distribution (mu = 0, sigma = 1)
in order to yield a more compact output, especially
for vectors of distributions (#101).as.character()
method which essentially calls format(..., digits = 15, drop0trailing = TRUE)
.
This mimics the behavior and precision of base R for real vectors. Note that this enables
using match()
for distribution objects.duplicated()
method which relies on the corresponding method for the data.frame
of parameters in a distribution.distribution
vectors as columns in tibble
data objects, see
?vec_proxy.distribution
for further details and a practical example.HurdlePoisson()
and HurdleNegativeBinomial()
(by @dkwhu in #94 and #96).prodist()
method for glm
objects can now also handle family
specifications from
MASS::negative.binomial(theta)
with fixed theta
(reported by Christian Kleiber).ellipsis
dependency by rlang
as the former will be
deprecated/archived
(by @olivroy in #105).is_discrete()
and is_continous()
with methods for all distribution objects
in the package. The is_discrete()
methods return TRUE
for every distribution that is discrete
on the entire support and FALSE
otherwise. Analogously, is_continuous()
returns TRUE
for
every distribution that is continuous on the entire support and FALSE
otherwise. Thus, for
mixed discrete-continuous distributions both methods should yield FALSE
(#90).elementwise = NULL
in apply_dpqr()
and hence inherited in
cdf()
, pdf()
, log_pdf()
, and quantile()
. It provides type-safety when
applying one of the functions to a vector of distributions d
to a numeric
argument x
where both d
and x
are of length n > 1. By setting elementwise = TRUE
the function is applied element-by-element, also yielding a vector of length n.
By setting elementwise = FALSE
the function is applied for all combinations
yielding an n-by-n matrix. The default elementwise = NULL
corresponds to FALSE
if d
and x
are of different lengths and TRUE
if the are of the same length
n > 1 (#87).d
/p
/q
/r
functions for hnbinom
, zinbinom
, ztnbinom
, and ztpois
similar
to the corresponding nbinom
and pois
functions from base R.HurdleNegativeBinomial()
, ZINegativeBinomial()
, ZTNegativeBinomial()
, and
ZTPoisson()
distribution constructors along with the corresponding S3 methods for the
"usual" generics (except skewness()
and kurtosis()
).prodist()
methods for extracting the fitted/predicted probability distributions from
models estimated by hurdle()
, zeroinfl()
, and zerotrunc()
objects from either the
pscl
package or the countreg
package.prodist(..., sigma = "ML")
to the lm
method for extracting the
fitted/predicted probability distribution from a linear regression model. In the previous
version the prodist()
method always used the least-squares estimate of the error variance
(= residual sum of squares divided by the residual degrees of freedom, n - k), as also
reported by the summary()
method. Now the default is to use the maximum-likelihood estimate
instead (divided by the number of observations, n) which is consistent with the logLik()
method. The previous behavior can be obtained by specifying sigma = "OLS"
(#91).lm
method the glm
method prodist(..., dispersion = NULL)
now, by
default, uses the dispersion
estimate that matches the logLik()
output. This is based
on the deviance divided by the number of observations, n. Alternatively,
dispersion = "Chisquared"
uses the estimate employed in the summary()
method,
based on the Chi-squared statistic divided by the residual degrees of freedom, n - k.support()
method
for GEV-based distributions (GEV()
, GP()
, Gumbel()
, Frechet()
). Added a
random()
method for the Tukey()
distribution (using the inversion method).apply_dpqr()
helps to apply the standard d
/p
/q
/r
functions
available in base R and many packages. The accompanying manual page provides some
worked examples and further guidance.distributions3
to go from basic probability
theory to probabilistic regression models. Illustrated with Poisson GLMs for the
number of goals per team in the 2018 FIFA World Cup explained by the teams' ability
differences. (#74)prodist()
to extract fitted (in-sample) or predicted (out-of-sample)
probability distributions from model objects like lm
, glm
, or arima
. (#83)distributions3
for CRANNEWS.md
file to track changes to the package.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.