Data set survival analysis method, device and equipment

Through the multiple imputation and multiplication active limit method, the survival probability is processed, combined with the log-rank test, the problems of poor data compatibility and complex operation in the existing survival analysis methods are solved, and the simplified data set survival analysis process and efficient survival curve generation are realized.

CN120408091APending Publication Date: 2025-08-01PEKING UNIVERSITY THIRD HOSPITAL (THE THIRD CLINICAL MEDICAL SCHOOL OF PEKING UNIVERSITY)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510540313.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The existing survival analysis methods have poor data compatibility, complex and cumbersome operations during data processing, and cannot effectively combine multiple interpolation and survival analysis algorithms, resulting in poor analysis results.

Method used

A new data set survival analysis method is adopted to process the data set through multiple interpolation, set the survival analysis algorithm function parameters, perform survival analysis and extract target parameters, use the multiplication and active limit method to process survival probability and target parameters, combine log-rank test to calculate chi-square values and P values, draw survival curves, and simplify the data processing process.

Benefits of technology

It realizes simplified and efficient processing of data set survival analysis, improves the accuracy and efficiency of analysis, eliminates data compatibility problems, simplifies operational steps, and directly generates survival curves.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120408091A_ABST
    Figure CN120408091A_ABST
Patent Text Reader

Abstract

The invention provides a data set survival analysis method, device and equipment, and the method comprises the steps: carrying out the preprocessing and function parameter setting of a to-be-analyzed first data set, and obtaining a third data set with complete data; checking the third data set and extracting a first target parameter; carrying out survival analysis on the third data set based on a survival analysis function, and calculating a survival probability; extracting a second target parameter at each time point in the third data set; processing the survival probability and the second target parameter based on a product limit method to obtain the number of different types of expected risk objects at different survival time points; determining an expected event number based on the third data set and different types of expected risk object numbers; determining a difference value between the expected event number and the actual event number in the third data set; and calculating a chi-square value and a P value of l og-rank test by combining the difference value, and drawing a survival curve according to the chi-square value and the P value. According to the method, survival analysis can be carried out on the data set more simply and efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and particularly to a method, device and equipment for survival analysis of a data set. Background Art

[0002] Survival analysis is a discipline that studies the relationship between survival phenomena (occurrence of an event) and occurrence time and its statistical laws (i.e., analyzing the relationship between a time-related dependent variable and independent variables). Since the event can be any clearly defined end point, such as getting sick, death, equipment failure, etc., survival analysis has wide applications in many fields such as medicine, engineering, social science and insurance. The most commonly used survival analysis methods are Kaplan-Meier Estimator and Cox Proportional Hazards Model. Summary of the Invention

[0003] The embodiments of the present invention provide a method, device and equipment for survival analysis of a data set, which can perform survival analysis on the data set more simply and efficiently.

[0004] To solve the above technical problems, the embodiments of the present invention provide a method for survival analysis of a data set, including:

[0005] Preprocess the first data set to be analyzed to obtain a second data set with complete data;

[0006] Set function parameters regarding the survival analysis algorithm in the second data set to form a third data set;

[0007] Read the third data set, and perform verification on the third data set and extract the first target parameter;

[0008] Perform survival analysis on the third data set based on the survival analysis function, and calculate and determine the involved survival probability;

[0009] Extract the second target parameter at each time point in the third data set;

[0010] Process the survival probability and the second target parameter based on the product limit method to obtain the number of different types of expected risk objects at different survival time points;

[0011] Determine the expected number of events based on the third data set and the number of different types of the expected risk objects;

[0012] Determine the difference between the expected number of events and the actual number of events in the third data set;

[0013] Calculate the chi-square value and P value of the log-rank test in combination with the difference.

[0014] Draw a survival curve corresponding to the third data set in combination with the survival probability, chi-square value, and P value.

[0015] In some embodiments, preprocessing the first data set to be analyzed to obtain a second data set with complete data, including:

[0016] Perform multiple imputation on the first data set to obtain the second data set.

[0017] In some embodiments, read the third data set, and perform verification and extraction of the first target parameter on the third data set, including:

[0018] Read the third data set and perform validity verification on the third data set;

[0019] After passing the verification, extract the number of groups, the number of imputations, and the survival time in the third data set, and remove duplicates and sort the survival time in the third data set.

[0020] In some embodiments, perform survival analysis on the third data set based on a survival analysis function, and calculate and determine the involved survival probability, including:

[0021] Perform survival analysis on the third data set based on the function survfit(Surv()) to obtain a survival analysis result;

[0022] Perform a first filling process on the analysis result;

[0023] Based on the analysis result after the first filling process and the following target formula, calculate the survival probability pooled_surv[j] for each group of data j in the third data set:

[0024]

[0025] where m is the total number of imputations, i represents the i-th imputation, and surv[i] is the survival probability corresponding to the i-th imputation.

[0026] In some embodiments, extract the second target parameter at each time point in the third data set, including:

[0027] Perform a second filling process on the analysis result, and extract the actual number of events in the third data set and the censored values of each group corresponding to each time point from the analysis result after the second filling process;

[0028] Store the actual number of events and the censored values in different log-rank test data frames for storage.

[0029] In some embodiments, processing the survival probability and the second target parameter based on the product-limit method to obtain the number of expected risk objects of different types at different survival time points includes:

[0030] Processing the survival probability and the second target parameter based on the product-limit method to estimate the number of first expected risk objects corresponding to each group of data when the end event occurs;

[0031] Calculating the number of second expected risk objects when no event occurs based on the censored values and the actual number of events.

[0032] In some embodiments, determining the expected number of events based on the third data set and the number of expected risk objects of different types includes:

[0033] In the third data set, calculating and determining the expected number of events for each group of data at each time point based on the number of first expected risk objects, the number of second expected risk objects, and the actual number of events.

