survminer | Survival Analysis and Visualization | Data Visualization library
kandi X-RAY | survminer Summary
kandi X-RAY | survminer Summary
The survminer R package provides functions for facilitating survival analysis and visualization. The main functions, in the package, are organized in different categories as follow. Diagnostics of Cox Model . Summary of Cox Model .
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of survminer
survminer Key Features
survminer Examples and Code Snippets
Community Discussions
Trending Discussions on survminer
QUESTION
I would like to perform a cox regression analysis with value_max_min
as predictor, but according 2 groups peak
and drop
in the column peak_drop_status
(to get 2 survival curves).
ANSWER
Answered 2022-Apr-08 at 23:00To do a stratified Cox model, you would specify strata(var)
in your model formula as follows:
QUESTION
The ggsurvplot
function from the package survminer
allows users to draw Kaplen-Meier curves. It also allows us to create a table beneath the plot with the number of censored observations by configuring the ncensor.plot
value. My question is: how does one change the y-axis of the censored table beneath the plot? The reason is I have a study termination at for example 52 weeks, and therefore the amount of censored observations is high, skewing the table completely. See the example below.
ANSWER
Answered 2022-Apr-04 at 18:06The object returned by ggsurvplot
is a list which contains the main plot as an element called plot
and the censored table plot as an element named ncensor.plot
. Both of which are ggplot
objects and can therefore be tweaked using default ggplot options. As an example in my code below I use scale_y_continuous
to change the breaks
of the y scale for the censored table plot:
QUESTION
I have got survival data, based on quartiles of delta_mon1_baselone_to_3d
. Outcomes is mace
.
Cox regression for each quartile are obtained with this code:
...ANSWER
Answered 2022-Apr-01 at 14:38This is what I think you're looking for. First, it isn't built into that plotting function to do this, but you can create these labels dynamically.
It ended up being a bit easier if I changed the name of stratum
to Quartile
. If that's what you're labeling it, this shouldn't be too big of an issue.
QUESTION
I am looking to customise my ggsurvplot title by making one word in it be in italics. I have tried the more 'classic' code that words in ggplots, but they don't appear to work in this.
Here is an example of what I am doing:
...ANSWER
Answered 2022-Mar-30 at 11:26You can use an expression
like this:
QUESTION
I have a dataset consisting in observations of the developmental time and survival of an insect.
Developmental time is the time in days between egg exclosure and adult emergence, while survival of adults is the time between adult emergence and death (or censoring).
In my analysis, I am plotting a Kaplan-Meier reversed survival curve (ggsurvplot(survfit_obj, fun = "event")
) for developmental time, while for adult survival I am using a classical Kaplan-Meier curve.
Since I have these two time-to-event variables for every unique individual, I am wondering if there is the possibility to horizontally merge the two resulting Kaplan-Meier curves into a single comprehensive one, or eventually with a different estimator.
Actually, I am not even sure if it has a solid statistical meaning, it just graphically make sense (see last figure).
Keep in mind that the two time-to-events variables are substantially different, they are not representing a single recurrent event.
Below you can find my reproducible example.
Variable legend:
treat -> treatment
days2emerge -> days from egg to adult
new.ad = 1 -> successful adult emergence
days2event -> days from adult emergence to death/censoring
days2event = 1 -> adult death
days2event = 0 -> adult censoring
ANSWER
Answered 2022-Mar-24 at 12:44I don't think you can do this natively in ggsurvplot
, but you can strip the data out of your plots and easily build a new one:
QUESTION
How to replace the default geom_ribbon
with geom_errorbar
in ggcompetingrisks
from survminer
package?
conf.int = T
will put confidence interval as a ribbon layer.
my code:
...ANSWER
Answered 2021-Nov-29 at 04:58You can modify the source code of the two required functions from the survminer package (ggcompetingrisks.cuminc()
& ggcompetingrisks()
), e.g.
QUESTION
To generate p-values for the differences between two survival curves, I need to perform a tedious series of steps, which need to be repeated with all combinations of two out of three values that are represented in one column of the starting data frame, say groups A, B and C:
...ANSWER
Answered 2021-Nov-10 at 01:26I think the problem is that you are not calling survfit
in the manner it was intended. The Surv
-object should have the column names, but not the dataset name in it.
You also need to provide survminer::surv_pvalue
a dataset as a second parameter
Try (works for me):
QUESTION
I want to create a KM curve with 95%-CI with the x-axis zoomed in to show values between 0-60 months. This all works fine with ggsurvplot untill I use xlim.
...ANSWER
Answered 2021-Oct-29 at 15:04When you zoom in in the plot of the surv_graph, with the ggsurvplot
-argument xlim
, or with + coord_cartesian(...)
afterwards, then the table is automatically adjusted to show only the data in the plot. This may be worthy of a change request for the package. In the meanwhile, the code below may be a workaround.
ggsurvplot()
creates an object of 4 lists: one of them contains the graph, another one contains the table. Extracting those 2 and "arranging" them ggarrange()
may create a suitable graph. Prior to that ggarrange-operation we "zoom in" on the surv-plot with coord_cartestion(xlim= ...)
:
QUESTION
Hello I am using the survival
package and the survminer
package to do some analysis. I am having trouble with pairwise_survdiff
from the survminer
package.
Here is some simulated data that mimics my own.
...ANSWER
Answered 2021-Oct-01 at 18:56Try without using the df$
QUESTION
I am new to survival analysis in R. I saw that my collegues managed to find drug retention rates at specific time intervals (6 month, 12 month, 24 month) with 95% CI. How would I do this?
Here is a reproducible example:
...ANSWER
Answered 2021-Sep-18 at 18:26You could use summary
with the needed time intervals:
this will give the needed CI's.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install survminer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page