jstable icon indicating copy to clipboard operation
jstable copied to clipboard

NA/NaN/INf in 'y'

Open pipi815 opened this issue 2 years ago • 9 comments

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

pipi815 avatar Oct 29 '23 08:10 pipi815

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'

pipi815 avatar Oct 29 '23 08:10 pipi815

Can you share reproducible data & code?

jinseob2kim avatar Nov 02 '23 13:11 jinseob2kim

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

pipi815 avatar Dec 12 '23 04:12 pipi815

Can you show your code with the other variable?

jinseob2kim avatar Dec 13 '23 14:12 jinseob2kim

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。

pipi815 avatar Dec 16 '23 04:12 pipi815

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

jinseob2kim avatar Dec 16 '23 04:12 jinseob2kim

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

pipi815 avatar Dec 17 '23 07:12 pipi815

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"))

jinseob2kim avatar Dec 17 '23 08:12 jinseob2kim

Thanks for your reply.

pipi815 avatar Dec 17 '23 08:12 pipi815

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!

jaychang666 avatar Sep 02 '24 08:09 jaychang666

Can you share reproducible example?

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

jinseob2kim avatar Sep 02 '24 08:09 jinseob2kim

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

jaychang666 avatar Sep 02 '24 09:09 jaychang666

There are no “Age” variable

I check OK if var_subgroup = “Pain”

jinseob2kim avatar Sep 02 '24 09:09 jinseob2kim

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

jaychang666 avatar Sep 02 '24 09:09 jaychang666

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>

jinseob2kim avatar Sep 02 '24 09:09 jinseob2kim

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 avatar Sep 03 '24 00:09 jaychang666

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

jaychang666 avatar Sep 03 '24 00:09 jaychang666

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

  • I will fix the issue next release, sorry

jinseob2kim avatar Sep 03 '24 01:09 jinseob2kim

Thank you for your work!Awesome!!!

jaychang666 avatar Sep 03 '24 01:09 jaychang666