Skip to content

Commit

Permalink
Merge pull request #457 from spsanderson/development
Browse files Browse the repository at this point in the history
prep for CRAN
  • Loading branch information
spsanderson authored Apr 25, 2024
2 parents fbe3e8b + 96a465f commit 1626587
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
6 changes: 4 additions & 2 deletions R/utils-aic-beta.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
#' @details
#' Initial parameter estimates: The choice of initial values can impact the
#' convergence of the optimization.
#'
#' Optimization method: You might explore different optimization methods within
#' optim for potentially better performance.
#' Data transformation: Depending on your data, you may need to apply
#' transformations (e.g., scaling to [0,1] interval) before fitting the beta
#' transformations (e.g., scaling to `[0,1]` interval) before fitting the beta
#' distribution.
#'
#' Goodness-of-fit: While AIC is a useful metric for model comparison, it's
#' recommended to also assess the goodness-of-fit of the chosen model using
#' visualization and other statistical tests.
Expand Down Expand Up @@ -65,7 +67,7 @@ util_beta_aic <- function(.x) {

# Fit beta distribution using optim
fit_beta <- stats::optim(
c(trunc(pe$shape1), trunc(pe$shape2), 0),
c(round(pe$shape1, 0), round(pe$shape2, 0), 0),
neg_log_lik_beta,
data = x
)
Expand Down
7 changes: 4 additions & 3 deletions R/utils-aic-chisq.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#'
#' @examples
#' # Example 1: Calculate AIC for a sample dataset
#' data <- c(1, 2, 3, 4, 5)
#' util_chisq_aic(data)
#' set.seed(123)
#' x <- rchisq(30, df = 3)
#' util_chisq_aic(x)
#'
#' @return
#' The AIC value calculated based on the fitted chi-square distribution to the provided data.
Expand All @@ -40,7 +41,7 @@ util_chisq_aic <- function(.x) {

# Fit chi-square distribution to sample data (rchisq)
fit_chisq <- stats::optim(
c(pe$degrees_of_freedom, pe$ncp),
c(pe$dof, pe$ncp),
neg_log_lik_chisq,
data = x
)
Expand Down
2 changes: 1 addition & 1 deletion R/utils-aic-logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#' # Example 1: Calculate AIC for a sample dataset
#' set.seed(123)
#' x <- rlogis(30)
#' util_logistic_aic(data)
#' util_logistic_aic(x)
#'
#' @return
#' The AIC value calculated based on the fitted logistic distribution to the provided data.
Expand Down
2 changes: 1 addition & 1 deletion R/utils-check-dupe-rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @description
#' This function checks for duplicate rows in a data frame.
#'
#' @param data A data frame.
#' @param .data A data frame.
#' @return A logical vector indicating whether each row is a duplicate or not.
#' @details This function checks for duplicate rows by comparing each row in the
#' data frame to every other row. If a row is identical to another row, it is
Expand Down
2 changes: 1 addition & 1 deletion man/check_duplicate_rows.Rd

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

4 changes: 3 additions & 1 deletion man/util_beta_aic.Rd

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

5 changes: 3 additions & 2 deletions man/util_chisq_aic.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/util_logistic_aic.Rd

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

0 comments on commit 1626587

Please sign in to comment.