[0034] In some embodiments, determining the difference between the expected number of events and the actual number of events in the third data set includes:

[0035] Determining the expected number of events and the actual number of events at each time point corresponding to each group of data;

[0036] Counting the total expected number of events and the total actual number of events at all time points corresponding to each group of data;

[0037] Calculating and determining the total difference between the actual events and the expected events corresponding to each group of data based on the total expected number of events and the total actual number of events.

[0038] Another embodiment of the present invention also provides a data set survival analysis device, including:

[0039] A preprocessing module for preprocessing the first data set to be analyzed to obtain a second data set with complete data;

[0040] A setting module for setting function parameters regarding the survival analysis algorithm in the second data set to form a third data set;

[0041] A verification module for reading the third data set and verifying the third data set and extracting the first target parameter;

[0042] A survival analysis module for performing survival analysis on the third data set based on the survival analysis function to calculate and determine the involved survival probability;

[0043] An extraction module for extracting the second target parameter at each time point in the third data set;

[0044] A processing module, configured to process the survival probability and the second target parameter based on the product-limit method to obtain the number of expected risk objects of different types at different survival time points;

[0045] A first determination module, configured to determine the expected number of events based on the third data set and the number of expected risk objects of different types;

[0046] A second determination module, configured to determine the difference between the expected number of events and the actual number of events in the third data set;

[0047] A calculation module, configured to calculate the chi-square value and the P value of the log-rank test in combination with the difference;

[0048] A plotting module, configured to plot a survival curve corresponding to the third data set in combination with the survival probability, the chi-square value, and the P value.

[0049] Another embodiment of the present invention further provides an electronic device, including:

[0050] One or more processors;

[0051] A memory, configured to store one or more programs;

[0052] When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method for survival analysis of multiple data sets according to any one of the above embodiments.

[0053] Based on the disclosure of the above embodiments, it can be known that the beneficial effects of the embodiments of the present invention include being able to simplify the survival analysis process of the data set, simplify the data processing complexity in the survival analysis process, enabling the survival analysis program to directly read the preprocessed data set, and perform feature extraction, analysis, etc. on it, and finally generate a survival curve corresponding to the data set.

[0054] Other features and advantages of the present application will be described in the following specification, and part of them will become obvious from the specification, or be understood by implementing the present application. The objectives and other advantages of the present application can be achieved and obtained through the structures specifically pointed out in the written specification, claims, and drawings.

[0055] The technical solutions of the present application will be further described in detail below with reference to the drawings and embodiments. Description of the Drawings

[0056] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0057] Figure 1 It is a flowchart of the dataset survival analysis method in an embodiment of the present invention.

[0058] Figure 2 It is a flowchart of the dataset survival analysis method in another embodiment of the present invention.

[0059] Figure 3 It is a flowchart of the dataset survival analysis method in another embodiment of the present invention.

[0060] Figure 4 It is a structural block diagram of the dataset survival analysis device in an embodiment of the present invention. Specific Embodiments

[0061] Next, specific embodiments of the present invention will be described in detail with reference to the drawings, but it is not a limitation of the present invention.

[0062] It should be understood that various modifications can be made to the embodiments disclosed herein. Therefore, the following description should not be regarded as a limitation, but only as an example of the embodiments. Those skilled in the art will think of other modifications within the scope of the present disclosure.

[0063] The drawings included in the specification and constituting a part of the specification show the embodiments of the present disclosure, and together with the general description of the present disclosure given above and the detailed description of the embodiments given below, are used to explain the principles of the present disclosure.

[0064] These and other features of the present invention will become apparent from the following description of the preferred forms of the embodiments given by way of non-limiting examples with reference to the drawings.

[0065] It should also be understood that although the present invention has been described with reference to some specific examples, those skilled in the art can surely implement many other equivalent forms of the present invention, which have the features as described in the claims and thus are all within the scope of protection defined thereby.

[0066] When combined with the drawings, the above and other aspects, features, and advantages of the present disclosure will become more apparent in view of the following detailed description.

[0067] Specific embodiments of the present disclosure will be described hereinafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure, which can be implemented in various ways. Well-known and / or repetitive functions and structures are not described in detail to avoid obscuring the present disclosure with unnecessary or redundant details. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but are merely used as a basis for the claims and a representative basis for teaching those skilled in the art to use the present disclosure in a substantially appropriate detailed structure in various ways.

[0068] This specification may use the phrases "in one embodiment", "in another embodiment", "in yet another embodiment", or "in other embodiments", which may each refer to one or more of the same or different embodiments according to the present disclosure.

[0069] Next, embodiments of the present invention will be described in detail with reference to the accompanying drawings.

[0070] As Figure 1 shown, an embodiment of the present invention provides a method for survival analysis of a data set, including:

[0071] S1: Preprocess the first data set to be analyzed to obtain a second data set with complete data;

[0072] S2: Set function parameters regarding the survival analysis algorithm in the second data set to form a third data set;

[0073] S3: Read the third data set and perform verification on the third data set and extract the first target parameter;

[0074] S4: Perform survival analysis on the third data set based on the survival analysis function, and calculate and determine the involved survival probability;

[0075] S5: Extract the second target parameter at each time point in the third data set;

[0076] S6: Process the survival probability and the second target parameter based on the product limit method to obtain the number of different types of expected risk objects at different survival time points;

[0077] S7: Determine the expected number of events based on the third data set and the number of different types of the expected risk objects;

[0078] S8: Determine the difference between the expected number of events and the actual number of events in the third data set;

[0079] S9: Calculate the chi-square value and P value of the log-rank test in combination with the difference;

[0080] S10: Draw a survival curve corresponding to the third data set in combination with the survival probability, chi-square value, and P value.

[0081] Among them, preprocessing the first data set to be analyzed to obtain a second data set with complete data includes:

