您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > 第十四章生存分析的SAS实现
第十四章生存分析的SAS实现例14-2McKelveyetal(1976)收集了3期的某型淋巴瘤患者的生存时间(天)。分别是6,19,32,42,42,43+,94,126+,169+,207,211+,227+,253,255+,270+,310+,316+,335+,346+。SAS分析程序datach14_2;定义数据集名inputtc@@;输入生存时间变量t和截尾情况变量ccards;开始输入数据61191321421421430941126016902071211022702531255027003100316033503460;proclifetestplots=(s);利用lifetest过程进行生存分析并作生存函数图timet*c(0);指定时间变量和截尾变量并指出数据截尾时截尾变量的取值run;SAS软件输出结果Product-LimitSurvivalEstimatesSurvivalStandardNumberNumbertSurvivalFailureErrorFailedLeft0.0001.0000000196.0000.94740.05260.051211819.0000.89470.10530.070421732.0000.84210.15790.083731642.000...41542.0000.73680.26320.101051443.000*...51394.0000.68020.31980.1080612126.000*...611169.000*...610207.0000.61210.38790.116779211.000*...78227.000*...77253.0000.52470.47530.128786255.000*...85270.000*...84310.000*...83316.000*...82335.000*...81346.000*...80NOTE:Themarkedsurvivaltimesarecensoredobservations.SummaryStatisticsforTimeVariabletQuartileEstimatesPoint95%ConfidenceIntervalPercentEstimate[LowerUpper)75...50.94.000.2542.00032.000.MeanStandardError181.70124.497NOTE:ThemeansurvivaltimeanditsstandarderrorwereunderestimatedbecausethelargestobservationwascensoredandtheestimationwasrestrictedtothelargesteventtimeSummaryoftheNumberofCensoredandUncensoredValuesPercentTotalFailedCensoredCensored1981157.890.000.250.500.751.00t050100150200250300350Legend:Product-LimitEstimateCurveCensoredObservationsSAS软件输出结果解释该结果包含四个部分:第一部分用乘积极限法估计了生存率(Survival),死亡率(Failure),生存率的标准误(SurvivalStandardError),死亡例数(NumberFailed)和该时间点前的生存例数(NumberLeft)。其中带有*号的表示截尾;第二部分给出了关于生存时间的描述性统计量,包括75%,50%和25%分位数以及相应的95%的可信区间(95%ConfidenceInterval),还有均数(Mean)和标准误(StandardError)从结果可以看出平均生存时间为181.701天;第三部分列出了完全数据(Failed),截尾数据(Censored)的例数,以及截尾数据占全部数据的百分比(PercentCensored)。最后是生存曲线图。教材中的说明现用Kaplan-Meier法计算生存率,步骤如下:(1)将所有生存时间按从小到大顺序排列(见表14-2第(2)列)并标上序号(第(1)列)。(2)列出各t时点前的存活病例数n(第(3)列)、各个时间点的死亡人数d(第(4)列)和截尾人数c(第(5)列)。(3)计算各t时刻的死亡概率/qdn(第(6)列)。例如生存时间为32天时,死亡概率为1/170.058824q。(4)计算各t时刻的生存概率1pq(第(7)列)。例如生存时间为32天时,生存概率为1-0.0588240.941176p。(5)计算各t时刻的生存率12()iiStppp(第(8)列)。例如生存时间为32天时,生存率为18171616(32)0.94117619181719S,由此验证了在没有截尾数据的情况下,式(14-4)与式(14-5)是相同的。(6)以时间t为横指标,生存率为纵指标,作生存曲线图(图14-1)。表14-2Kaplan-Meier法计算生存率的计算用表(1)(2)(3)(4)(5)(6)(7)(8)序号生存天数t时刻前的例数nt时刻死亡数dt时刻后截尾人数c死亡概率q生存概率p生存率S(t)1619100.0526320.9473680.94736821918100.0555560.9444440.89473733217100.0588240.9411760.84210544216200.1250000.8750000.73684264314010.0000001.0000000.73684279413100.0769230.9230770.680162812612010.0000001.0000000.680162916911010.0000001.0000000.6801621020710100.1000000.9000000.612146112119010.0000001.0000000.612146122278010.0000001.0000000.612146132537100.1428570.8571430.524696142556010.0000001.0000000.524696152705010.0000001.0000000.524696163104010.0000001.0000000.524696173163010.0000001.0000000.524696183352010.0000001.0000000.524696193461010.0000001.0000000.524696图14-1例14-2的生存曲线图例14-3下面是来自于Berkson&Gage(1950)的一个研究队列。为了叙述方便,把原来的出院后的生存时间改称为某恶性肿瘤术后生存时间。共有374名患者进入研究队列。表14-3寿命表法计算生存率的计算用表(1)(2)(3)(4)(5)(6)(7)(8)(9)序号术后生存年数期初观察例数期内死亡期内截尾人数校正期初人数死亡概率生存概率生存率tndcnc=n-c/2q=d/ncp=1-qS(t)10~3749003740.24060.75940.759421~2847602840.26760.73240.556132~2085102080.24520.75480.419843~15725121510.16560.83440.350354~120205117.50.17020.82980.290765~957990.50.07730.92270.268276~794974.50.05370.94630.253887~661364.50.01550.98450.249898~623559.50.05040.94960.2372109~542551.50.03880.96120.22801110+472126340.61760.38240.0872SAS分析程序datach14_3;定义数据集名doc=0to1;定义截尾变量doi=1to11;inputtf@@;输入时间变量和频数变量output;end;end;cards;090176251325420576471839210210010203124559697385951026;proclifetestdata=ch14_3利用lifetest过程进行生存分析method=lifewidth=1plots=(s);采用寿命表法并作生存函数图timet*c(1);指定时间变量和截尾变量并指出数据截尾时截尾变量的取值freqf;指定频数变量run;SAS软件输出结果TheLIFETESTProcedureLifeTableSurvivalEstimatesConditionalEffectiveConditionalProbabilityIntervalNumberNumberSampleProbabilityStandard[Lower,Upper)FailedCensoredSizeofFailureErrorSurvivalFailure01900374.00.24060.02211.0000012760284.00.26760.02630.75940.240623510208.00.24520.02980.55610.4439342512151.00.16560.03020.41980.580245205117.50.17020.03470.35030.6497567990.50.07730.02810.29070.7093674974.50.05370.02610.26820.7318781364.50.01550.01540.25380.7462893559.50.05040.02840.24980.75029102551.50.03880.02690.23720.762810.212634.00.61760.08330.22800.7720EvaluatedattheMidpointoftheIntervalSurvivalMedianMedianPDFHazardIntervalStandardResidualStandardStandardStandard[Lower,Upper)ErrorLifetimeErrorPDFErrorHazardError0102.41180.18960.24060.02210.2735560.028564120.02212.57710.32420.20320.02080.3089430.035013230.02573.55990.85760.13640.01770.2794520.038747340.0255..0.06950.01340.1805050.035954450.0248..0.05960.01290.1860470.041421560.0239..0.02250.008370.080460.030386670.0235..0.01440.007120.0551720.027576780.0233..0.003930.003920.0156250.015625890.0233..0.01260.007180.0517240.0298539100.0232..0.009210.006450.0396040.02799910.0.0232......SummaryoftheNumberofCensoredandUncensoredValuesPercentTotalFailedCensoredCensored3743007419.79NOTE:Therewere3observationswithmissingvalues,negativetimevaluesorfrequencyvalueslessthan1.0.000.250.500.751.00t024681012
本文标题:第十四章生存分析的SAS实现
链接地址:https://www.777doc.com/doc-2164975 .html