R4EPI / epitabulate

Tables for epidemiological analysis
https://R4EPI.github.io/epitabulate
GNU General Public License v3.0
8 stars 0 forks source link

tab_univariate doesnt work for non-categorical variables #5

Closed epiamsterdam closed 2 years ago

epiamsterdam commented 4 years ago

the function tab_univariate only seems to work if the exposure variables are TRUE/FALSE variables.

zkamvar commented 4 years ago

This is correct. There are many ways to encode exposure as a binary variable (Yes/No, Oui/Non, 1/0, 1/2, Positive/Negative, etc.), so enforcing these being TRUE/FALSE makes sure that we don't get the exact opposite answer.

This is documented in the R4EPIs website: https://r4epis.netlify.com/training/walk-through/univariate/

## Create vector that specifies the variables we want to convert
binary_vars <- c("case_def", "ptvomit", "ptjaundice", "patient_facility_type")

## Apply str_detect on each of the columns to return TRUE for each element that 
## matches either Confirmed, Oui, or Inpatient
linelist_cc <- linelist_cc %>%
  mutate_at(.vars = binary_vars, 
            .funs = str_detect,
            pattern = "Confirmed|Oui|Inpatient")
epiamsterdam commented 4 years ago

Agreed. Just that you can then not use tab_univariate to conduct a univariable logistic regression on exposure variables that are not classified as TRUE/FALSE (i.e. continuous).

aspina7 commented 4 years ago

You wouldn't do it for continuous anyway using this function. But we should add categorical - and have it automatically take the first or lowest as reference, then loop for each of the subsets.

Continuous variables would be moving to regression - which should be a walkthrough on the r4epis page.

On Wed, 23 Oct 2019, 15:10 epiamsterdam, notifications@github.com wrote:

Agreed. Just that you can then not use tab_univariate to conduct a univariable logistic regression on exposure variables that are not classified as TRUE/FALSE (i.e. continuous).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/R4EPI/sitrep/issues/216?email_source=notifications&email_token=AEL7IJ7IYDTPVVKRWK52GHTQQBLLZA5CNFSM4JD6CE32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECBRSDQ#issuecomment-545462542, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL7IJ4MJ4V7IG6M5N76UBTQQBLLZANCNFSM4JD6CE3Q .