jinseob2kim / jstable

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

p-value is not visible on jskm() plot... #7

Closed IMCPatrick closed 10 months ago

IMCPatrick commented 11 months ago

AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr) ~ BB_DC) jskm(AllDeathKM, cumhaz = T, surv.scale = "percent", marks = F, showpercent = T, ci = F, pval = T, pval.testname = F, pval.coord = c(0.2,0.2), pval.size = 5, main = "All cause mortality", ystrataname = "Beta Blocker", ystratalabs = c("BB(+)","BB(-)"), ylabs = "Cumulative Incidence", ylims = c(0, 0.075), xlabs = "Time(Day)", xlims = c(0,1100), legend = T, legendposition = c(0.85, 0.9), table = T, size.label.nrisk = 8, label.nrisk = "No. at Risk", timeby = 150, cut.landmark = 30)

as shown above, I typed 'pval = T' definitely. But after Ctrl + Enter, There's no p-value on K-M plot. I re-installed package(jskm), nothing's changed. What should I do to display p-value on my landmark analysis K-M plot???

위 코드대로 입력하면, pval = T를 입력했는데도 p-value가 plot 위에 표시되지 않습니다... 버전의 문제인가 싶어 R 및 Package도 재설치 해봤지만 해결되지 않습니다....ㅠ 하지만 인터넷의 예제를 그대로 따라하면 p-value가 나타납니다. 데이터셋 자체의 무엇을 수정해야 하는 문제일까요?

jinseob2kim commented 11 months ago

ylims와 pval.coord를 조절해보셨을지요? 디폴트 옵션일때도 안나오는지 확인부탁드립니다

IMCPatrick commented 11 months ago

ylims와 pval.coord를 여러 범위로 조절해 봤지만 보이지 않습니다

디폴트 옵션일 때에도 보이지 않았습니다... -----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-02 (목) 22:35:08 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

ylims와 pval.coord를 조절해보셨을지요? 디폴트 옵션일때도 안나오는지 확인부탁드립니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 11 months ago

Landmark 옵션 제외해도 안보이시는지요? Landmark에서 p를 두개 보여주는 과정에서 화면에 걸릴수 있습니다

jinseob2kim commented 11 months ago

Ylims 의 0.075를 pval.coord 의 0.2보다 크게 한번 부탁드립니다. Pvalue 위치는 아래처럼 지정됩니다

 p <- p + annotate("text", x = c(pval.coord[1], pval.coord[1] + cut.landmark), y = pval.coord[2], label = pvaltxt, size = pval.size)
IMCPatrick commented 11 months ago

자세한 답변 감사합니다

하지만

jskm(AllDeathKM, cumhaz = T, surv.scale = "percent", marks = F, showpercent = T, ci = F, pval = T, pval.testname = F, pval.coord = c(300,0.075), pval.size = 5, main = "All cause mortality", ystrataname = "Beta Blocker", ystratalabs = c("BB(+)","BB(-)"), ylabs = "Cumulative Incidence", ylims = c(0, 0.1), xlabs = "Time(Day)", xlims = c(0,1100), legend = T, legendposition = c(0.85, 0.9), table = T, size.label.nrisk = 8, label.nrisk = "No. at Risk", timeby = 150, cut.landmark = 30)

이렇게 말씀하신 대로 코드를 수정해 봐도

그래프는 이렇게 나오고 p-value는 표시되지 않습니다... -----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-05 (일) 07:26:36 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

Ylims 의 0.075를 pval.coord 의 0.2보다 크게 한번 부탁드립니다. Pvalue 위치는 아래처럼 지정됩니다 p <- p + annotate("text", x = c(pval.coord[1], pval.coord[1] + cut.landmark), y = pval.coord[2], label = pvaltxt, size = pval.size) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 11 months ago

pval.coord =(10, 0.075) 로 해보시겠어요. 그래도 안되신다면 데이터를 jinseob2kim@gmail.com로 보내주시면 확인해보겠습니다

IMCPatrick commented 11 months ago

첨부 주신 메일 주소로 데이터 파일 보냈습니다.

감사합니다.

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-05 (일) 08:01:53 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

pval.coord =(10, 0.075) 로 해보시겠어요. 그래도 안되신다면 데이터를 @.로 보내주시면 확인해보겠습니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

jinseob2kim commented 11 months ago

제가 실행해보니 P가 나오긴하는데, lanmark가 30일로 짧아 값이 겹치게 나옵니다.

library(survival);library(jskm)
psBB <- read.csv("BB_3yr_Final.csv")

AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr) ~ BB_DC)
summary(AllDeathKM, times = c(30, 1100), extend = T)
res.km <- jskm(AllDeathKM,
               cumhaz = T, surv.scale = "percent", marks = F, showpercent = T, ci = F,
               pval = T, pval.testname = F, pval.coord = c(10,0.075), pval.size = 5,
               main = "All cause mortality",
               ystrataname = "Beta Blocker", ystratalabs = c("BB(+)","BB(-)"),
               ylabs = "Cumulative Incidence", ylims = c(0, 0.1),
               xlabs = "Time(Day)", xlims = c(0,1100),
               legend = T, legendposition = c(0.85, 0.9),
               table = T, size.label.nrisk = 8, label.nrisk = "No. at Risk",
               timeby = 150, cut.landmark = 30)