[0082] S11: Perform multiple imputation processing on the first data set to obtain the second data set.

[0083] Since real-world data often has missing values, if these missing values are not imputed, it will lead to a reduction in the sample size, affect the power of statistical tests, and hinder the discovery of objective laws. Different from simply using the mean, median, mode, etc. for filling, this embodiment adopts the multiple imputation method to generate multiple complete data sets through a certain model (such as the chained equation) to impute the missing values, which can reduce the bias caused by single imputation and improve the accuracy and robustness of the analysis.

[0084] Furthermore, the third data set in this embodiment contains multiple groups of data and is the aggregation of multiple groups of data. Its specific content is not limited. For example, it can be quality monitoring data, medical data of patients statistically collected by the medical system, etc., and it is not unique specifically. When performing survival analysis on the data set, it is not to perform survival analysis on one or several groups of data randomly selected from the third data set, but to perform analysis on all the data to increase the reliability and accuracy of data analysis and improve the analysis efficiency at the same time.

[0085] In existing analysis methods, as a semi-parametric method, the Cox proportional hazards model has a good degree of integration with multiple imputation. The analysis method in SPSS is the same as that for a single imputation dataset (Analyze - Survival Analysis - Cox Regression); in R language, it is also convenient to use the with and pool functions in the "mice" package in combination with the coxph function in the "survival" package to analyze the dataset. However, as a non-parametric method (without assuming that the survival time follows a certain known probability distribution and estimating the survival function based on the observed survival data), the Kaplan-Meier Estimator (a survival analysis estimator used for survival analysis) has a relatively poor degree of integration with multiple imputation. There has not yet been a convenient and automated software / package that can execute the Kaplan-Meier Estimator in a multiple imputation dataset to obtain pooled survival probabilities, survival curves, and perform a log-rank test for significance. For the IBM SPSS Statistics method, when performing a Kaplan-Meier survival analysis (Analyze - Survival Analysis - Kaplan-Meier) after multiple imputation (Analyze - Multiple Imputation - Impute Missing Data Values), only the survival probabilities, survival curves, and log-rank test results for each dataset can be obtained, and the pooled results cannot be obtained. In R language, the with and pool functions in the "mice" package cannot be combined with the survfit function in the "survival" package for analysis. The "SurvMI" package has similar functions and is more universal in use. It can perform ordinary KM / Cox analysis, weighted KM / Cox analysis, and execute logrank tests and draw graphs, with many functions, but it is very inconvenient to use. For example, the KMMI function cannot directly analyze a mids-type dataset and needs to first use its built-in uc_data_transform function to transform the dataset. Moreover, the uc_data_transform function does not read mids-type data but long format (which requires at least the id, time, and prob variables, so KM analysis needs to be performed manually in advance), making it very troublesome to use. Secondly, it is not clear whether complementary log-log transformation has been performed on the survival probabilities. In addition, although a logrank test can be performed, the functions LRMI and LRMI.summ need to be used additionally because this test depends on the survdiff() function and cannot be completed within the KMMI function, with a cumbersome process and complex operations.

[0086] Therefore, to solve the problems of poor survival analysis effect, incompatibility between data and programs, cumbersome and complex survival analysis process, and the need for users to manually combine multiple different functional programs, this embodiment proposes a new survival analysis method as described above, namely a program. Through this method, after the user directly submits the dataset to be analyzed to the system, no other operations need to be performed, and the final survival curve can be obtained. Moreover, during the analysis process of the dataset, the problem of poor data compatibility is eliminated, the overall process steps are simplified, and the computational load is reduced. Therefore, only through the method described in this embodiment, the survival curve of the dataset can be obtained quickly and effectively.

[0087] In this embodiment, after obtaining the first dataset, the program will first perform multiple imputations, and then set function parameters, including but not limited to grouping variable km_group, multiply imputed result dataset imputed_data, survival time time, survival status state, whether to plot plot, etc., thereby forming a third dataset.

[0088] As Figure 2 shown, reading the third dataset and performing verification and extraction of the first target parameter on the third dataset includes:

[0089] S12: Read the third dataset and perform validity verification on the third dataset;

[0090] S13: After passing the verification, extract the number of groups, the number of imputations, and the survival time from the third dataset, and perform deduplication and sorting on the survival time in the third dataset.

[0091] Exemplarily, the R language package mice can be loaded by direct loading, and the following software packages can also be loaded simultaneously: survminer, dplyr, tidyr, ggplot2, etc., as well as the specific data information of the third data. Then read the third data and perform validity verification on it. This includes checking the dataset type, checking whether the survival time time and survival status state are filled, checking whether the survival status state only contains 0 and 1, etc. After passing the verification, the program can use functions such as the length function and nlevels function to extract the number of groups groups, use the function $ to extract the number of imputations m from imputed_data, and use the function $ to extract the complete survival time TIME from imputed_data. Then use the function sort(unique()) to perform deduplication and sorting on the survival time to obtain the sorting result.

[0092] To facilitate the storage and extraction of parameters, a data frame surv_data with length(unique_sorted_time) rows and m * groups * 5 columns can be created using data.frame(matrix()) (but not limited to this method) to store the KM results (survival analysis results). When applying, the de-duplicated and sorted survival time TIME can be put into the last column of the data frame using the function cbind. At the same time, the variable n.groups can be initialized for subsequent extraction of the initial risk number of each group of data. Additionally, for the imputed_data in the third data set, that is, for the data in each data frame in the third data set, the complete function can be used for extraction.

[0093] Further, the survival analysis of the third data set based on the survival analysis function calculates and determines the involved survival probabilities, including:

[0094] S14: Perform survival analysis on the third data set based on the function survfit(Surv()) to obtain the survival analysis results;

[0095] S15: Perform the first filling process on the analysis results;

[0096] S16: Calculate the survival probability pooled_surv[j] of each group of data j in the third data set based on the analysis results after the first filling process and the following target formula:

