Skip to content

Commit

Permalink
import coef from stats
Browse files Browse the repository at this point in the history
oops
  • Loading branch information
mattansb committed Aug 19, 2021
1 parent 2336f85 commit 212d155
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ importFrom(stats,aov)
importFrom(stats,as.formula)
importFrom(stats,ave)
importFrom(stats,chisq.test)
importFrom(stats,coef)
importFrom(stats,complete.cases)
importFrom(stats,contrasts)
importFrom(stats,delete.response)
Expand Down
5 changes: 3 additions & 2 deletions R/convert_between_OR_to_RR.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' f7450.
#'
#' @export
oddsratio_to_riskratio <- function(OR, p0, log = FALSE) {
oddsratio_to_riskratio <- function(OR, p0, log = FALSE, ...) {
UseMethod("oddsratio_to_riskratio")
}

Expand All @@ -46,12 +46,13 @@ oddsratio_to_riskratio.default <- function(OR, p0, log = FALSE, ...) {
}

#' @export
#' @importFrom stats coef
oddsratio_to_riskratio.glm <- function(OR, p0, log = FALSE, ...) {
mi <- insight::model_info(OR)
if (!mi$is_binomial || !mi$is_logit) stop("Model must a binomial model with logit-link (logistic regression)")

if (used_intercept <- missing(p0)) {
p0 <- plogis(coef(OR)["(Intercept)"])
p0 <- plogis(stats::coef(OR)["(Intercept)"])
warning("'p0' not provided.",
"RR is relative to the intercept (p0 = ",
insight::format_value(p0),
Expand Down
2 changes: 1 addition & 1 deletion man/format_standardize.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/oddsratio_to_riskratio.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/print.effectsize_table.Rd

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

0 comments on commit 212d155

Please sign in to comment.