## Save to PPTx
library(officer);library(rvg);library(magrittr)
doc <- read_pptx() %>% 
  add_slide("Title and Content", "Office Theme") %>% 
  ph_with(dml(ggobj = res.km), location = ph_location(width = 10, height = 6))

print(doc, target = "km.pptx")
IMCPatrick commented 11 months ago

정말 감사합니다.

마지막으로 궁금한게...

Landmark가 짧아 p-value 값이 겹치게 나온다고 하신 부분은 이해를 했습니다.

PPT 파일도 잘 받아 확인했습니다.

비슷한 작업을 여러 변수에 반복적으로 할 예정인데

겹쳐져 숨은 p-value 값을 제가 선생님처럼 위치를 바꾸려면 어떻게 해야 하는지요?

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-05 (일) 10:39:50 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

제가 실행해보니 P가 나오긴하는데, lanmark가 30일로 짧아 값이 겹치게 나옵니다.

PPT로 저장하신 후 직접 편집하실 수 있습니다. 아래는 코드이고, 다운받은 PPT에서 P값 제가 위치 바꾼 파일을 메일로 첨부드립니다.

library(survival);library(jskm) psBB <- read.csv("BB_3yr_Final.csv") AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr) ~ BB_DC) summary(AllDeathKM, times = c(30, 1100), extend = T) res.km <- jskm(AllDeathKM, cumhaz = T, surv.scale = "percent", marks = F, showpercent = T, ci = F, pval = T, pval.testname = F, pval.coord = c(10,0.075), pval.size = 5, main = "All cause mortality", ystrataname = "Beta Blocker", ystratalabs = c("BB(+)","BB(-)"), ylabs = "Cumulative Incidence", ylims = c(0, 0.1), xlabs = "Time(Day)", xlims = c(0,1100), legend = T, legendposition = c(0.85, 0.9), table = T, size.label.nrisk = 8, label.nrisk = "No. at Risk", timeby = 150, cut.landmark = 30) ## Save to PPTx library(officer);library(rvg);library(magrittr) doc <- read_pptx() %>% add_slide("Title and Content", "Office Theme") %>% ph_with(dml(ggobj = res.km), location = ph_location(width = 10, height = 6)) print(doc, target = "km.pptx") — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 11 months ago

저장한 PPT를 파워포인트에서 여신 후, 마우스 드래그하시면됩니다. -p 뿐만 아니라 선 색깔부터 글씨폰트 및 크기까지 전부 수정가능합니다.

IMCPatrick commented 11 months ago

선생님 바쁘신데 죄송합니다

질문 하나만 더 하겠습니다...

P값이 보이지 않는데 어떻게 보이게 해서 드래그로 이동시킬수있을까요..? -----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-08 (수) 07:21:44 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

Closed #7 as completed. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 11 months ago

그림그리셨던 코드 옵션 알려주시면 확인하겠습니다

IMCPatrick commented 11 months ago

저번에 알려주신 코드대로 찍었습니다ㅠ

library(survival);library(jskm) psBB <- read.csv("BB_3yr_Final.csv")

AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr) ~ BB_DC) summary(AllDeathKM, times = c(30, 1100), extend = T) res.km <- jskm(AllDeathKM, cumhaz = T, surv.scale = "percent", marks = F, showpercent = T, ci = F, pval = T, pval.testname = F, pval.coord = c(10,0.075), pval.size = 5, main = "All cause mortality", ystrataname = "Beta Blocker", ystratalabs = c("BB(+)","BB(-)"), ylabs = "Cumulative Incidence", ylims = c(0, 0.1), xlabs = "Time(Day)", xlims = c(0,1100), legend = T, legendposition = c(0.85, 0.9), table = T, size.label.nrisk = 8, label.nrisk = "No. at Risk", timeby = 150, cut.landmark = 30) -----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-08 (수) 09:27:18 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

그림그리셨던 코드 옵션 알려주시면 확인하겠습니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 11 months ago

늦어서 죄송합니다. 이전에 알려드린 아래코드로 저장했는데 P값이 나옵니다. 아래코드로 만든 ppt 첨부드립니다.

## Save to PPTx
library(officer);library(rvg);library(magrittr)
doc <- read_pptx() %>% 
  add_slide("Title and Content", "Office Theme") %>% 
  ph_with(dml(ggobj = res.km), location = ph_location(width = 10, height = 6))

print(doc, target = "km.pptx")
IMCPatrick commented 10 months ago

교수님 안녕하십니까?

지난번에 Landmark analysis에서 p value가 프린트 되지 않아 질문했습니다.

개인 사정과 기타 병원 일정 등으로 뒤늦게 알려주신 대로 R에서 코딩해 보았습니다만...