[0097]

[0098] where m is the total number of imputations, i represents the i-th imputation, and surv[i] is the survival probability corresponding to the i-th imputation.

[0099] For example, in this embodiment, the function survfit(Surv()) is used to perform the KM analysis (survival analysis) on the third dataset. Of course, other functions can also be used for the KM analysis, and there is no specific limitation. In each analysis, n.groups = n.groups + (km$n) / m, which means that by extraction, averaging, and accumulation, the initial risk number of each group is obtained. In this embodiment, the results of the survival analysis are stored in the dataset named km. In each analysis, the function $ is used to extract the variable n in km. The variable n is an integer type variable with a length of not less than 2, and it stores the total number of people in each group in the survival analysis (for example, 100 people with hypertension and 200 people without hypertension). This total number is the initial risk number of each group that the system is concerned about. In this embodiment, a total of m analyses are to be performed during data analysis. The risk numbers of each group are not the same in each analysis, so it is necessary to accumulate and average. Then, a and b are initialized, where a = 1 and b = as.numeric(unname(km$strata[l])), which is used to extract the survival data of each group from the long data frame. The a and b specify the number of rows to extract data from the long data frame temp_surv, that is, extract from row a to row b. km$strata[l] means that the results of the KM analysis are stored in the dataset named km, and in each analysis, the function $ is used to extract the l-th value in the variable strata in km. unname is used to remove the name of the data and only retain the number itself, and as.numeric is used to convert the number to the numeric type. Using the loop variable l (l = 1:groups), the column names of the data frame surv_data are set. The function $ is used to extract time (survival time, which is the survival time of a group of data extracted in each analysis, and this survival time time contains the above complete survival time TIME), n.risk (survival risk), n.event (occurred events), n.censor (censored value), surv (survival rate) from the KM survival analysis results, and align them according to TIME and fill them into the data frame surv_data. When l < length(km$strata), a = a + as.numeric(unname(km$strata[l])), b = b + as.numeric(unname(km$strata[l + 1])).

[0100] For the NA values in surv_data, 0 can be filled in to obtain surv_data_imputed_1 for extracting the actual number of events and censored values. Then, the function fill(everything(),.direction(direction) = "down") is used to fill the data of the previous row downward in the analysis results to obtain surv_data_imputed_2, which is used to calculate the expected events using the survival probability.

[0101] For surv_data_imputed_2, extract the survival time column time and the survival probability column surv of each imputation data group, and calculate the combined survival probability using the following formula:

[0102]

[0103] After obtaining the combined survival probability, the survival time time and the combined survival probability pooled_surv can be stored in the newly created data frame surv_exp.

[0104] As Figure 3 shown, extracting the second target parameter at each time point in the third dataset includes:

[0105] S17: Perform a second filling process on the analysis results, and extract the actual number of events in the third dataset and the censored values for each group corresponding to each time point from the analysis results after the second filling process;

[0106] S18: Store the actual number of events and the censored values in different log-rank test data frames for preservation.

[0107] For example, when extracting the actual number of events for each group at each time point, in the surv_data_imputed_1 data frame (obtained by filling the NA values in surv_data with 0), by looping q = 1:groups and p = 1:m, the (3 + 5*(q - 1) + 5*groups*(p - 1))-th column is extracted and the row means are calculated (the loop variable q ranges from 1 to groups (the number of groups), the loop variable p ranges from 1 to m (the number of imputations), and the calculation result of the above formula forms the column index for specifying which column data in the surv_data_imputed_1 table to extract), and the row means are stored in the newly created data frame logrank_Oi. For the data frame logrank_Oi, the sum of each row of data is calculated and stored as a new variable dj. Then, the censoring values censor for each group at each time point are extracted, using the surv_data_imputed_1 data frame, with parameters q = 1:groups and p = 1:m, and the (4 + 5*(q - 1) + 5*groups*(p - 1))-th column is extracted, and then the row means are calculated and the row means are stored in the newly created data frame logrank_censor.

[0108] For example, the program performs km analysis m times in each imputed dataset. Each time, 5 data for each group are sequentially extracted and stored, namely time, n.risk, n.event (the events that occurred), n.censor, and surv as described above. Taking the blood pressure data of different patients as an example dataset, in the first analysis, the data of the first group of patients without hypertension are extracted and stored in columns 1 - 5 of the surv_data data frame, and the data of the second group of patients with hypertension are extracted and stored in columns 6 - 10. If there are more groups, the above steps are repeated accordingly. In the second analysis, the data in columns 1'1 - 15 and 16 - 20 will be extracted and stored, and so on. A total of m analyses are performed, and 5*groups columns of data are stored each time. Therefore, all n.event are stored in the (5*k + 3)-th column of the surv_data table, where k = 0, 1, 2, 3…, that is, columns 3, 8, 13, 18, 23, 28… If the number of groups is 2, all the data of the first group are in columns 3, 13, 23…, and all the data of the second group are in columns 8, 18, 28; if the number of groups is 3, the data of the first group are in columns 3, 18…, the data of the second group are in columns 8, 23…, and the data of the third group are in columns 13, 28…; if the number of groups is groups and the number of imputations is m, after derivation, to extract n.event, that is, the actual number of events, for each group separately, the column index needs to satisfy 3 + 5*(q - 1) + 5*groups*(p - 1).

[0109] Further, processing the survival probability and the second target parameter based on the product-limit method to obtain the number of expected risk objects of different types at different survival time points, including:

[0110] S19: Processing the survival probability and the second target parameter based on the product-limit method to estimate the number of first expected risk objects corresponding to each group of data when the end event occurs;

[0111] S20: Calculating the number of second expected risk objects when no event occurs based on the censoring value and the actual number of events.

