knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(out.width='750px', dpi=200) set.seed(313)
An R
-package for the Nakagami distribution.
Use the following command from inside R
:
# install.packages("devtools") devtools::install_github("JonasMoss/nakagami")
The density function is dnaka
, the probability distribution is pnaka
,
the quantile function is qnaka
and random deviate generator is rnaka
. Use
them just like the *gamma
functions in the stats
package.
set.seed(313) x = seq(0, 3, by = 0.01) hist(nakagami::rnaka(10^5, shape = 4, scale = 2), freq = FALSE, breaks = "FD") lines(x, nakagami::dnaka(x, shape = 4, scale = 2), type = "l", lwd = 2)
All of these functions are implemented in the R
package VGAM
. As of VGAM
version 1.1-2,
the implementations in nakagami
are faster, more thoroughly tested, and use
a standardized set of arguments following the template of dgamma
et cetera.
The rnaka
of nakagami
is much faster than the rnaka
of VGAM
:
#install.packages("VGAM") microbenchmark::microbenchmark(nakagami::rnaka(100, 2, 4), VGAM::rnaka(100, 4, 2))
And the quantile function of nakagami
is slightly faster.
p = 1:10/11 microbenchmark::microbenchmark(nakagami::qnaka(0.01, 10, 4), VGAM::qnaka(0.01, 4, 10))
Moreover, VGAM::qnaka
fails to implement the standard argument log.p
and
VGAM::rnaka
uses the non-standard arguments Smallno
and ...
.
If you encounter a bug, have a feature request or need some help, open a Github issue.
This project follows a Contributor Code of Conduct.
Nakagami, N. 1960. “The m-Distribution, a General Formula of Intensity of Rapid Fading.” In Statistical Methods in Radio Wave Propagation: Proceedings of a Symposium Held at the University of California, June 18–20, 1958, edited by William C. Hoffman, 3–36. Permagon Press. https://doi.org/10.1016/B978-0-08-009306-2.50005-4.
Yee TW (2010). “The VGAM Package for Categorical Data Analysis.” Journal of Statistical Software, 32(10), 1–34. https://www.jstatsoft.org/v32/i10/.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.