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

NA/NaN/INf in 'y' #8

Closed
pipi815 opened this issue Oct 29, 2023 · 19 comments
Closed

NA/NaN/INf in 'y' #8

pipi815 opened this issue Oct 29, 2023 · 19 comments

Comments

@pipi815
Copy link

pipi815 commented Oct 29, 2023

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
Copy link
Author

pipi815 commented Oct 29, 2023

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
Copy link
Owner

Can you share reproducible data & code?

@pipi815
Copy link
Author

pipi815 commented Dec 12, 2023

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
Copy link
Owner

Can you show your code with the other variable?

@pipi815
Copy link
Author

pipi815 commented Dec 16, 2023

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
Copy link
Owner

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

@pipi815
Copy link
Author

pipi815 commented Dec 17, 2023

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
Copy link
Owner

jinseob2kim commented Dec 17, 2023

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
Copy link
Author

pipi815 commented Dec 17, 2023

Thanks for your reply.

@jaychang666
Copy link

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 jinseob2kim reopened this Sep 2, 2024
@jinseob2kim
Copy link
Owner

Can you share reproducible example?

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

@jaychang666
Copy link

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
Copy link
Owner

There are no “Age” variable

I check OK if var_subgroup = “Pain”

@jaychang666
Copy link

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

@jinseob2kim
Copy link
Owner

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
Copy link

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
Copy link

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

@jinseob2kim
Copy link
Owner

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

  • I will fix the issue next release, sorry

@jaychang666
Copy link

Thank you for your work!Awesome!!!

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

3 participants