[0112] In this embodiment, according to the product-limit method, the survival probability is used to inversely deduce the expected number of risk people when the end event occurs. For example, in the loop col = 1:ncol(surv_exp), column_values = surv_exp[[col]], and Oi_column_values = logrank_Oi[[col]]. In the loop row = 2:length(column_values), x = column_values[row], x_above = column_values[row - 1], y = Oi_column_values[row]. When y!= 0 and x_above - x!= 0, the expected number of risk people ni.risk = (x_above / (x_above - x)) * y. The meaning of the above formula includes:

[0113] ncol(surv_exp) will return a value indicating how many columns the table surv_exp has. Since the number of columns of the tables surv_exp and logrank_Oi is the same, the number of columns of the table surv_exp is extracted here. The loop col = 1:ncol(surv_exp) traverses each column of these two tables.

[0114] column_values = surv_exp[[col]] and Oi_column_values = logrank_Oi[[col]] extract the values of the col-th column from the tables surv_exp and logrank_Oi.

[0115] length(column_values) returns a value indicating how many rows there are in the data column_values. Since the number of rows in the data column_values is the same as that in Oi_column_values, the number of rows in column_values is extracted. The loop row = 2:length(column_values) traverses each row of the data starting from the second row.

[0116] x = column_values[row] means using x to represent the data in the col-th column and row-th row of the table surv_exp; x_above = column_values[row - 1,] means using x_above to represent the data in the col-th column and (row - 1)-th row of the table surv_exp, that is, the data above x. y = Oi_column_values[row] means using y to represent the data in the col-th column and row-th row of the table logrank_Oi. x and x_above are data representing survival probabilities, and y is data representing the number of deaths.

[0117] y!= 0 and x_above - x!= 0, which ensures that there are differences between the data in the upper and lower rows. Only the expected number of at-risk people when there is an end event is calculated. Otherwise, the calculation formula for ni.risk will be 0 or divided by 0.

[0118] The KM analysis is based on the product-limit assumption. The survival probability x at the next time point is equal to the survival probability x_above at the previous time point multiplied by (the number of at-risk people - the number of deaths) / the number of at-risk people. Here, the number of at-risk people is ni.risk, and the number of deaths is y, that is, expressed as x = x_above*(ni.risk - y) / ni.risk. Therefore, by reverse deduction, the expected number of at-risk people ni.risk = (x_above / (x_above - x))*y.

[0119] In this embodiment, the expected number of at-risk objects for each group of data is obtained in the above manner, such as the expected number of people at risk of having or being likely to cause a certain disease. Then, the expected number of at-risk objects for each group can be stored in the data frame logrank_ni.risk.

[0120] Next, n.groups can be used to fill in the expected number of at-risk people at the first survival time point for each group in the data frame logrank_ni.risk, and the expected number of at-risk people when no event occurs can be calculated using logrank_censor and logrank_Oi. For example, in the loop col = 1:ncol(logrank_ni.risk), ni_risk_column = logrank_ni.risk[[col]], censor_column = logrank_censor[[col]], and Oi_column = logrank_Oi[[col]]. In the loop row = 2:length(ni_risk_column), if the current cell is NA, the following calculation is performed: new_value <- ni_risk_column[row - 1] - censor_column[row - 1] - Oi_column[row - 1]. The meaning of this formula is that for a certain time point when no end event occurs, the expected number of at-risk people when no event occurs can be calculated using the number of at-risk people (logrank_ni.risk), the number of events occurred (logrank_Oi), and the number of censored people (logrank_censor). If the current cell is NA, it means the cell corresponding to the time point when no event occurs. To calculate the number of at-risk people at the current time point, subtract the number of events occurred and the number of censored people at the previous time point from the number of at-risk people at the previous time point, that is, new_value = ni_risk_column[row - 1] - censor_column[row - 1] - Oi_column[row - 1]. Then store new_value in the current cell, which is to update the value of the current cell NA. After that, sum the data of each row in logrank_ni.risk and store the sum value as a new variable nj.

[0121] In one embodiment, determining the expected number of events based on the third data set and the number of the expected risk objects of different types includes:

[0122] S21: In the third data set, calculate and determine the expected number of events for each group of data at each time point based on the first expected risk object number, the second expected risk object number, and the actual number of events.

[0123] Exemplarily, in the loop r = 1:groups, ni_risk_col = logrank_ni.risk[[r]], dj_col = logrank_Oi$dj (actual number of events), nj_col = logrank_ni.risk$nj, and Ei = ni_risk_col / nj_col * dj_col. This formula indicates that the table logrank_ni.risk has a total of groups + 1 columns. The first groups columns store the expected risk numbers for each group, and the last column is nj, which is the sum of each row in the first groups columns. ncol(logrank_ni.risk) will return a value representing the number of columns in the table logrank_ni.risk. The loop col = 1:ncol(logrank_ni.risk) iterates through the first groups columns of the table logrank_ni.risk. ni_risk_col = logrank_ni.risk[[r]] represents the value of the current column, which is the risk number. dj_col = logrank_Oi$dj uses the function $ to extract the column dj from the table logrank_Oi, representing the total number of events that occurred in each group. nj_col = logrank_ni.risk$nj uses $ to extract the column nj from the table logrank_ni.risk, representing the total risk number. The expected number of events = risk number / total risk number * total number of events, that is, Ei = ni_risk_col / nj_col * dj_col.

[0124] Store the calculated Ei (expected number of events corresponding to each group of data) into the newly created data frame logrank_Ei. Then, sum the data in each column of logrank_Ei to obtain the total expected number of events for each group and store it in the newly created data frame logrank_sum_Ei.

[0125] Furthermore, determining the difference between the expected number of events and the actual number of events in the third dataset includes:

[0126] S22: Determine the expected number of events and the actual number of events at each time point corresponding to each group of data;

[0127] S23: Determine the difference between the expected number of events and the actual number of events at each time point for each group of data;

