Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions R/utils_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
probs <- c(alpha / 2, 1 - alpha / 2)

lambda <- f * df
init <- rep(ifelse(lambda < 2, 2, lambda / 2), 2)
ncp <- suppressWarnings(stats::optim(
par = 1.1 * rep(lambda, 2),
par = init,
fn = function(x) {
quan <- stats::qf(p = probs, df, df_error, ncp = x)
sum(abs(quan - f))
Expand All @@ -28,7 +29,7 @@
f_ncp[1] <- 0
}

return(f_ncp)

Check warning on line 32 in R/utils_ci.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_ci.R,line=32,col=3,[return_linter] Use implicit return behavior; explicit return() is not needed.
}

#' @keywords internal
Expand All @@ -39,9 +40,9 @@

alpha <- 1 - conf.level
probs <- c(alpha / 2, 1 - alpha / 2)

init <- rep(ifelse(abs(t) < 2, sign(t) * 2, t / 2), 2)
ncp <- suppressWarnings(stats::optim(
par = 1.1 * rep(t, 2),
par = init,
fn = function(x) {
quan <- stats::qt(p = probs, df = df_error, ncp = x)
sum(abs(quan - t))
Expand All @@ -51,7 +52,7 @@

t_ncp <- unname(sort(ncp$par))

return(t_ncp)

Check warning on line 55 in R/utils_ci.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_ci.R,line=55,col=3,[return_linter] Use implicit return behavior; explicit return() is not needed.
}

#' @keywords internals
Expand All @@ -62,9 +63,9 @@

alpha <- 1 - conf.level
probs <- c(alpha / 2, 1 - alpha / 2)

init <- rep(ifelse(chisq < 2, 2, chisq / 2), 2)
ncp <- suppressWarnings(stats::optim(
par = 1.1 * rep(chisq, 2),
par = init,
fn = function(x) {
quan <- stats::qchisq(p = probs, df, ncp = x)
sum(abs(quan - chisq))
Expand Down
Loading