Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to carry on the Survival Analysis of R language in big data

Shulou Source: shulou.com Published: 2022-06-01 07:26:09 10月03日 Update

This article shows you how to carry out the survival analysis of the R language in big data. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

According to the introduction of survival analysis above, we can have a general understanding of the concept and principle of survival analysis and the drawing of KM curve. However, the results of COX regression in survival analysis are not easy to output directly. Here is a simple introduction to a custom function, batch and regular output method.

# load the required R package

Library ("survival") library ("survminer")

# load and view the dataset

Data ("lung") head (lung)

Inst time status age sex ph.ecog ph.karno pat.karno meal.cal wt.loss1 3 306 2 74 11 90 100 1175 NA2 3 455 2 68 10 90 90 1225 153 3 1010 1 56 10 90 90 NA 154 5 210 2 57 11 90 60 1150 115 1 883 2 60 10 100 90 NA 06 12 1022 1 74 1150 80 513 0

# cox regression analysis

Res.cox | z |) sex-0.5310 0.5880 0.1672-3.176 0.00149 * *-Signif. Codes: 00.1exp (coef) exp (- coef) lower .95 upper .95sex 0.588 1.701 0.4237 0.816Concordance0.579 (se = 0.022) Rsquare= 0.046 (max possible= 0.999) Likelihood ratio test= 10.63 on 1 df, p=0.001111Wald test= 10.09 on 1 df P=0.001491Score (logrank) test = 10.33 on 1 df, pendant 0.001312

COX regression results need to extract the confidence interval of HR,HR, wald.test and p.value information, the simplest thing is to copy and paste in the summary results, of course, the efficiency is very low. Suppose what happens when there are hundreds of variables?

-copy and paste N* hundreds of times!

You can also build custom functions that output COX regression results of all variables at a time in the form of a data box.

# View the variables to be analyzed

Covariates

Tags: Analysis results output data functions variables language information content form hundreds skills knowledge conciseness hundreds succinct thousands intervals principles that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info Microsoft Linux Shulou Information