[0128] S24: Determine the total difference based on the difference between the expected number of events and the actual number of events at each time point for each group of data.

[0129] This embodiment is used to calculate the difference Oi_Ei between the actual observation value and the theoretical prediction value. For col in 1:ncol(logrank_Ei), Oi_column = logrank_Oi[[col]], Ei_column = logrank_Ei[[col]], and difference_column = Oi_column - Ei_column. This formula indicates that ncol(logrank_Ei) will return a value representing the number of columns in the table logrank_Ei. The number of columns in the tables logrank_Ei and logrank_Oi is the same, so the number of columns in the table logrank_Ei is extracted. col in 1:ncol(logrank_Ei) means traversing each column of these two tables. Oi_column = logrank_Oi[[col]] means extracting the col-th column of the table logrank_Oi, representing the actual number of events that occurred in a certain group. Ei_column = logrank_Ei[[col]] means extracting the col-th column of the table logrank_Ei, representing the expected number of events that occurred in a certain group. difference_column = Oi_column - Ei_column means calculating the difference between the actual number of events and the expected number of events that occurred in a certain group.

[0130] Store the calculation results of the above formulas into the newly created data frame logrank_Oi_Ei. Then sum the data in each column of logrank_Oi_Ei to obtain the total difference value between the actual events and the expected events in each group. Then it can be stored in the data frame logrank_sum_Oi_Ei for calculating the log-rank statistic.

[0131] When calculating the log-rank statistic, it includes:

[0132] (1) When groups < 3

[0133] Var = sum(logrank_ni.risk[[1]] * logrank_ni.risk[[2]] * logrank_Oi$dj * (logrank_ni.risk$nj - logrank_Oi$dj) / logrank_ni.risk$nj / logrank_ni.risk$nj / (logrank_ni.risk$nj - 1));

[0134] This arithmetic expression is used to calculate the variance statistic when groups < 3 (i.e., groups = 2). sum is the summation function, and the meanings of the variables included inside are as follows:

[0135] logrank_ni.risk[[1]] represents the number of at-risk patients at each survival time point in Group 1. logrank_ni.risk[[2]] represents the number of at-risk patients at each survival time point in Group 2. logrank_Oi$dj, that is, extracting column dj from the table logrank_Oi using $, represents the total number of events occurring at each survival time point, as described in Subsection S18. logrank_ni.risk$nj, that is, extracting column nj from the table logrank_ni.risk using $, represents the total number of at-risk patients at each survival time point, as described in Subsection S20. According to the definition of the log-rank test, its statistical test statistic is:

[0136]

[0137] Among them, the calculation formula for the variance statistic Var is as follows:

[0138]

[0139] n1 f is logrank_ni.risk[[1]]; n2f is logrank_ni.risk[[2]], n1 f + n2f is logrank_ni.risk$nj; m1 f + m2f is logrank_Oi$dj. Substituting the data into the calculation formula, the described Var is obtained. Since the above calculation formula is performed at each survival time point, sum() needs to be included externally for summation to obtain the total variance value.

[0140] chi_value = logrank_sum_Oi_Ei[[1]] * logrank_sum_Oi_Ei[[1]] / Var; Use the pchisq function to perform a two-sided chi-square test on chi_value with 1 degree of freedom to obtain p_value, and then the program outputs chi_value and p_value. The meaning of this process is that the denominator Var of the log-rank calculation formula has been calculated, and the numerator (O2 - E2) is the above-mentioned logrank_sum_Oi_Ei[[1]], as described in Subsection S24, representing the difference between the observed number of events and the expected number of events for each group at each survival time point. Then, sum the differences at each survival time point to obtain the total difference. Since when groups < 3 (i.e., groups = 2), logrank_sum_Oi_Ei[[1]] and logrank_sum_Oi_Ei[[2]] are equal, logrank_sum_Oi_Ei[[1]] is used.

[0141] (2) When groups ≥ 3, first perform an overall comparison. In the loop of i = 1:groups, total_chi_value = chi_value + (logrank_sum_Oi_Ei[[i]])^2 / logrank_sum_Ei[i]. Use the pchisq function to perform a two-sided chi-square test on total_chi_value with degrees of freedom of groups - 1 to obtain total_p_value, and output total_chi_value and total_p_value. The above process indicates that when groups ≥ 3, that is, when there are at least 3 groups, it involves testing the significance of the overall population and calculating the significance of pairwise comparisons.

[0142] First, the calculation formula for the chi-square statistic for testing the overall significance is: Here, Oi - Ei in the numerator is logrank_sum_Oi_Ei[[i]], which represents the total difference value between the actual events and the expected events in the i-th group, as described in Subsection S24; Ei in the denominator here is logrank_sum_Ei, which represents the total expected number of events in the i-th group, as described in Subsection S21. For summation, use the loop of i = 1:groups. The statement "Use the pchisq function to perform a two-sided chi-square test on total_chi_value with degrees of freedom of groups - 1 to obtain total_p_value" is to find the P value after obtaining the chi-square statistic. The reason for performing a test with degrees of freedom of groups - 1 is that at this time, the log-rank statistic approximates a chi-square distribution with degrees of freedom of groups - 1.

[0143] G (≥2) groups:

[0144] log-rank statistic ∼ χ 2 with

[0145] G - 1 df

