Poblem converting odds ratios to relative risk using the sjstats package

vicinity_data2$sex <- factor(vicinity_data2$sex)
model <- glm(dyslipidemia ~ ageyrs + age_cat + vegetable_intake + weight + fried_food_intake + beverage_intake + fruit_intake + educ_level + dest_cat + bmi_cat, family = "binomial", data = vicinity_data2[vicinity_data2$sex == "F", ])

tbl_logit <- tbl_regression(model,
label = tableby_labels,
exponentiate = TRUE) %>%
bold_labels() %>%
bold_p()

tbl_logit

#convert odds ratio to relative risk
install.packages('sjstats')
library('sjstats')
library('sjmisc')
library(lme4)
odds_to_rr(model)

I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex.

You may have noticed folks here requesting minimal reprexes, that's because asking questions this way saves answerers a lot of time.

Reproducible Examples:

  • help make your question clear and replicable
  • increases the probability folks will reach out and try to help,
  • reduces the number of back-and-forths required to understand the question,
  • and makes your question and suggested solutions more useful to folks in the future researching similar problems.

This function is defunct. Recommended replacement is effectsize::oddsratio_to_riskratio(). DescTools::ORToRelRisk() is another alternative.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.