Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a654351
commit 67a4032
Showing
55 changed files
with
2,033 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
Package: LindleyR | ||
Type: Package | ||
Title: The Lindley Distribution and Its Modifications | ||
Version: 1.0.0 | ||
Version: 1.1.0 | ||
License: GPL (>= 2) | ||
Date: 2016-05-22 | ||
Author: Josmar Mazucheli and Larissa B. Fernandes | ||
Author: Josmar Mazucheli, Larissa B. Fernandes and Ricardo P. de Oliveira | ||
Maintainer: Josmar Mazucheli <jmazucheli@gmail.com> | ||
Description: Implements the probability density function, quantile function, | ||
cumulative distribution function, random number generation and the hazard rate function for | ||
the continuous one-parameter Lindley distribution as well as for 15 of its modifications. Also | ||
is it possible to draw censored random samples, with a desired censoring rate, when the event | ||
times are any continuous lifetime distribution supported by R. | ||
Depends: R (>= 3.0.2), actuar, LambertW, VGAM, zipfR | ||
Imports: stats | ||
Suggests: fitdistrplus | ||
Description: Computes the probability density, the cumulative distribution, the quantile and | ||
the hazard rate functions and generates random deviates from the discrete and continuous | ||
Lindley distribution as well as for 19 of its modifications. It also generates censored | ||
random deviates from any probability distribution available in R. | ||
Depends: R (>= 3.0.2) | ||
Imports: lamW (>= 1.1.1), stats | ||
Suggests: fitdistrplus (>= 1.0-6) | ||
RoxygenNote: 5.0.1 | ||
Encoding: UTF-8 | ||
NeedsCompilation: no | ||
Packaged: 2016-05-22 18:30:17 UTC; josmar | ||
Packaged: 2016-06-23 16:51:46 UTC; josmar | ||
Repository: CRAN | ||
Date/Publication: 2016-05-22 22:54:21 | ||
Date/Publication: 2016-06-23 19:40:34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,53 @@ | ||
3110ade362028c1e45bcdfd055536947 *DESCRIPTION | ||
f86f8b4da925652b95847efb9ddd75f3 *NAMESPACE | ||
aa2b5c8221c3583c6d07dc1ad80bcb2e *NEWS | ||
e7d864bbac2868f649ed07e1d563b730 *R/EXPLindley.R | ||
6829df51461f0d6cdc68638ce7093261 *R/EXPPLindley.R | ||
e5d76a2674a02e40cf01389aab1d4597 *R/EXTILindley.R | ||
b6f02c36c696420e8561b9cad05d8ebd *R/EXTLindley.R | ||
411bc079b3171a7e36b9a27f1c52ba3c *R/EXTPLindley.R | ||
99d426486abd5ecc8b610dcaa5702d95 *R/GENILindley.R | ||
e4abb31c8d5ec82d546049060400c85b *R/GENLindley.R | ||
e2cb962bdcc0dddc18232824bde71e85 *R/ILindley.R | ||
1031f5e4fb78e69c02070fa0affc513e *R/Lindley.R | ||
d3e2f111f3b15345d6a61e1ea174055b *R/MOLindley.R | ||
80ead831eb5e4fcf94b4d85aa2747b65 *R/NWLindley.R | ||
4ef19f539bafd324972fc3b0e3abb683 *R/PLindley.R | ||
577187c474b36059d5705512e266cbde *R/QLindley.R | ||
c2adf7125c91b41f0adb98bd90651ae5 *R/Slindley.R | ||
c099bd719448eec53750a6e53314276d *R/TLindley.R | ||
970e86f1a6c447e7b97ef72e9e4850a5 *R/WLindley.R | ||
4a52f61c5288cc8fd237ed1cdfeeb913 *R/randcensor.R | ||
cde406f45897c6110b0d356d5056d2ad *man/EXPLindley.Rd | ||
0f0f7113037fd2a49f47a629f72f7065 *man/EXPPLindley.Rd | ||
2ff12cc835f0416bd201423c148840c7 *man/EXTILindley.Rd | ||
d484c24cef5cffc01e9dd969539be5be *man/EXTLindley.Rd | ||
8adc4ada15b9b041ade1af438dd59e8d *man/EXTPLindley.Rd | ||
8389637aecf24d828f1e76eab6bf8998 *man/GENILindley.Rd | ||
8802075d4205e41e5a60acf7542db5e7 *man/GENLindley.Rd | ||
229d3cfd8914b34b42b13617cb573576 *man/ILindley.Rd | ||
49a52675234acb84edcccf8dc4af0f99 *man/Lindley.Rd | ||
a29bacad07c84674028eb09028326bf2 *man/LindleyR-package.Rd | ||
729e279b2a1e6c96b273e96155732b38 *man/MOLindley.Rd | ||
80c7698d9fd710f95298f13fd5912e1c *man/NWLindley.Rd | ||
498bb5b010e436fc9a84bdbe2ace88c6 *man/PLindley.Rd | ||
ba2514d2ecbd408fdc85c4c65c163d70 *man/QLindley.Rd | ||
22ae5c4cfd98970e570dc61ae3fb258a *man/SLindley.Rd | ||
99ec0b7a2abf28c34afd08988e3a0358 *man/TLindley.Rd | ||
c43560f224d73934c50a61b4fe2e092d *man/WLindley.Rd | ||
0a0e1f45a58dd69e5072ad96e1bdd09d *man/randcensor.Rd | ||
307cd9cd775f5f8f043008ab8a4c6794 *DESCRIPTION | ||
38c9e78f2a03fcbc5aed93468672641e *NAMESPACE | ||
9720847639932c8bc3576dcd5358c6fb *NEWS.md | ||
af599670d83317c9c3f94c22fdef8bfd *R/DLindley.R | ||
7173ec5d92a6ecbd1880709273be7cf0 *R/DPLindley.R | ||
d82627c07948c86ed2038a7176155ee6 *R/DWLindley.R | ||
694dd3fd7483c3e92f957f3de43a00cb *R/EXPLindley.R | ||
0d2ce0c84607f1d4e8028e9437b98a2f *R/EXPPLindley.R | ||
095490c087b9987219bd72b49adb08bc *R/EXTILindley.R | ||
e0804bf61826032dd7bd41c300288577 *R/EXTLindley.R | ||
15c3357271601eae3695793f0a866be9 *R/EXTPLindley.R | ||
17f12960e14a636b4ef636615c3c367d *R/GAMLindley.R | ||
bbf60a35a53b19d00c43c9c69e2e78f3 *R/GENILindley.R | ||
0b95891134d3d199e809a5745f6a6a35 *R/GENLindley.R | ||
59691646b495d742fe7cc4a1ead70582 *R/ILindley.R | ||
8f94c475578dec8b4983e42d2fb7952a *R/Lindley.R | ||
e0f40361cdc63cfb4fc749b1c9f44085 *R/LindleyE.R | ||
8b3e37d7d4d25f73766597db91880c5e *R/MOLindley.R | ||
d978d92e3b3385346cb160cbbdd56dcf *R/NWLindley.R | ||
9ce6131eb4e29565ba5e5db973ec8233 *R/PLindley.R | ||
4b587e1c0e3b7f1bd7579382bbddd4cf *R/QLindley.R | ||
e09cdca34294bce537582083c4f222c3 *R/Slindley.R | ||
932ce1a499013c2890a2417103a2c2cf *R/TLindley.R | ||
5ccd92161562b158ee476f5fb6af8579 *R/WLindley.R | ||
d5e004ccedfc28f92f760a31c79a8c10 *R/randcensor.R | ||
a6f70e6fb806ad1c2b18bbad98ece086 *data/bladdercancer.RData | ||
c6bef98f462ae10ae06b81d15a5e2755 *data/carbonfibers.RData | ||
8f63c02d4aad93e6f6e2e7a820e2743d *data/fires.RData | ||
e8933284aa9ab0d59fd0d5a118ed9b5d *data/relieftimes.RData | ||
6002116a2c7eae3124e457477fc64f08 *data/waitingtimes.RData | ||
04be286257b68c01afb29c81a9fc166e *man/DLindley.Rd | ||
efffce8ea1cc4144e5486803553e769d *man/DPLindley.Rd | ||
37b998ca5e09b7ccfe3eb2a5060b3767 *man/DWLindley.Rd | ||
c8a576b5d03ed929699dbd483ed42d36 *man/EXPLindley.Rd | ||
243675f44581aac107808159b69f80fd *man/EXPPLindley.Rd | ||
d414561df77c9e649efe6035f9a9b4d1 *man/EXTILindley.Rd | ||
6d4b0f05bc44c6baea32ada6f510b98c *man/EXTLindley.Rd | ||
137d01941a5cd19c7696cbc70bfa9263 *man/EXTPLindley.Rd | ||
7ec6b70d6a72d07a59126bf41f6bd962 *man/GAMLindley.Rd | ||
28e0383f31e5bc3a904d287d32b296a9 *man/GENILindley.Rd | ||
205fda951607cdcebc1e50c7fe3254ce *man/GENLindley.Rd | ||
ee59b66c62be734aeb294e1aba33b8cd *man/ILindley.Rd | ||
765ea66389a5baaf5cc86a31925f50cd *man/Lindley.Rd | ||
2fecef355c255e5c352ae74c019f2f0f *man/LindleyE.Rd | ||
8497a5de9a0a28c081bf8076154282e7 *man/LindleyR-package.Rd | ||
008a87243c45716575db4ef347f3b731 *man/MOLindley.Rd | ||
41c61a179c235920d302217190bd5890 *man/NWLindley.Rd | ||
afab82654aa8d68c273b3c7a3ce5617f *man/PLindley.Rd | ||
e8e4ebf47e8b07ea32a4b4e0ef6bbc38 *man/QLindley.Rd | ||
b6601dd532c18bb26027009ab1178646 *man/SLindley.Rd | ||
873fb86c9819ace93dbae2e65eeb4ad7 *man/TLindley.Rd | ||
73237d6bfeff842ed93884ed3c533ad9 *man/WLindley.Rd | ||
5cfae323485fa8193fe1f967b5105bab *man/randcensor.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## LindleyR Update History | ||
|
||
2016-30-05 version 1.1.0 | ||
|
||
* dependence on LambertW package (W function) was replaced by lamW package (lambertWm1 function) | ||
|
||
* [d-p-q-r]dwlindley functions for the discrete weighted Lindley distribution were implemented | ||
|
||
* [d-p-q-r]dplindley functions for the discrete power Lindley distribution were implemented | ||
|
||
* [d-p-q-r]dlindley functions for the one-parameter discrete Lindley distribution were implemented | ||
|
||
* [d-h-p-q-r]gamlindley functions for the Gamma Lindley distribution were implemented | ||
|
||
* [d-h-p-q-r]lindleye functions for the Lindley exponential distribution were implemented | ||
|
||
* some examples using real data sets were included | ||
|
||
* dependence on packages actuar, VGAM and zipfR were suppressed | ||
|
||
* typographical errors in mathematical expressions were corrected | ||
|
||
* pwlindley was rewritten | ||
|
||
2016-20-05 version 1.0.0 | ||
|
||
* First package version submitted to CRAN (implements 16 continuous Lindley distributions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#' @name DLindley | ||
#' @aliases DLindley ddlindley pdlindley qdlindley rdlindley fires | ||
#' | ||
#' @title One-Parameter Discrete Lindley Distribution | ||
#' | ||
#' @description Probability mass function, distribution function, quantile function and random number generation for the one-parameter discrete Lindley distribution with parameter theta. | ||
#' | ||
#' @author Josmar Mazucheli \email{jmazucheli@gmail.com} | ||
#' @author Larissa B. Fernandes \email{lbf.estatistica@gmail.com} | ||
#' | ||
#' @references | ||
#' | ||
#' Bakouch, H. S., Jazi, M. A. and Nadarajah, S. (2014). A new discrete distribution. \emph{Statistics: A Journal of Theoretical and Applied Statistics}, \bold{48}, 1, 200-240. | ||
#' | ||
#' Gomez-Deniz, E. and Calderín-Ojeda, E. (2013). The discrete Lindley distribution: properties and applications. \emph{Journal of Statistical Computation and Simulation}, \bold{81}, 11, 1405-1416. | ||
#' | ||
#' @param x,q vector of integer positive quantiles. | ||
#' @param p vector of probabilities. | ||
#' @param n number of observations. If \code{length(n) > 1}, the length is taken to be the number required. | ||
#' @param theta positive parameter. | ||
#' @param log,log.p logical; If TRUE, probabilities p are given as log(p). | ||
#' @param lower.tail logical; If TRUE, (default), \eqn{P(X \leq x)} are returned, otherwise \eqn{P(X > x)}. | ||
#' | ||
#' @return \code{ddlindley} gives the probability mass function, \code{pdlindley} gives the distribution function, \code{qdlindley} gives the quantile function and \code{rdlindley} generates random deviates. | ||
#' @return Invalid arguments will return an error message. | ||
#' | ||
#' @seealso \code{\link[LindleyR]{Lindley}}. | ||
#' | ||
#' @source [d-p-q-r]dlindley are calculated directly from the definitions. \code{rdlindley} uses the discretize values. | ||
#' | ||
#' @details | ||
#' Probability mass function | ||
#' \deqn{P\left( X=x\mid \theta \right) =\sum\limits_{i=0}^{1}\left( -1\right) ^{i}\left( 1+\frac{\theta }{1+\theta }\left( x+i\right) \right) e^{-\theta \left( x+i\right) }} | ||
#' | ||
#' @examples | ||
#' set.seed(1) | ||
#' x <- rdlindley(n = 1000, theta = 1.5) | ||
#' plot(table(x) / sum(table(x))) | ||
#' points(unique(x),ddlindley(unique(x), theta = 1.5)) | ||
#' | ||
#' ## fires in Greece data (from Bakouch et al., 2014) | ||
#' data(fires) | ||
#' library(fitdistrplus) | ||
#' fit <- fitdist(fires, 'dlindley', start = list(theta = 0.30), discrete = TRUE) | ||
#' gofstat(fit, discrete = TRUE) | ||
#' plot(fit) | ||
#' | ||
#' @rdname DLindley | ||
#' @export | ||
ddlindley <- function(x, theta, log = FALSE) | ||
{ | ||
stopifnot(theta > 0, x >= 0) | ||
if(!isTRUE(all(x == floor(x)))) stop("'x' must only contain nonnegative integers") | ||
if(log) | ||
{ | ||
log(plindley(q = x, theta, lower.tail = FALSE) - plindley(q = x + 1, theta, lower.tail = FALSE)) | ||
} | ||
else | ||
{ | ||
plindley(q = x, theta, lower.tail = FALSE) - plindley(q = x + 1, theta, lower.tail = FALSE) | ||
} | ||
} | ||
|
||
#' @rdname DLindley | ||
#' @export | ||
pdlindley <- function(q, theta, lower.tail = TRUE, log.p = FALSE) | ||
{ | ||
if(lower.tail) | ||
{ | ||
cdf <- sapply(1:length(q), function(i) sum(ddlindley(x = 0:q[i], theta, log = FALSE))) | ||
} | ||
else | ||
{ | ||
cdf <- 0.1e1 - sapply(1:length(q), function(i) sum(x = ddlindley(0:q[i], theta, log = FALSE))) | ||
} | ||
if(log.p) return(log(cdf)) else return(cdf) | ||
} | ||
|
||
#' @rdname DLindley | ||
#' @export | ||
qdlindley <- function(p, theta, lower.tail = TRUE, log.p = FALSE) | ||
{ | ||
if(lower.tail) | ||
{ | ||
qtf <- floor(qlindley(p, theta, lower.tail = TRUE, log.p = FALSE)) | ||
} | ||
else | ||
{ | ||
qtf <- floor(qlindley(p, theta, lower.tail = FALSE, log.p = FALSE)) | ||
} | ||
if(log.p) return(log(qtf)) else return(qtf) | ||
} | ||
|
||
#' @rdname DLindley | ||
#' @export | ||
rdlindley <- function(n, theta) | ||
{ | ||
qdlindley(p = runif(n), theta, lower.tail = TRUE, log.p = FALSE) | ||
} |
Oops, something went wrong.