[0146] Next, pairwise comparisons are performed. In the loops i = 1:(num_cols - 1) and j = (i + 1):num_cols, sum_Ei_i = logrank_sum_Ei[[i]], sum_Ei_j = logrank_sum_Ei[[j]], sum_Oi_Ei_i = logrank_sum_Oi_Ei[[i]], and sum_Oi_Ei_j = logrank_sum_Oi_Ei[[j]]. chi_value = sum_Oi_Ei_i^2 / sum_Ei_i + sum_Oi_Ei_j^2 / sum_Ei_j. The pchisq function is used to perform a two-sided chi-square test on chi_value with 1 degree of freedom to obtain p_value. At this time, the program outputs chi_value and p_value. The meanings of the above variables are as follows: sum_Ei_i = logrank_sum_Ei[[i]] is the value of the i-th column of the table logrank_sum_Ei, representing the total expected number of events in the i-th group. sum_Ei_j = logrank_sum_Ei[[j]] is the value of the j-th column of the table logrank_sum_Ei, representing the total expected number of events in the j-th group. sum_Oi_Ei_i = logrank_sum_Oi_Ei[[i]] is the value of the i-th column of the table logrank_sum_Oi_Ei, representing the total difference between the actual and expected events in the i-th group. sum_Oi_Ei_j = logrank_sum_Oi_Ei[[j]] is the value of the j-th column of the table logrank_sum_Oi_Ei, representing the total difference between the actual and expected events in the j-th group. Among them, the formula chi_value = sum_Oi_Ei_i^2 / sum_Ei_i + sum_Oi_Ei_j^2 / sum_Ei_j is used to calculate the chi-square value for pairwise comparison tests. "Using the pchisq function to perform a two-sided chi-square test on chi_value with 1 degree of freedom to obtain p_value. At this time, the program outputs chi_value and p_value." represents obtaining the P value after obtaining the chi-square statistic.

[0147] At this time, surv_exp can be converted to long format and the survival time time can be added, and the ggplot function is used to draw the survival curve. Of course, other functions can also be used to draw the survival curve, and the specific function used is not unique.

[0148] In each of the above embodiments, the functions and equations described are presented and described in combination with the corresponding code. By integrating the above logrank test procedure, survival analysis and logrank test can be directly completed in the method of this embodiment. Moreover, in this embodiment, when performing the logrank test, the survdiff() function that was used in the past during this test process is not used. Instead, the test calculation is achieved through the above method. Therefore, not only can the operation be further simplified for users, but also the data processing efficiency can be further improved.

[0149] As Figure 4 shown, another embodiment of the present invention simultaneously provides a dataset survival analysis device 100, including:

[0150] A preprocessing module, configured to preprocess the first dataset to be analyzed to obtain a second dataset with complete data;

[0151] A setting module, configured to set function parameters regarding the survival analysis algorithm in the second dataset to form a third dataset;

[0152] A verification module, configured to read the third dataset and perform verification on the third dataset and extract first target parameters;

[0153] A survival analysis module, configured to perform survival analysis on the third dataset based on a survival analysis function and calculate and determine the involved survival probabilities;

[0154] An extraction module, configured to extract second target parameters at each time point in the third dataset;

[0155] A processing module, configured to process the survival probabilities and second target parameters based on the product limit method to obtain the number of different types of expected risk objects at different survival time points;

[0156] A first determination module, configured to determine the expected number of events based on the third dataset and the number of different types of the expected risk objects;

[0157] A second determination module, configured to determine the difference between the expected number of events and the actual number of events in the third dataset;

[0158] A calculation module, configured to calculate the chi-square value and P value of the log-rank test in combination with the difference;

[0159] A plotting module, configured to plot a survival curve corresponding to the third dataset in combination with the survival probabilities, chi-square value, and P value.

[0160] In some embodiments, the preprocessing of the first dataset to be analyzed to obtain a second dataset with complete data includes:

[0161] Perform multiple imputation processing on the first data set to obtain the second data set.

[0162] In some embodiments, reading the third data set and performing verification and extraction of the first target parameter on the third data set includes:

[0163] Read the third data set and perform validity verification on the third data set;

[0164] After passing the verification, extract the number of groups, the number of imputations, and the survival time in the third data set, and perform deduplication and sorting on the survival time in the third data set.

[0165] In some embodiments, performing survival analysis on the third data set based on a survival analysis function and calculating and determining the involved survival probability includes:

[0166] Perform survival analysis on the third data set based on the function survfit(Surv()) to obtain a survival analysis result;

[0167] Perform a first filling process on the analysis result;

[0168] Based on the analysis result after the first filling process and the following target formula, calculate the survival probability pooled_surv[j] for each group of data j in the third data set:

[0169]

[0170] where m is the total number of imputations, i represents the i-th imputation, and surv[i] is the survival probability corresponding to the i-th imputation.

[0171] In some embodiments, extracting the second target parameter at each time point in the third data set includes:

[0172] Perform a second filling process on the analysis result, and extract the actual number of events in the third data set and the censored values of each group corresponding to each time point from the analysis result after the second filling process;

[0173] Store the actual number of events and the censored values in different log-rank test data frames for preservation.

[0174] In some embodiments, processing the survival probability and the second target parameter based on the product limit method to obtain the number of different types of expected risk objects at different survival time points includes:

[0175] Based on the product limit method, process the survival probability and the second target parameter to estimate the first expected number of risk objects for each group of data when the end event occurs;

[0176] Calculate the second expected number of risk objects when no event occurs based on the censored values and the actual number of events.

[0177] In some embodiments, the determining the expected number of events based on the third data set and the expected number of risk objects of different types includes:

[0178] In the third data set, calculate and determine the expected number of events for each group of data at each time point based on the first expected number of risk objects, the second expected number of risk objects, and the actual number of events.

[0179] In some embodiments, the determining the difference between the expected number of events and the actual number of events in the third data set includes:

[0180] Determine the expected number of events and the actual number of events at each time point corresponding to each group of data;

[0181] Statistically calculate the total expected number of events and the total actual number of events at all time points corresponding to each group of data;

[0182] Based on the total expected number of events and the total actual number of events, calculate and determine the total difference between the actual events and the expected events corresponding to each group of data.

[0183] The present invention also provides an electronic device, including:

[0184] One or more processors;

[0185] A memory configured to store one or more programs;

