Movatterモバイル変換


[0]ホーム

URL:


ezcox: Easily Show CoxForestplot in One Command

Shixiang Wang  SYSUCC

2023-05-08

library(survival)library(ezcox)

forester

For simple and general forest data, you can useforester(), it is lightweight and can be applied to anyproper data (not limited to Cox model).

t1<-ezcox(lung,covariates =c("age","sex","ph.karno","pat.karno"))#> => Processing variable age#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable sex#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable ph.karno#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable pat.karno#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.p<-forester(t1,xlim =c(0,1.5))p

p2<-forester(t1,xlim =c(0.5,1.5))p2

show_forest

For more powerful plot features, you need to useshow_forest(). Unlike theforester(), theezcox() is included in the function.

show_forest(lung,covariates =c("sex","ph.ecog"),controls ="age")#> => Processing variable sex#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable ph.ecog#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.

show_forest(lung,covariates =c("sex","ph.ecog"),controls ="age",merge_models =TRUE)#> => Processing variable sex#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable ph.ecog#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.

show_forest(lung,covariates =c("sex","ph.ecog"),controls ="age",merge_models =TRUE,drop_controls =TRUE)#> => Processing variable sex#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable ph.ecog#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> covariates=NULL but drop_controls=TRUE, detecting controls...#> Yes. Setting variables to keep...#> Done.

show_forest(lung,covariates =c("sex","ph.ecog"),controls ="age",merge_models =TRUE,vars_to_show ="sex")#> => Processing variable sex#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> => Processing variable ph.ecog#> ==> Building Surv object...#> ==> Building Cox model...#> ==> Done.#> Resized limits to included dashed line in forest panel


[8]ページ先頭

©2009-2026 Movatter.jp