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

Why the number is not integer? #61

Closed
xiasijian opened this issue Dec 4, 2024 · 6 comments
Closed

Why the number is not integer? #61

xiasijian opened this issue Dec 4, 2024 · 6 comments

Comments

@xiasijian
Copy link

image

my code:

`res_os <- TableSubgroupMultiCox(

formula = Surv(LRFS, LRFS_status) ~ group,

var_subgroups = c("age","gender"),
data = df
)`

@jinseob2kim
Copy link
Owner

This is KM estimate incidence(%) at time_eventrate(default: 3 * 365)

@xiasijian
Copy link
Author

Thanks a lot, it is a very good package for doctor. how can I get the patient number of each group when using subgroup cox regression?

@jinseob2kim
Copy link
Owner

Count is N

@xiasijian
Copy link
Author

thanks, But it is not the number of "group=low" and "group=high"

@sl-eeper
Copy link
Contributor

sl-eeper commented Dec 9, 2024

Hi, I recently updated this option.

lung %>%
  mutate(
    status = as.integer(status == 1),
    sex = factor(sex),
    kk = factor(as.integer(pat.karno >= 70)),
    kk1 = factor(as.integer(pat.karno >= 60))
  ) -> lung

lung.label <- mk.lev(lung)

lung.label <- lung.label %>%
  mutate(
    val_label = case_when(
      variable == "sex" & level == "1" ~ "Male",
      variable == "sex" & level == "2" ~ "Female",
      variable == "kk" & level == "0" ~ "No",
      variable == "kk" & level == "1" ~ "Yes",
      variable == "kk1" & level == "0" ~ "No",
      variable == "kk1" & level == "1" ~ "Yes",
      TRUE ~ val_label
    )
  )
TableSubgroupMultiCox(Surv(time, status) ~ sex, 
                      var_subgroups = c("kk", "kk1"), 
                      data = lung, 
                      time_eventrate = 100, 
                      line = TRUE, 
                      cluster = "inst", 
                      strata = "inst", 
                      weights = "age", 
                      event = FALSE, 
                      count_by = "sex", 
                      labeldata = lung.label)

Result will look like:

Variable Count Count(sex=Male) Count(sex=Female) Percent Point Estimate Lower Upper sex=1 sex=2 P value P for interaction
sex 227 138 90 100 1.66 1.09 2.53 0 1.2 0.019
1
2 kk 0.562
3 No 38 22 16 193294637.42 27228158.02 1372212428.98 0 0 <0.001
4 Yes 186 114 73 1.44 0.95 2.18 0 1.5 0.084
5
6 kk1 <0.001
7 No 8 4 4 0 0
8 Yes 216 132 85 1.55 1 2.41 0 1.3 0.049

You can use the Count = 'variable' option to display counts by each variable. Additionally, by adding the Event = TRUE option, you can obtain the raw event rate values (which are not Kaplan-Meier estimates).

@xiasijian
Copy link
Author

xiasijian commented Dec 9, 2024 via email

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