[0186] When the one or more programs are executed by the one or more processors, the one or more processors implement the data set survival analysis method as described in any one of the above embodiments.

[0187] Furthermore, an embodiment of the present invention also provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the data set survival analysis method as described above. It should be understood that each of the solutions in this embodiment has the corresponding technical effects in the above method embodiments, and will not be elaborated here.

[0188] Furthermore, an embodiment of the present invention also provides a computer program product, the computer program product is tangibly stored on a computer-readable medium and includes computer-readable instructions, and when the computer-executable instructions are executed, at least one processor is caused to execute the data set survival analysis method such as in the above embodiments.

[0189] It should be noted that the computer storage medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. A computer-readable medium can, for example but not limited to, be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program configured to be used by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, antenna, optical cable, RF, etc., or any suitable combination of the above.

[0190] In addition, those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0191] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate for realizing the process Figure 1one or more processes and / or blocks Figure 1 a system for the functions specified in one or more blocks

[0192] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction system that implements the functions specified in one Figure 1 one or more processes and / or blocks Figure 1 one or more blocks

[0193] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is exemplary only and is not intended to imply that the scope of protection of this application is limited to these examples; under the concept of this application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of one or more embodiments of this application as described above, which are not provided in detail for the sake of brevity.

Claims

1. A method for survival analysis of a dataset, characterized in that, include: preprocessing the first data set to be analyzed to obtain a second data set with complete data; Setting function parameters of a survival analysis algorithm in the second data set to form a third data set; Reading the third data set, verifying the third data set and extracting the first target parameter; Performing a survival analysis on the third data set based on a survival analysis function to calculate and determine the survival probability involved; extracting a second target parameter at each time point in the third data set; Processing the survival probability and the second target parameter based on the product limit method to obtain the number of different types of expected risk subjects at different survival time points; determining an expected number of events based on the third data set and the expected number of risk subjects of different types; determining a difference between the expected number of events and an actual number of events in the third data set; Calculate the chi-square value and P value of the log-rank test based on the difference; A survival curve corresponding to the third data set is drawn by combining the survival probability, chi-square value, and P value.

2. The dataset survival analysis method according to claim 1, wherein The preprocessing of the first data set to be analyzed to obtain a second data set with complete data includes: Perform multiple interpolation processing on the first data set to obtain the second data set.

3. The method for survival analysis of a data set according to claim 2, characterized in that, The reading of the third data set, verifying the third data set, and extracting the first target parameter includes: Reading the third data set and performing validity verification on the third data set; After passing the verification, the number of groups, the number of interpolation times, and the survival time in the third data set are extracted, and the survival time in the third data set is deduplicated and sorted.

4. The survival analysis method for a data set according to claim 2, wherein The performing survival analysis on the third data set based on the survival analysis function to calculate and determine the survival probability involved includes: Performing a survival analysis on the third data set based on the function survfit(Surv()) to obtain a survival analysis result; performing a first filling process on the analysis result; Based on the analysis results after the first filling process and the following target formula, the survival probability pooled_surv[j] of each group of data j in the third data set is calculated: Where m is the total number of interpolations, i represents the i-th interpolation, and surv[i] is the survival probability corresponding to the i-th interpolation.

5. The method for survival analysis of a data set according to claim 2, characterized in that The extracting the second target parameter at each time point in the third data set includes: Performing a second filling process on the analysis results, and extracting the actual number of events in the third data set and the missing values of each group corresponding to each time point from the analysis results after the second filling process; The actual number of events and the censored value are respectively stored in different log-rank test data frames for preservation.

6. The survival analysis method for a data set according to claim 5, characterized in that The method of processing the survival probability and the second target parameter based on the product limit method to obtain the number of different types of expected risk subjects at different survival time points includes: Processing the survival probability and the second target parameter based on the product limit method, estimating the first expected number of risk subjects corresponding to each group of data when the endpoint event occurs; The second expected number of risk subjects when no event occurs is calculated based on the censoring value and the actual number of events.

7. The dataset survival analysis method according to claim 6, characterized in that Determining the expected number of events based on the third data set and the number of the expected risk objects of different types includes: In the third data set, calculating and determining the expected number of events of each group of data at each time point based on the first expected risk object number, the second expected risk object number, and the actual number of events.

8. The dataset survival analysis method according to claim 1, wherein, Determining the difference between the expected number of events and the actual number of events in the third data set includes: Determining the expected number of events and the actual number of events at each time point corresponding to each group of data; Counting the total expected number of events and the total actual number of events at all time points corresponding to each group of data; Calculating and determining the total difference between the actual events and the expected events corresponding to each group of data based on the total expected number of events and the total actual number of events.

9. A dataset survival analysis device, characterized in that, Including: A preprocessing module, configured to preprocess the first data set to be analyzed to obtain a second data set with complete data; A setting module, configured to set function parameters regarding the survival analysis algorithm in the second data set to form a third data set; A verification module, configured to read the third data set and perform verification on the third data set and extract the first target parameter; A survival analysis module, configured to perform survival analysis on the third data set based on the survival analysis function and calculate and determine the involved survival probability; An extraction module, configured to extract the second target parameter at each time point in the third data set; A processing module, configured to process the survival probability and the second target parameter based on the product-limit method to obtain the number of expected risk objects of different types at different survival time points; A first determination module, configured to determine the expected number of events based on the third data set and the number of the expected risk objects of different types; A second determination module, configured to determine the difference between the expected number of events and the actual number of events in the third data set; A calculation module, configured to calculate the chi-square value and the P value of the log-rank test in combination with the difference; A plotting module, configured to plot a survival curve corresponding to the third data set in combination with the survival probability, the chi-square value, and the P value.

10. An electronic device, characterized in that, Including: One or more processors; A memory, configured to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for survival analysis of multiple data sets according to any one of claims 1-8.