jinseob2kim / jstable

Regression Tables from 'GLM', 'GEE', 'GLMM', 'Cox' and 'survey' Results.
https://jinseob2kim.github.io/jstable/
Apache License 2.0
23 stars 13 forks source link

NA/NaN/INf in 'y' #8

Closed pipi815 closed 2 months ago

pipi815 commented 1 year ago

Dear author.thanks for your excellent working, but i have some questions, <error/purrr_error_indexed> Error in purrr::map(): ℹ In index: 1. Caused by error in glm.fit(): ! NA/NaN/Inf in 'y' Backtrace: ▆

  1. ├─jstable::TableSubgroupMultiGLM(...)
  2. │ └─purrr::map(...)
  3. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  4. │ ├─purrr:::with_indexed_errors(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ ├─purrr:::call_with_cleanup(...)
  7. │ └─jstable (local) .f(.x[[i]], ...)
  8. │ └─jstable::TableSubgroupGLM(...)
  9. │ └─stats::glm(formula, data = data)
    1. │ ├─base::eval(...)
    2. │ │ └─base::eval(...)
    3. │ └─stats::glm.fit(...)
    4. └─base::.handleSimpleError(...)
    5. └─purrr (local) h(simpleError(msg, call))
    6. └─cli::cli_abort(...)
    7. └─rlang::abort(...)

i have examined 'y' for several ,it is surely nurmeric(0,1), i need your help

pipi815 commented 1 year ago

Dear author.thanks for your excellent working, but i have some questions, <error/purrr_error_indexed> Error in purrr::map(): ℹ In index: 1. Caused by error in glm.fit(): ! NA/NaN/Inf in 'y' Backtrace: ▆

  1. ├─jstable::TableSubgroupMultiGLM(...)
  2. │ └─purrr::map(...)
  3. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  4. │ ├─purrr:::with_indexed_errors(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ ├─purrr:::call_with_cleanup(...)
  7. │ └─jstable (local) .f(.x[[i]], ...)
  8. │ └─jstable::TableSubgroupGLM(...)
  9. │ └─stats::glm(formula, data = data)
  10. │ ├─base::eval(...)
  11. │ │ └─base::eval(...)
  12. │ └─stats::glm.fit(...)
  13. └─base::.handleSimpleError(...)
  14. └─purrr (local) h(simpleError(msg, call))
  15. └─cli::cli_abort(...)
  16.   └─rlang::abort(...)

i have examined 'y' for several ,it is surely nurmeric(0,1), i need your help

there's no NA and illegal value in 'y'

jinseob2kim commented 1 year ago

Can you share reproducible data & code?

pipi815 commented 11 months ago

Thanks for your resolution,i have succeeded running it。While,i wanna to know,how to control the other variables by this code,thanks。

jinseob2kim commented 11 months ago

Can you show your code with the other variable?

pipi815 commented 11 months ago

library(jstable) res<-TableSubgroupMultiGLM(Osteoporosis ~ CVAI1, var_subgroups = c("Gender", "Hypertension","Hyperlipidemia","Income","Education","Diabetes","Smoking","Residence"), data = data, family = "binomial") res。 Thanks for your reply,above is my code. For example,I would like to stratified the analysis by gender but i don‘t konw how to adjust other variables like hypertension,hyperlipidemia and so on at the same time。

jinseob2kim commented 11 months ago

Please use var_cov option https://github.com/jinseob2kim/jstable/tree/master/R

pipi815 commented 11 months ago

I'm sorry, I'm a beginner and I don't understand what you mean. Could you please give me a sample code,thanks.

jinseob2kim commented 11 months ago
library(jstable)
res<-TableSubgroupMultiGLM(Osteoporosis ~ CVAI1,
var_subgroups = c("Gender", "Hypertension","Hyperlipidemia","Income","Education","Diabetes","Smoking","Residence"), data = data, family = "binomial", var_cov = c("Hypertension", "Hyperlipidemia"))
pipi815 commented 11 months ago

Thanks for your reply.

jaychang666 commented 2 months ago

Dear author.thanks for your excellent working, but i have some questions, <error/purrr_error_indexed> Error in purrr::map(): ℹ In index: 1. Caused by error in glm.fit(): ! NA/NaN/Inf in 'y' Backtrace: ▆

  1. ├─jstable::TableSubgroupMultiGLM(...)
  2. │ └─purrr::map(...)
  3. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  4. │ ├─purrr:::with_indexed_errors(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ ├─purrr:::call_with_cleanup(...)
  7. │ └─jstable (local) .f(.x[[i]], ...)
  8. │ └─jstable::TableSubgroupGLM(...)
  9. │ └─stats::glm(formula, data = data)
  10. │ ├─base::eval(...)
  11. │ │ └─base::eval(...)
  12. │ └─stats::glm.fit(...)
  13. └─base::.handleSimpleError(...)
  14. └─purrr (local) h(simpleError(msg, call))
  15. └─cli::cli_abort(...)
  16.   └─rlang::abort(...)

i have examined 'y' for several ,it is surely nurmeric(0,1), i need your help

there's no NA and illegal value in 'y'

hello! i met the same problem with "NA" .May I ask how did you solve the problem? i checked the data. There is no missing value. Thanks!

jinseob2kim commented 2 months ago

Can you share reproducible example?

I think there are non 0/1 value in ‘y'

jaychang666 commented 2 months ago

forest.csv

res <- jstable::TableSubgroupMultiGLM(fall_acc ~ ckd, family = "binomial" , var_subgroups = c("Pain","Age"), data = data_forest,line=T ) 'data.frame': 1406 obs. of 6 variables: $ Depression: Factor w/ 2 levels "<10",">10": 1 1 1 2 1 1 2 2 1 2 ... $ fall_acc : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 2 1 ... $ ckd : Factor w/ 2 levels "0","1": 2 1 1 2 2 2 1 2 2 2 ... $ Sex : Factor w/ 2 levels "Female","Male": 2 1 1 2 1 1 2 1 2 2 ... $ Pain : Factor w/ 2 levels "No","Yes": 2 1 2 2 1 1 2 2 1 2 ... $ Fall : Factor w/ 2 levels "No","Yes": 2 1 1 1 1 1 1 1 1 1 ...

the codes run well without var_subgroups

jinseob2kim commented 2 months ago

There are no “Age” variable

I check OK if var_subgroup = “Pain”

jaychang666 commented 2 months ago

20240902172903 I can not run with "Pain" only . thks, i will check when i restart my computer.

jinseob2kim commented 2 months ago

This is my result. Could you install the latest version?

data_forest <- fread("~/ShinyApps/research-individual/aquabeats2/aosc/forest.csv")

res <- jstable::TableSubgroupMultiGLM(fall_acc ~ ckd, family = "binomial" ,
                                      var_subgroups = c("Pain"),
                                      data = data_forest1,line=T
)

res

     Variable Count Percent   OR Lower Upper P value P for interaction
ckd   Overall  1406     100 1.16  0.91  1.48   0.234              <NA>
1        <NA>  <NA>    <NA> <NA>  <NA>  <NA>    <NA>              <NA>
11       Pain  <NA>    <NA> <NA>  <NA>  <NA>    <NA>             0.818
init       No   808    57.5 1.12  0.79   1.6    0.52              <NA>
...4      Yes   598    42.5 1.19  0.84  1.69   0.324              <NA>
jaychang666 commented 2 months ago

I retried it today. Running it directly still didn't work, saving the data locally and re-reading it worked. The two data types are as follows (that int/chr below will run).

微信图片_20240903084421
jaychang666 commented 2 months ago

version of package "jstable" is 1.3.3 . the latsest one .

jinseob2kim commented 2 months ago

there is fall_acc variable issue. The function can’t run if dependent variable is factor

jaychang666 commented 2 months ago

Thank you for your work!Awesome!!!