Skip to content

Commit

Permalink
avoid loaded term
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Oct 5, 2023
1 parent 1c68048 commit 8ef0626
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion R/check_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ check_distribution.numeric <- function(model) {
# utilities -----------------------------

.extract_features <- function(x) {
# sanity check, remove missings
# validation check, remove missings
x <- x[!is.na(x)]

data.frame(
Expand Down
7 changes: 3 additions & 4 deletions R/check_factorstructure.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ check_factorstructure <- function(x, n = NULL, ...) {
#' @rdname check_factorstructure
#' @export
check_kmo <- function(x, n = NULL, ...) {
out <- .check_factor_structure_sanity(x, n, ...)
out <- .validate_factor_structure(x, n, ...)

Q <- solve(out$r)

Expand Down Expand Up @@ -177,7 +177,7 @@ check_kmo <- function(x, n = NULL, ...) {
#' @rdname check_factorstructure
#' @export
check_sphericity_bartlett <- function(x, n = NULL, ...) {
out <- .check_factor_structure_sanity(x, n, ...)
out <- .validate_factor_structure(x, n, ...)

p <- dim(out$r)[2]

Expand Down Expand Up @@ -221,15 +221,14 @@ check_sphericity_bartlett <- function(x, n = NULL, ...) {
# Helpers -----------------------------------------------------------------

#' @keywords internal
.check_factor_structure_sanity <- function(x, n = NULL, ...) {
.validate_factor_structure <- function(x, n = NULL, ...) {
if (is.null(n)) {
r <- stats::cor(x, use = "pairwise.complete.obs", ...)
n <- nrow(x)
} else {
r <- x
}

# Sanity check
if (nrow(r) != ncol(r)) {
insight::format_error("The correlation matrix is not square.")
}
Expand Down
2 changes: 1 addition & 1 deletion R/check_model_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
fitted_ <- stats::fitted(model)
}

# sanity check, sometimes either residuals or fitted can contain NA, see #488
# validation check, sometimes either residuals or fitted can contain NA, see #488
if (anyNA(res_) || anyNA(fitted_)) {
# drop NA and make sure both fitted and residuals match
non_na <- !is.na(fitted_) & !is.na(res_)
Expand Down
2 changes: 1 addition & 1 deletion R/check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ check_outliers.metabin <- check_outliers.metagen

# Get results
cutoff <- .safe(outliers@ics.dist.cutoff)
# sanity check
# validation check
if (is.null(cutoff)) {
insight::print_color("Could not detect cut-off for outliers.\n", "red")
return(NULL)
Expand Down
6 changes: 3 additions & 3 deletions R/check_predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pp_check.lm <- function(object,
# else, proceed as usual
out <- .safe(stats::simulate(object, nsim = iterations, re.form = re_formula, ...))

# sanity check, for mixed models, where re.form = NULL (default) might fail
# validation check, for mixed models, where re.form = NULL (default) might fail
out <- .check_re_formula(out, object, iterations, re_formula, verbose, ...)

# save information about model
Expand Down Expand Up @@ -270,7 +270,7 @@ pp_check.glm <- function(object,
}
)

# sanity check, for mixed models, where re.form = NULL (default) might fail
# validation check, for mixed models, where re.form = NULL (default) might fail
out <- .check_re_formula(out, object, iterations, re_formula, verbose, ...)

if (is.null(out)) {
Expand Down Expand Up @@ -444,7 +444,7 @@ plot.performance_pp_check <- function(x, ...) {


.check_re_formula <- function(out, object, iterations, re_formula, verbose, ...) {
# sanity check, for mixed models, where re.form = NULL (default) might fail
# validation check, for mixed models, where re.form = NULL (default) might fail
if (is.null(out) && insight::is_mixed_model(object) && !isTRUE(is.na(re_formula))) {
if (verbose) {
insight::format_warning(
Expand Down
2 changes: 1 addition & 1 deletion R/check_sphericity.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ check_sphericity.Anova.mlm <- function(x, ...) {

p.val <- test[, 2]

# sanity check
# validation check
if (is.null(p.val)) {
p.val <- 1
}
Expand Down
4 changes: 2 additions & 2 deletions R/icc.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ icc <- function(model,
# CI for adjusted ICC
icc_ci_adjusted <- as.vector(result$t[, 1])
icc_ci_adjusted <- icc_ci_adjusted[!is.na(icc_ci_adjusted)]
# sanity check
# validation check
if (length(icc_ci_adjusted) > 0) {
icc_ci_adjusted <- bayestestR::eti(icc_ci_adjusted, ci = ci)
} else {
Expand All @@ -276,7 +276,7 @@ icc <- function(model,
# CI for unadjusted ICC
icc_ci_unadjusted <- as.vector(result$t[, 2])
icc_ci_unadjusted <- icc_ci_unadjusted[!is.na(icc_ci_unadjusted)]
# sanity check
# validation check
if (length(icc_ci_unadjusted) > 0) {
icc_ci_unadjusted <- bayestestR::eti(icc_ci_unadjusted, ci = ci)
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/r2_nakagawa.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ r2_nakagawa <- function(model,
# CI for marginal R2
r2_ci_marginal <- as.vector(result$t[, 1])
r2_ci_marginal <- r2_ci_marginal[!is.na(r2_ci_marginal)]
# sanity check
# validation check
if (length(r2_ci_marginal) > 0) {
r2_ci_marginal <- bayestestR::eti(r2_ci_marginal, ci = ci)
} else {
Expand All @@ -146,7 +146,7 @@ r2_nakagawa <- function(model,
# CI for unadjusted R2
r2_ci_conditional <- as.vector(result$t[, 2])
r2_ci_conditional <- r2_ci_conditional[!is.na(r2_ci_conditional)]
# sanity check
# validation check
if (length(r2_ci_conditional) > 0) {
r2_ci_conditional <- bayestestR::eti(r2_ci_conditional, ci = ci)
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/test_bf.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_bf.default <- function(..., reference = 1, text_length = NULL) {
objects <- insight::ellipsis_info(..., only_models = TRUE)
names(objects) <- match.call(expand.dots = FALSE)$`...`

# Sanity checks (will throw error if non-valid objects)
# validation checks (will throw error if non-valid objects)
.test_performance_checks(objects, multiple = FALSE)

if (length(objects) == 1 && isTRUE(insight::is_model(objects))) {
Expand Down
2 changes: 1 addition & 1 deletion R/test_likelihoodratio.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test_likelihoodratio.default <- function(..., estimator = "OLS", verbose = TRUE)
# Attribute class to list
objects <- insight::ellipsis_info(..., only_models = TRUE)

# Sanity checks (will throw error if non-valid objects)
# validation checks (will throw error if non-valid objects)
objects <- .test_performance_checks(objects, verbose = verbose)

# different default when mixed model or glm is included
Expand Down
2 changes: 1 addition & 1 deletion R/test_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ test_performance.default <- function(..., reference = 1, include_formula = FALSE
# Attribute class to list and get names from the global environment
objects <- insight::ellipsis_info(..., only_models = TRUE)

# Sanity checks (will throw error if non-valid objects)
# validation checks (will throw error if non-valid objects)
objects <- .test_performance_checks(objects, verbose = verbose)

# ensure proper object names
Expand Down
2 changes: 1 addition & 1 deletion R/test_vuong.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_vuong.default <- function(..., reference = 1, verbose = TRUE) {
# Attribute class to list and get names from the global environment
objects <- insight::ellipsis_info(..., only_models = TRUE)

# Sanity checks (will throw error if non-valid objects)
# validation checks (will throw error if non-valid objects)
objects <- .test_performance_checks(objects, verbose = verbose)

# ensure proper object names
Expand Down
2 changes: 1 addition & 1 deletion R/test_wald.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_wald.default <- function(..., verbose = TRUE) {
# Attribute class to list and get names from the global environment
objects <- insight::ellipsis_info(..., only_models = TRUE)

# Sanity checks (will throw error if non-valid objects)
# validation checks (will throw error if non-valid objects)
objects <- .test_performance_checks(objects, verbose = verbose)

# ensure proper object names
Expand Down

0 comments on commit 8ef0626

Please sign in to comment.