Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: argument P = F/T for finalfit and fit2df #26

Closed
epi-stats opened this issue Oct 8, 2019 · 6 comments
Closed

Feature request: argument P = F/T for finalfit and fit2df #26

epi-stats opened this issue Oct 8, 2019 · 6 comments

Comments

@epi-stats
Copy link

epi-stats commented Oct 8, 2019

Amazing package!
In some areas, it is getting more common to present confidence intervals without P-values.
Would be great to have an argument P which will omit the p-values if it is set to FALSE.

Currently, I use the following workaround:

fit.pois = df %>%
glmmulti("count", c("a","b"), family = poisson, offset=(log(df$pop))) %>%
fit2df(estimate_name = "Incidence risk ratio", digits =c(2,1,0))
fit.pois$Incidence risk ratio <- gsub(", p[=<]1", "", fit.pois$Incidence risk ratio)

All the best
Jan

P.S: another workaround would be to set confint_level = 0.95000001

@ewenharrison
Copy link
Owner

ewenharrison commented Oct 8, 2019

Thanks Jan.
Yes I see that.
An alternative workaround is this:

colon_s %>% 
  glmmulti("mort_5yr", "age.factor") %>% 
  fit2df(condense = FALSE) %>% 
  dplyr::select(-p) %>% 
  condense_fit()

Interested in your thoughts.

@epi-stats
Copy link
Author

epi-stats commented Oct 8, 2019

Nice!
Wouldn't call it a workaround but rather a solution.
But not easy to find out. Maybe an example in the help file would be good.

@ewenharrison
Copy link
Owner

ewenharrison commented Oct 9, 2019

I’ve never done it before which is why it isn’t documented 😬
I’ll add it.
There’s lots of variations here. Had you found that?
https://finalfit.org/articles/all_tables_examples.html
Thanks again.

@epi-stats
Copy link
Author

epi-stats commented Oct 9, 2019

Of course I had a look at https://finalfit.org/articles/all_tables_examples.html
But if I am not mistaken, there is also no example with condense = FALSE

There is one other point which could be improved:
In epidemiology we are interested in row percentages not in column percentages.
If you look at your example: 2.01 Default Logistic regression first.
You are interested how different risk factors/exposures influence disease outcomes.
E.g. is case fatality higher in age < 40 compared to 45-60
The row percentages are also closer to the odds ratio which is on fact:
(Alive[risk]/Dead[risk]) / (Alive[no-risk]/Dead[no-risk])

I applied your trick mentioned above:
df <- data.frame(out=factor(rbinom(200,1,.5)), a=factor(rbinom(200,3,.5)), b=factor(rbinom(200,4,.5)))

ff <- df %>% summary_factorlist("out", c("a","b"), fit_id=TRUE) %>%
finalfit_merge(
fit2df(glmmulti(df, "out", c("a","b"), family = binomial), condense = FALSE) %>%
dplyr::select(-p) %>%
condense_fit()
)

But I think an argument column in funtion finalfit or finalfit.glm would be easy to implement.
Maybe something like:

finalfit.glm = function(.data, dependent, explanatory, [...]
keep_fit_id=FALSE, column = TRUE, ...){

summary.out = summary_factorlist(.data, dependent, explanatory, [...] , column=column,

@ewenharrison
Copy link
Owner

ewenharrison commented Oct 11, 2019

Hi,
If you pull from github you can now choose row proportions column = FALSE in finalfit() which is the new default.
devtools::install_github('ewenharrison/finalfit')

You can also use the helper function ff_remove_p() which will do as it says for any Finalfit condensed output. Let me know if there are issues. Thank you again.

@epi-stats
Copy link
Author

epi-stats commented Oct 12, 2019

You are my hero, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants