Skip to content

Commit

Permalink
Merge pull request #31 from JonasMoss/cran-release
Browse files Browse the repository at this point in the history
Cran release
  • Loading branch information
JonasMoss authored Dec 18, 2019
2 parents 0a0c699 + 6969efb commit 046b72b
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 76 deletions.
2 changes: 2 additions & 0 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This package was submitted to CRAN on 2019-12-13.
Once it is accepted, delete this file and tag the release (commit f9cfbd05c9).
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Authors@R: c(
person("Jonas", "Moss", , "jonas.gjertsen@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-6876-6964")
))
Description: User-friendly maximum likelihood estimation of univariate
densities.
Description: User-friendly maximum likelihood estimation (Fisher (1921)
<doi:10.1098/rsta.1922.0009>) of univariate densities.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
# MIT License

Copyright (c) 2019 Jonas Moss

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2019
COPYRIGHT HOLDER: Jonas Moss
2 changes: 1 addition & 1 deletion R/bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#'
#' @seealso [confint()] for an application of `bootstrapml`.
#' @examples
#' \dontrun{
#' \donttest{
#' set.seed(1)
#' object <- mlgamma(mtcars$qsec)
#'
Expand Down
14 changes: 1 addition & 13 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,14 @@
#' obj <- mlnorm(airquality$Wind)
#' dml(0.5, obj) == dnorm(0.5, mean = obj[1], sd = obj[2])
#'
#' ## We study the Beta prime model applied to the airquality data set.
#' obj <- mlbetapr(airquality$Wind)
#'
#' ## Example copied from 'stats::dnorm'.
#' par(mfrow = c(2, 1))
#' # Plot the logarithm of the beta prime distribution.
#' plot(function(x) dml(x, obj, log = TRUE),
#' from = 0, to = 20,
#' main = "Logarithm of Density", ylab = NA, lwd = 2
#' )
#' curve(log(dml(x, obj)), add = TRUE, col = "red", lwd = 2, lty = 2)
#' mtext("dml(x, obj, log = TRUE)", adj = 0)
#' mtext("log(dml(x, obj))", col = "red", adj = 1)
#'
#' plot(function(x) pml(x, obj, log = TRUE),
#' from = 0, to = 20,
#' main = "Logarithm of Cumulative Probability", ylab = NA, lwd = 2
#' )
#' curve(log(pml(x, obj)), add = TRUE, col = "red", lwd = 2, lty = 2)
#' mtext("pml(x, obj, log = TRUE)", adj = 0)
#' mtext("log(pml(x, obj))", col = "red", adj = 1)
#' @name MaximumLikelihoodDistribution
#' @export
dml <- function(x, obj, log = FALSE) {
Expand Down
9 changes: 8 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ knitr::opts_chunk$set(
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/JonasMoss/univariateML?branch=master&svg=true)](https://ci.appveyor.com/project/JonasMoss/univariateML)
[![Coverage Status](https://codecov.io/gh/JonasMoss/univariateML/branch/master/graph/badge.svg)](https://codecov.io/gh/JonasMoss/univariateML?branch=master)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.01863/status.svg)](https://doi.org/10.21105/joss.01863)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/univariateML)](https://cran.r-project.org/package=univariateML)

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
Expand All @@ -37,8 +39,13 @@ function, quantile function, and random sampling at the estimated distribution
parameters.

## Installation
Use the following command from inside `R`:
Use the following command from inside `R` to install from CRAN.
```{r install, echo = TRUE, eval = FALSE}
install.packages("univariateML")
```

Or install the development version from Github.
```{r install_github, echo = TRUE, eval = FALSE}
# install.packages("devtools")
devtools::install_github("JonasMoss/univariateML")
```
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Status](https://codecov.io/gh/JonasMoss/univariateML/branch/master/graph/badge.s
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.01863/status.svg)](https://doi.org/10.21105/joss.01863)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/univariateML)](https://cran.r-project.org/package=univariateML)

## Overview

Expand All @@ -27,7 +29,13 @@ random sampling at the estimated distribution parameters.

## Installation

Use the following command from inside `R`:
Use the following command from inside `R` to install from CRAN.

``` r
install.packages("univariateML")
```

Or install the development version from Github.

``` r
# install.packages("devtools")
Expand Down Expand Up @@ -74,9 +82,9 @@ microbenchmark::microbenchmark(
univariateML = univariateML::mlbeta(x),
naive = nlm(function(p) -sum(dbeta(x, p[1], p[2], log = TRUE)), p = c(1, 1)))
#> Unit: microseconds
#> expr min lq mean median uq max neval
#> univariateML 864.2 1102.90 1305.743 1192.30 1340.95 6007.9 100
#> naive 36398.0 39097.35 41108.804 40530.15 43035.50 50693.3 100
#> expr min lq mean median uq max neval
#> univariateML 925.401 1339.002 2309.141 1708.051 2065.551 41581.2 100
#> naive 44287.601 47740.601 54418.306 51779.401 57391.700 104036.7 100
```

The maximum likelihood estimators in this package have all been subject
Expand Down
18 changes: 18 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Resubmission

* Added reference to Fisher (1921) for maximum likelihood estimation.
* Removed installation of packages in copula vignette.
* Replaced \dontrun{} by \donttest{} in Rd-files.
* Removed examples using par(mfrow = c(2, 1))

## Test environments
* local Windows 10, R version R version 3.6.1
* Windows Server 2012 (on AppVeyor) R version 3.6.1 Patched (2019-10-31 r77367)
* Ubuntu 14.04.5 LTS (on Travis-CI), R version 3.6.1, R-oldrel, R-devel.
* macOS 10.13.3 (on Travis-CI), R version 3.6.1

## R CMD check results
There were no ERRORs, WARNINGs or NOTEs.

## Downstream dependencies
There are no downstream dependencies.
16 changes: 16 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
citHeader("To cite univariateML in publications, please use:")

citEntry(entry="Article",
doi = "10.21105/joss.01863",
url = "https://doi.org/10.21105/joss.01863",
year = "2019",
month = "dec",
publisher = "The Open Journal",
volume = "4",
number = "44",
pages = "1863",
author = "Jonas Moss",
title = "univariateML: An R package for maximum likelihood estimation of univariate densities",
journal = "Journal of Open Source Software",
textVersion = "Moss, (2019). univariateML: An R package for maximum likelihood estimation of univariate densities. Journal of Open Source Software, 4(44), 1863, https://doi.org/10.21105/joss.01863"
)
14 changes: 1 addition & 13 deletions man/MaximumLikelihoodDistribution.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/bootstrapml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions vignettes/copula.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ vignette: >
bibliography: copula.bib
---

```{R depends, echo = FALSE}
if (!require("copula")) install.packages("copula",
dependencies = TRUE,
repos = "http://cran.us.r-project.org")
if (!require("dplyr")) install.packages("dplyr",
dependencies = TRUE,
repos = "http://cran.us.r-project.org")
```

This vignette shows how to model multivariate distributions with
[copulas](https://en.wikipedia.org/wiki/Copula_(probability_theory))
using `univariateML` and the `copula` package.
Expand Down
Binary file modified vignettes/figure/bootstrap_example_histogram-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vignettes/overview.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ summary(mlweibull(egypt$age))
```

## Quantile-quantile Plots
Now we will investigate how the two models differ with [https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot](quantile-quantile plots), or Q-Q plots for short.
Now we will investigate how the two models differ with [quantile-quantile plots](https://en.wikipedia.org/wiki/Q-Q_plot), or Q-Q plots for short.

```{r, qqplots}
qqmlplot(egypt$age, mlweibull, datax = TRUE, main = "QQ Plot for Ancient Egypt")
Expand Down
18 changes: 9 additions & 9 deletions vignettes/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ summary(mlweibull(egypt$age))
```

## Quantile-quantile Plots
Now we will investigate how the two models differ with [https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot](quantile-quantile plots), or Q-Q plots for short.
Now we will investigate how the two models differ with [quantile-quantile plots](https://en.wikipedia.org/wiki/Q-Q_plot), or Q-Q plots for short.


```r
Expand Down Expand Up @@ -182,8 +182,8 @@ bootstrapml(mlweibull(egypt$age)) # same as confint(mlweibull(egypt$age))

```
## 2.5% 97.5%
## shape 1.250344 1.616963
## scale 29.607607 37.750506
## shape 1.246644 1.614056
## scale 29.301693 38.126512
```

```r
Expand All @@ -192,8 +192,8 @@ bootstrapml(mlgamma(egypt$age))

```
## 2.5% 97.5%
## shape 1.34432954 2.03663781
## rate 0.04113922 0.06793162
## shape 1.33568486 2.04379587
## rate 0.04193431 0.06895511
```

These confidence intervals are not directly comparable. That is, the `scale` parameter in
Expand All @@ -218,7 +218,7 @@ bootstrapml(mlweibull(egypt$age),

```
## 5% 95%
## 27.62843 33.73309
## 27.53889 33.76252
```

```r
Expand All @@ -230,7 +230,7 @@ bootstrapml(mlgamma(egypt$age),

```
## 5% 95%
## 27.53158 33.91414
## 27.31093 34.40263
```

We are be interested in the quantiles of the underlying distribution,
Expand All @@ -246,7 +246,7 @@ bootstrapml(mlweibull(egypt$age),

```
## 5% 95%
## 23.03270 28.99678
## 22.93329 28.84853
```

```r
Expand All @@ -257,7 +257,7 @@ bootstrapml(mlgamma(egypt$age),

```
## 5% 95%
## 21.83003 27.51890
## 21.81757 27.57722
```

We can also plot the bootstrap samples.
Expand Down

0 comments on commit 046b72b

Please sign in to comment.