Survival Analysis

Survival Analysis is widely used in the biosciences to quantify survivorship in a population under study. Origin supports three widely used tests, they are available in OriginPro:

Name Brief Description
kaplanmeier Kaplan-Meier (product-limit) Estimator
phm_cox Cox Proportional Hazards Model
weibullfit Weibull Fit

For a full description of these X-functions, including input and output arguments, please see the Survival Analysis.

Kaplan-Meier Estimator

If you want to estimate the survival ratio, create survival plots and compare the quality of survival functions, use the kaplanmeier X-Function. It uses product-limit method to estimate the survival function, and supports three methods for testing the equality of the survival function: Log Rank, Breslow and Tarone-Ware.

As an example, scientists are looking for a better medicine for cancer resistance. After exposing some rats to carcinogen DMBA, they apply different medicine to two different groups of rats and record their survival status for the first 60 hours. They wish to quantify the difference in survival rates between the two medicines.

// Import sample data
fname$ = system.path.program$ + "Samples\Statistics\SurvivedRats.dat";

//Perform Kaplan-Meier Analysis
kaplanmeier irng:=(1,2,3) censor:=0 logrank:=1 
            rd:=<new name:="sf"> 
            rt:=<new name:="km">;

//Get result from survival report tree
getresults tr:=mykm iw:="km";

if (mykm.comp.logrank.prob <= 0.05)
    type "The two medicines have significantly different"
    type "effects on survival at the 0.05 level ..."; 
    type "Please see the survival plot.";
    //Plot survival Function
    plotxy iy:=(?, 1:end) plot:=200 o:=[<new template:=survivalsf>];
    type "The two medicines are not significantly different.";

Cox Proportional Hazard Regression

The phm_cox X-Function can be used to obtain the parameter estimates and other statistics associated with the Cox Proportional hazards model for fixed covariates. It can then forecast the change in the hazard rate along with several fixed covariates.

For example, we want to study on 66 patients with colorectal carcinoma to determine the effective prognostic parameter and the best prognostic index (a prognostic parameter is a parameter that determines whether a person has a certain illness). This script implements the phm_cox X-Function to get the relevant statistics.

//import a sample data
string fpath$ = "Samples\Statistics\ColorectalCarcinoma.dat";
fname$ = system.path.program$ + fpath$;
impasc option.hdr.LNames:=1 

//Perform Cox Regression 
phm_Cox irng:=(col(1),col(2),col(3):end) censor:=0 rt:=<new name:="cox">;

//Get result from report tree
getresults tr:=cox;

type "Prognostic parameters determining colorectal carcinoma are:";

loop(ii, 1, 7)
  // If probability is less than 0.05, 
  // we can say it is effective for survival time.
  if (cox.paramestim.param$(ii).prob<=0.05)
    type wks.col$(ii+2).comment$;

Weibull Fit

If it is known apriori that data are Weibull distributed, use the weibullfit X-Function to estimate the weibull parameters.

//import a sample data
fname$ = system.path.program$ + "Samples\Statistics\Weibull Fit.dat ";
//Perform Weibull Fit
weibullfit irng:=(col(a), col(b)) censor:=1;