여전히 제가 추출한 pptx 파일에서는 p value가 보이지 않습니다.

그래서 pptx 파일에서 개체 하나씩 분리해서 떼내어 보았지만...보이지 않았습니다...

어디가 문제인지 도저히 모르겠어서 실례 무릅쓰고 다시 질문 드립니다...

아래는 참고하시라고 R코딩과 추출된 pptx 파일 화면 첨부해 보내드립니다.

같은 코딩인데 교수님께서는 p value가 출력이 되는 것인지...보내주셨던 pptx 파일이 추출된 파일이 맞는지...

그렇다면 제 R스튜디오의 문제일까요 컴퓨터의 문제일까요...?

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-09 (목) 21:38:45 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

늦어서 죄송합니다. 이전에 알려드린 아래코드로 저장했는데 P값이 나옵니다. 아래코드로 만든 ppt 첨부드립니다.

겹쳐서 나와서 분리하면 됩니다. km (1).pptx

Save to PPTx library(officer);library(rvg);library(magrittr) doc <- read_pptx() %>% add_slide("Title and Content", "Office Theme") %>% ph_with(dml(ggobj = res.km), location = ph_location(width = 10, height = 6)) print(doc, target = "km.pptx")

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 10 months ago

위의 제가 첨부드린 PPT에선 p값이 보이실지요? 그렇다면 직접 만드신 PPT 파일 첨부부탁드립니다

IMCPatrick commented 10 months ago

감사합니다. 교수님.

개인적으로 발표 자료를 준비하고 있는데

이 p value 관련 문제로 진척이 없어 답답한 마음에 자꾸 부탁을 드립니다...

감사합니다.

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-19 (일) 21:02:38 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

위의 제가 첨부드린 PPT에선 p값이 보이실지요? 그렇다면 직접 만드신 PPT 파일 첨부부탁드립니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 10 months ago

PPT 파일 첨부부탁드립니다

IMCPatrick commented 10 months ago

혹시 파일이 보이지 않으시는지요?

네이버 메일로 파일 첨부하여 보내드렸었습니다.

이번에 다시 첨부해서 보내드립니다~!

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-19 (일) 21:09:31 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

PPT 파일 첨부부탁드립니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jinseob2kim commented 10 months ago

선생님께. jinseob2kim@gmail.com 로 바로 보내주시면 감사하겠습니다

IMCPatrick commented 10 months ago

교수님께

보내주신 gmail.com 주소로 파일 방금 보냈습니다.

감사합니다.

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-19 (일) 21:18:22 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

선생님께. @. 로 바로 보내주시면 감사하겠습니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

IMCPatrick commented 10 months ago

다른 컴퓨터를 찾아 R을 돌려보려다가

문득 교수님께 보내 드린 파일과 코딩을 찬찬히 보게 되었는데

저의 경우에는 처음에 lapply(as.factor()) 함수를 돌리고 시작을 합니다.

앞서 Baseline characteristics를 꾸미기 위해 통계를 돌리려니 HTN 같은 Factor 변수였으면 하는 변수들이 str() 상 확인해 보니 int.로 설정되어 있어 사전 작업을 했던 것입니다.

그런데 교수님께 보내 드린 파일과 교수님께 받은 코딩을 보다 보니 이 과정은 없는 것이 눈에 띄었습니다.

그래서 혹시나 하여 이 과정을 생략하고 jskm()을 돌렸더니 교수님께서 보내주신 파일과 같이 완성된 그림이 나옵니다.

이 as.factor 작업이 jskm()에서 p value를 보이지 않게 했을 이유가 있을지요?

-----Original Message----- From: @.> To: @.>; Cc: Sent: 2023-11-19 (일) 21:19:38 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

교수님께

보내주신 gmail.com 주소로 파일 방금 보냈습니다.

감사합니다.

-----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-19 (일) 21:18:22 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

선생님께. @.*** 로 바로 보내주시면 감사하겠습니다 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

jinseob2kim commented 10 months ago

혹시 All_Mortality_3yr 변수도 factor로 바꾸셨을지요? 그렇다면 survfit을 아래처럼 바꿔야합니다.

AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr == 1) ~ BB_DC)
IMCPatrick commented 10 months ago

아!

네 교수님 그 항목도 factor로 바꿨었습니다

그런 문제가...

감사합니다 교수님

바보같은 변수 실수때문에 번거롭게 해드려 죄송합니다

감사합니다~! -----Original Message----- From: "Jinseob @.> To: @.>; Cc: @.>; @.>; Sent: 2023-11-19 (일) 21:54:58 (GMT+09:00) Subject: Re: [jinseob2kim/jstable] p-value is not visible on jskm() plot... (Issue #7)

혹시 All_Mortality_3yr 변수도 factor로 바꾸셨을지요? 그렇다면 survfit을 아래처럼 바꿔야합니다. AllDeathKM <- survfit(data = psBB, Surv(All_Mortality_3yr_Duration, All_Mortality_3yr == 1) ~ BB_DC) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>