Skip to content

Commit

Permalink
🐦 New CRAN release.
Browse files Browse the repository at this point in the history
* Styling.
* Fixing links.
  • Loading branch information
JonasMoss committed Jan 25, 2022
1 parent ea38fbf commit 2ae9f2e
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 33 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.1.1
Date: 2022-01-23 16:03:59 UTC
SHA: e0eb796c80240cbb920bb6a05838592f1bd3388a
Date: 2022-01-25 13:09:13 UTC
SHA: ea38fbf0dc9920414a9342b2c5fa8db91e1c5c7a
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Suggests:
covr
RoxygenNote: 7.1.2
VignetteBuilder: knitr
URL: https://github.com/JonasMoss/univariateML
URL: https://github.com/JonasMoss/univariateML, https://jonasmoss.github.io/univariateML/
BugReports: https://github.com/JonasMoss/univariateML/issues
Roxygen: list(markdown = TRUE)
1 change: 0 additions & 1 deletion R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#' from = 0, to = 20,
#' main = "Logarithm of Density", ylab = NA, lwd = 2
#' )
#'
#' @name MaximumLikelihoodDistribution
#' @export
dml <- function(x, obj, log = FALSE) {
Expand Down
3 changes: 2 additions & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ to_univariateML <- function(y, obj) {
"obj must be either a function returning a univariateML ",
"object or an univariateML object."
)
tryCatch({
tryCatch(
{
obj <- obj(y)
},
error = function(cond) stop(msg)
Expand Down
2 changes: 1 addition & 1 deletion R/mlgumbel.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mlgumbel <- function(x, na.rm = FALSE, ...) {

## Given the sigma, the mu is easy to compute.
mu <- -sigma * log(mean(exp(-x / sigma)))
S <- mean(exp(- (x - mu) / sigma))
S <- mean(exp(-(x - mu) / sigma))


object <- c(mu = mu, sigma = sigma)
Expand Down
2 changes: 1 addition & 1 deletion R/mlinvgamma.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mlinvgamma <- function(x, na.rm = FALSE, ...) {
attr(object, "density") <- "extraDistr::dinvgamma"
attr(object, "logLik") <-
unname(length(x) * (alpha * log(beta) - log(gamma(alpha)) +
- (alpha + 1) * L - beta * M))
-(alpha + 1) * L - beta * M))
attr(object, "support") <- c(0, Inf)
attr(object, "n") <- length(x)
attr(object, "call") <- match.call()
Expand Down
4 changes: 2 additions & 2 deletions R/mlllogis.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ mlllogis <- function(x, na.rm = FALSE, ...) {

object <- mllogis(y)
object[1] <- exp(-object[1])
object[2] <- 1/object[2]
object = rev(object)
object[2] <- 1 / object[2]
object <- rev(object)
class(object) <- "univariateML"
names(object) <- c("shape", "rate")

Expand Down
2 changes: 1 addition & 1 deletion R/mlweibull.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mlweibull <- function(x, na.rm = FALSE, ...) {
}

## Given the shape, the scale is easy to compute.
scale <- (mean(x^shape)) ^ (1 / shape)
scale <- (mean(x^shape))^(1 / shape)
shape_sum <- mean(x^shape)
n <- length(x)
object <- c(shape = shape, scale = scale)
Expand Down
16 changes: 8 additions & 8 deletions R/model_select.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#' @export

model_select <- function(x, models = univariateML_models,
criterion = c("aic", "bic", "loglik"),
na.rm = FALSE, ...) {
criterion = c("aic", "bic", "loglik"),
na.rm = FALSE, ...) {
check_models(models)
criterion <- match.arg(criterion)

Expand All @@ -40,14 +40,13 @@ model_select <- function(x, models = univariateML_models,
error_inds <- sapply(fits, function(fit) inherits(fit, "try-error"))
if (all(error_inds)) {
error_msgs <- sapply(fits[error_inds], as.character)
details <- paste0("(", names(error_msgs), ") ", error_msgs)
details <- paste0("(", names(error_msgs), ") ", error_msgs)
stop("couldn't fit any model.\n", details)
}

## select best model
fits <- fits[!error_inds]
crits <- switch(
criterion,
crits <- switch(criterion,
"loglik" = -sapply(fits, stats::logLik),
"aic" = sapply(fits, stats::AIC),
"bic" = sapply(fits, stats::BIC)
Expand All @@ -67,7 +66,8 @@ check_models <- function(models) {
if (any(!is_implemented)) {
stop(
"The following families are not implemented: ",
paste0(models[!is_implemented], collapse = ", "),
".\n See `print(univariateML_models)` for allowed values.")
paste0(models[!is_implemented], collapse = ", "),
".\n See `print(univariateML_models)` for allowed values."
)
}
}
}
4 changes: 1 addition & 3 deletions R/probability_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ qqmlline <- function(y, obj, datax = FALSE, probs = c(0.25, 0.75), qtype = 7,
if (datax) {
slope <- diff(x) / diff(y)
int <- x[1L] - slope * y[1L]
}

else {
} else {
slope <- diff(y) / diff(x)
int <- y[1L] - slope * x[1L]
}
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ set.seed(313)
```

## Overview
[`univariateML`](https://jonasmoss.github.io/index.html) is an `R`-package for
[`univariateML`](https://jonasmoss.github.io/univariateML/index.html) is an `R`-package for
user-friendly maximum likelihood estimation of a
[selection](https://jonasmoss.github.io/articles/distributions.html) of parametric univariate densities. In addition to basic estimation capabilities,
[selection](https://jonasmoss.github.io/univariateML/articles/distributions.html) of parametric univariate densities. In addition to basic estimation capabilities,
this package support visualization through `plot` and `qqmlplot`, model selection
by `AIC` and `BIC`, confidence sets through the parametric bootstrap with
`bootstrapml`, and convenience functions such as the density, distribution
Expand Down Expand Up @@ -124,9 +124,9 @@ testing, see the `tests` folder for details.

## Documentation
For an overview of the package and its features see the
[overview vignette](https://jonasmoss.github.io/articles/overview.html).
[overview vignette](https://jonasmoss.github.io/univariateML/articles/overview.html).
For an illustration of how this package can make an otherwise long and
laborious process much simpler, see the [copula vignette](https://jonasmoss.github.io/articles/copula.html).
laborious process much simpler, see the [copula vignette](https://jonasmoss.github.io/univariateML/articles/copula.html).

## How to Contribute or Get Help

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.re

## Overview

[`univariateML`](https://jonasmoss.github.io/index.html) is an
`R`-package for user-friendly maximum likelihood estimation of a
[selection](https://jonasmoss.github.io/articles/distributions.html) of
parametric univariate densities. In addition to basic estimation
[`univariateML`](https://jonasmoss.github.io/univariateML/index.html) is
an `R`-package for user-friendly maximum likelihood estimation of a
[selection](https://jonasmoss.github.io/univariateML/articles/distributions.html)
of parametric univariate densities. In addition to basic estimation
capabilities, this package support visualization through `plot` and
`qqmlplot`, model selection by `AIC` and `BIC`, confidence sets through
the parametric bootstrap with `bootstrapml`, and convenience functions
Expand Down Expand Up @@ -123,10 +123,10 @@ to testing, see the `tests` folder for details.
## Documentation

For an overview of the package and its features see the [overview
vignette](https://jonasmoss.github.io/articles/overview.html). For an
illustration of how this package can make an otherwise long and
vignette](https://jonasmoss.github.io/univariateML/articles/overview.html).
For an illustration of how this package can make an otherwise long and
laborious process much simpler, see the [copula
vignette](https://jonasmoss.github.io/articles/copula.html).
vignette](https://jonasmoss.github.io/univariateML/articles/copula.html).

## How to Contribute or Get Help

Expand Down
1 change: 0 additions & 1 deletion man/MaximumLikelihoodDistribution.Rd

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

1 change: 1 addition & 0 deletions man/univariateML-package.Rd

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

0 comments on commit 2ae9f2e

Please sign in to comment.