October11,2007
TitleRelativesurvivalregressionVersion1.4
AuthorMajaPoharPerme
DescriptionVariousfunctionsforregressioninrelativesurvival.MaintainerMajaPoharPerme Rtopicsdocumented: invtime....joinrate....plot.rs.zph...rdata......residuals.rsaddrsadd......rs.br......rsmul.....rs.surv.....rstrans.....rsurvaux....rs.zph.....slopop.....srvxp.fit....survfit.rsadd..survsplit....transrate....transrate.hld..transrate.hmd. Index 1 .....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................23455689111213141515161718192022 2invtime invtimeInversetransformingoftimeinRelativeSurvival Description ThisfunctioncanbeusedwhenpredictinginRelativeSurvivalusingthetransformedtimeregres-sionmodel(usingrstransfunction).ItinversesthetimefromYtoTinrelativesurvivalusingthegivenratetable.ThetimesYcanbeproducedwiththerstransfunction,inwhichcase,thisisthereversefunction.Thisfunctiondoesthetransformationforonepersonatatime.Usage invtime(y,age,sex,year,scale,ratetable,lower,upper)Arguments yagesexyearscaleratetablelower timeinY. ageoftheindividual.Mustbeindays. sexoftheindividual.Mustbecodedinthesamewayasintheratetable.dateofdiagnosis.Mustbeindateformat numericvaluetoscaletheresults.Ifratetableisinunits/day,scale=365.25causestheoutputtobereportedinyears.atableofeventrates,suchassurvexp.us. thelowerboundofintervalwheretheresultisexpected.Thisargumentisop-tional,but,ifgiven,canshortenthetimethefunctionneedstocalculatetheresult. theupperboundofintervalwheretheresultisexpected.Seelower upperDetails Worksonlywithratetablesthataresplitbyage,sexandyear.Transformingcanbecomputationallyintensive,uselowerand/oruppertoguesstheintervaloftheresultandthusspeedupthefunction.Value AlistofvaluesTYSeeAlso rstrans theoriginaltimethetransformedtime joinrateExamples 3 data(slopop) invtime(y=0.1,age=23011,sex=\"male\year=9497,ratetable=slopop) joinrateJoinratetables Description Thefunctionjoinstwoormoreobjectsorganizedasratetablebyaddinganewdimension.Usage joinrate(tables,dim.name=\"country\")Arguments tablesdim.nameDetails Thisfunctionjoinstwoormoreratetableobjectsbyaddinganewdimension.Thecutpointsofalltheratetablesarecomparedandonlythecommonintervalskept.Iftheintervalsdefinedbythecutpointsarenotofthesamelength,awarningmessageisdisplayed.Eachratetablemusthave3dimensions,i.e.age,sexandyear(theorderisnotimportant).Value Anobjectofclassratetable.SeeAlso ratetable,transrate.hld,transrate.hmd,transrate.Examples data(ratetables) newpop<-joinrate(list(Arizona=survexp.az,Florida=survexp.fl, Minnesota=survexp.mn),dim.name=\"state\") alistofratetables.Ifnamesaregiven,theyareincludedasdimnames.thenameoftheaddeddimension. 4plot.rs.zph plot.rs.zph GraphicalInspectionofProportionalHazardsAssumptioninRelativeSurvivalModels Description Displaysagraphofthescaledpartialresiduals,alongwithasmoothcurve.Usage ##S3methodforclass'rs.zph': plot(x,resid=TRUE,df=4,nsmo=40,var,cex=1,add=FALSE,col=1, lty=1,xlab,ylab,scale=1,...)Arguments x residdfnsmovar resultofthers.zphfunction. alogicalvalue,ifTRUEtheresidualsareincludedontheplot,aswellasthesmoothfit. thedegreesoffreedomforthefittednaturalspline,df=2leadstoalinearfit.numberofpointsusedtoplotthefittedspline. thesetofvariablesforwhichplotsaredesired.Bydefault,plotsareproducedinturnforeachvariableofamodel.Selectionofasinglevariableallowsotherfeaturestobeaddedtotheplot,e.g.,ahorizontallineatzerooramaintitle.anumericalvaluegivingtheamountbywhichplottingtextandsymbolsshouldbescaledrelativetothedefault. logical,ifTRUEtheplotisaddedtoanexistingplotaspecificationforthedefaultplottingcolor.thelinetype.xaxislabel.yaxislabel. unitsforxaxis,defaultis1,i.e.days. Additionalargumentspassedtotheplotfunction. cexaddcolltyxlabylabscale...SeeAlso rs.zph,plot.cox.zph.Examples data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365, sex=sex,year=year),ratetable=slopop,data=rdata,int=5) rszph<-rs.zph(fit)plot(rszph) rdata5 rdataSurvivalData Description Survivaldata.Usage data(rdata)Format Adataframewith1040observationsonthefollowing6variables:timesurvivaltime(indays). censcensoringindicator(0=censoring,1=death).ageage(inyears). sexsex(1=male,2=female). yeardateofdiagnosis(indateformat).agegragegroup.References PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006. residuals.rsaddCalculateResidualsfora\"rsadd\"Fit Description Calculatespartialresidualsforanadditiverelativesurvivalmodel.Usage ##S3methodforclass'rsadd': residuals(object,type=\"schoenfeld\ Arguments objecttype... anobjectinheritingfromclassrsadd,representingafittedadditiverelativesurvivalmodel.Typicallythisistheoutputfromthersaddfunction. characterstringindicatingthetypeofresidualdesired.CurrentlyonlySchoen-feldresidualsareimplemented.otherarguments. 6Value Alistofthefollowingvaluesisreturned:resvarrvarr1kvarrkvarr1SeeAlso rsadd.Examples amatrixcontainingtheresidualsforeachvariable.thevarianceforeachresidualthesumofvarr. thederivativeofeachresidual,tobeusedinrs.zphfunction.thesumofkvarr. rsadd data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+ratetable(age=age*365,sex=sex,year=year), ratetable=slopop,data=rdata,int=5) sresid<-residuals.rsadd(fit) rsaddFitanAdditivemodelforRelativeSurvival Description Thefunctionfitsanadditivemodeltothedata.Themethodsimplementedarethemaximumlikeli-hoodmethod,aglmmodelwithabinomialerrorandaglmmodelwithapoissonerror.Usage rsadd(formula,data=parent.frame(),ratetable=survexp.us, int,na.action,method,init,bwin,centered,cause,control,...)Arguments formula aformulaobject,withtheresponseontheleftofa~operator,andthetermsontheright.Thetermsconsistofpredictorvariablesseparatedbythe+operator,alongwitharatetableterm.Theratetabletermmatcheseachsubjecttohis/herexpectedcohort.Ifthevariablesareorganizedandnamedinthesamewayasinthepopulationtables,theratetabletermcanbeomitted.TheresponsemustbeasurvivalobjectasreturnedbytheSurvfunction.Thetimemustbeindays. adata.frameinwhichtointerpretthevariablesnamedintheformula.atableofeventrates,organizedasaratetableobject,suchassurvexp.us. dataratetable rsadd int 7 eitherasinglevaluedenotingthenumberoffollow-upyearsoravectorspeci-fyingtheintervals(inyears)inwhichthehazardisconstant(thetimesthatarebiggerthanmax(int)arecensored.Ifmissing,theintervalsaresettobeoneyearlongandincludethemaximumobservedfollow-uptime.TheEMmethoddoesnotneedtheintervals,onlythemaximumtimecanbespecified. amissing-datafilterfunction,appliedtothemodel.frame,afteranysubsetargu-menthasbeenused.Defaultisoptions()$na.action. glm.binorglm.poiforaglmmodel,EMfortheEMalgorithmandmax.likforthemaximumlikelihoodmodel(default). vectorofinitialvaluesoftheiteration.Defaultinitialvalueiszeroforallvari-ables. controlsthebandwidthusedforsmoothingintheEMalgorithm.Thefollow-uptimeisdividedintoquartilesandbwinspecifiesafactorbywhichthemaximumbetweeneventstimelengthoneachintervalismultiplied.Thedefaultbwin=-1letsthefunctionfindanappropriatevalue.Ifbwin=0,nosmoothingisapplied.ifTRUE,allthevariablesarecenteredbeforefittingandthebaselineexcesshazardiscalculatedaccordingly.DefaultisFALSE. Avectorofthesamelengthasthenumberofcases.0forpopulationdeaths,1fordiseasespecificdeaths,2(default)forunknown.CanonlybeusedwiththeEMmethod. alistofparametersforcontrollingthefittingprocess.Seethedocumentationforglm.controlfordetails. otherargumentswillbepassedtoglm.control. na.actionmethodinitbwin centeredcause control...Details Themethodsusingglmaremethodsforgroupeddata.Thegroupsareformedaccordingtothecovariatevalues.Thisshouldbetakenintoaccountwhenfittingamodel.Theglmmethodreturnslifetablesforgroupsspecifiedbythecovariatesingroups. TheEMmethodoutputincludesthesmoothedbaselineexcesshazardlambda0,thecumulativebaselineexcesshazardLambda0andtimesatwhichtheyareestimated.Theindividualproba-bilitesofdyingduetotheexcessriskarereturnedasNie.Thedefaultbwin=-1valueletsthefunctionfindanappropriatevalueforthesmoothingbandwidth.Whilethisensuresanunbiasedestimate,theproceduretimeismuchlonger.Asthevaluefoundbythefunctionisindependentofthecovariatesinthemodel,thevaluecanbereadfromtheoutput(bwinfac)andusedforrefittingdifferentmodelstothesamedatatosavetime.Value Anobjectofclassrsadd.Inthecaseofmethod=\"glm.bin\"andmethod=\"glm.poi\"theclassalsoinheritsfromglmwhichinheritsfromtheclasslm.Objectsofthisclasshavemethodsforthefunctionsprintandsummary.Anobjectofclassrsaddisalistcontainingatleastthefollowingcomponents:dataratetable thedataasusedinthemodel,alongwiththevariablesdefinedintheratetabletheratetableused. 8 intmethod rs.br themaximumtime(inyears)used.Alltheeventsatandafterthisvaluearecensored. thefittingmethodthatwasused. linear.predictors thevectoroflinearpredictors,onepersubject.References PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006.SeeAlso rstrans,rsmulExamples data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365, sex=sex,year=year),ratetable=slopop,data=rdata,int=5)#checkthegoodnessoffitrs.br(fit) #usetheEMmethodandplotthesmoothedbaselineexcesshazardfit<-rsadd(Surv(time,cens)~sex+age+ratetable(age=age*365, sex=sex,year=year),ratetable=slopop,data=rdata,int=5,method=\"EM\") plot(lowess(fit$times,fit$lambda0,f=.2),type=\"l\") rs.br TesttheProportionalHazardsAssumptionforRelativeSurvivalRe-gressionModels Description Testtheproportionalhazardsassumptionforrelativesurvivalmodels(rsadd,rsmulorrstrans)byformingaBrownianBridge.Usage rs.br(fit,sc,rho=0,test=\"max\ rsmulArguments fitscrho 9 theresultoffittingarelativesurvivalmodel,usingthersadd,rsmulorrstransfunction. partialresidualscalculatedbytheresidfunction.Thisisusedtosavetimeifseveraltestsaretobecalculatedontheseresidualsandcanotherwisebeomitted.anumbercontrollingtheweigthsofresiduals.Theweightsarethenumberofindividualsatriskateacheventtimetothepowerrho.Thedefaultisrho=0,whichsetsallweigthsto1. acharacterstringspecifyingthetesttobeperformedonBrownianbridge.Pos-siblevaluesare\"max\"(default),whichteststhemaximumabsolutevalueofthebridge,andcvm,whichcalculatestheCramerVonMisesstatistic.shouldaglobalBrownianbridgetestbeperformed,inadditiontotheper-variabletests test global Value anobjectofclassrs.br.Thisfunctionwouldusuallybefollowedbybothaprintandaplotoftheresult.TheplotgivesaBrownianbridgeforeachofthevariables.Thehorizontallinesarethe95oftheBrownianbridgeReferences StareJ.,PoharM.,HendersonR.\"Goodnessoffitforrelativesurvivalmodels.\"StatisticsinMedicine243911-3925,2005.SeeAlso rsadd,rsmul,rstrans,resid.Examples data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+ratetable(age=age*365,sex=sex, year=year),ratetable=slopop,data=rdata,int=5) rsbr<-rs.br(fit)print(rsbr)plot(rsbr) rsmul FitAndersenetalMultiplicativeRegressionModelforRelativeSur-vival Description FitstheAndersenetalmultiplicativeregressionmodelinrelativesurvival.Anextensionofthecoxphfunctionusingrelativesurvival. 10Usage rsmul rsmul(formula,data,ratetable=survexp.us,int,na.action,init, method,control,...)Arguments formula aformulaobject,withtheresponseontheleftofa~operator,andthetermsontheright.Thetermsconsistofpredictorvariablesseparatedbythe+operator,alongwitharatetableterm.Theratetabletermmatcheseachsubjecttohis/herexpectedcohort.Ifthevariablesareorganizedandnamedinthesamewayasinthepopulationtables,theratetabletermcanbeomitted.TheresponsemustbeasurvivalobjectasreturnedbytheSurvfunction.Thetimemustbeindays. adata.frameinwhichtointerpretthevariablesnamedintheformula.atableofeventrates,suchassurvexp.us. thenumberoffollow-upyearsusedforcalculatingsurvival(therestiscensored).Ifmissing,itissetthethemaximumobservedfollow-uptime. amissing-datafilterfunction,appliedtothemodel.frame,afteranysubsetargu-menthasbeenused.Defaultisoptions()$na.action. vectorofinitialvaluesoftheiteration.Defaultinitialvalueiszeroforallvari-ables. thedefaultmethodmulassumeshazardtobeconstantonyearlyintervals.Methodmul1usestheratetabletodeterminethetimepointswhenhazardchanges.Themul1methodisthereforemoreaccurate,butatthesametimecanbemorecomputationallyintensive. alistofparametersforcontrollingthefittingprocess.Seethedocumentationforcoxph.controlfordetails. Otherargumentswillbepassedtocoxph.control. dataratetableintna.actioninitmethod control...Value anobjectofclasscoxph.References PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006. Andersen,P.K.,Borch-Johnsen,K.,Deckert,T.,Green,A.,Hougaard,P.,Keiding,N.andKreiner,S.\"ACoxregressionmodelforrelativemortalityanditsapplicationtodiabetesmellitussurvivaldata.\Biometrics,921-932,1985.SeeAlso rsadd,rstrans. rs.survExamples 11 data(slopop)data(rdata) fit<-rsmul(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365, sex=sex,year=year),ratetable=slopop,data=rdata)#checkthegoodnessoffitrs.br(fit) rs.survComputeaRelativeSurvivalCurve Description ComputesanestimateoftherelativesurvivalcurveusingtheKaplan-MeiermethodfortheobservedandtheHakulinenmethodfortheexpectedsurvival.Usage rs.surv(formula,data,ratetable=survexp.us,fin.date,method=\"hakulinen\ Arguments formula aformulaobject,withtheresponseasaSurvobjectontheleftofa~operator,and,ifdesired,termsseparatedbythe+operatorontheright.Ifthevariablesarenotorganizedandnamedinthesamewayasinthepopulationtables,aratetabletermmustbeaddedtomatcheachsubjecttohis/herexpectedcohort.Thetimemustbeindays.Forasinglesurvivalcurvethe~1partoftheformulaisnotrequired. adata.frameinwhichtointerpretthevariablesnamedintheformula.atableofeventrates,organizedasaratetableobject,suchassurvexp.us.Thedateofthestudyending,usedforcalculatingthepotentialfollow-uptimesintheHakulinenmethod.Ifmissing,itiscalculatedasmax(year+time). Themethodforcalculatingtheexpectedsurvival.Theoptionsarehakulinen(default)andconditional,seesurvexpfordetails. otherargumentswillbepassedtothesurvfitfunctionthatcalculatestheobservedsurvival. dataratetablefin.datemethod... Details ThepotentialcensoringtimesneededforthecalculationoftheexpectedsurvivalbytheHakulinenmethodarecalculatedautomatically.Thetimesofcensoringareleftastheyare,thetimesofeventsarereplacedwithfin.date-year. 12Value rstrans asurvfitobject;seethehelponsurvfit.objectfordetails.Thesurvfitmethodsareusedforprint,plot,lines,andpoints.SeeAlso survfit,survexpExamples data(slopop)data(rdata) rs.surv(Surv(time,cens)~sex+ratetable(age=age*365,sex=sex, year=year),ratetable=slopop,data=rdata) rstransFitCoxProportionalHazardsModelinTransformedTime Description Thefunctiontransformseachperson’stimetohis/herprobabilityofdyingatthattimeaccordingtotheratetable.ItthenfitstheCoxproportionalhazardsmodelwiththetransformedtimesasaresponse.Apossiblesideeffectarethetransformedtimes.Usage rstrans(formula,data,ratetable,int,na.action,init,control,...)Arguments formula aformulaobject,withtheresponseontheleftofa~operator,andthetermsontheright.Thetermsconsistofpredictorvariablesseparatedbythe+operator,alongwitharatetableterm.Theratetabletermmatcheseachsubjecttohis/herexpectedcohort.Ifthevariablesareorganizedandnamedinthesamewayasinthepopulationtables,theratetabletermcanbeomitted.TheresponsemustbeasurvivalobjectasreturnedbytheSurvfunction.Thetimemustbeindays. adata.frameinwhichtointerpretthevariablesnamedintheformula.atableofeventrates,suchassurvexp.us. thenumberoffollow-upyearsusedforcalculatingsurvival(therestiscensored).Ifmissing,itissetthethemaximumobservedfollow-uptime. amissing-datafilterfunction,appliedtothemodel.frame,afteranysubsetargu-menthasbeenused.Defaultisoptions()$na.action. vectorofinitialvaluesoftheiteration.Defaultinitialvalueiszeroforallvari-ables. dataratetableintna.actioninit rsurvaux control...Value anobjectofclasscoxph.Seecoxph.objectandcoxph.detailfordetails.yReferences anobjectofclassSurvcontainingthetransformedtimes. 13 alistofparametersforcontrollingthefittingprocess.Seethedocumentationforcoxph.controlfordetails. otherargumentswillbepassedtocoxph.control. StareJ.,HendersonR.,PoharM.\"Anindividualmeasureforrelativesurvival.\"JournaloftheRoyalStatisticalSociety:SeriesC,54115-126,2005. PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006.SeeAlso rsmul,invtime,rsadd,survexp.Examples data(slopop)data(rdata) fit<-rstrans(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365, sex=sex,year=year),ratetable=slopop,data=rdata)#checkthegoodnessoffitrs.br(fit) rsurvauxAuxiliaryFunctionforrelsurv Description Thisfunctionisnotcalledbytheuser. 14rs.zph rs.zph BehaviourofCovariatesinTimeforRelativeSurvivalRegressionModels Description Calculatesthescaledpartialresidualsofarelativesurvivalmodel(rsadd,rsmulorrstrans)Usage rs.zph(fit,sc,transform=\"identity\Arguments fit theresultoffittinganadditiverelativesurvivalmodel,usingthersadd,rsmulorrstransfunction. Inthecaseofmultiplicativeandtransformationmodelstheoutputisidenticaltocox.zphfunction,exceptnotestisperformed. sc transform partialresidualscalculatedbytheresidfunction.Thisisusedtosavetimeifseveraltestsaretobecalculatedontheseresidualsandcanotherwisebeomitted.acharacterstringspecifyinghowthesurvivaltimesshouldbetransformed.Possiblevaluesare\"km\",\"rank\",\"identity\"andlog.Thedefaultis\"identity\". acharacterstringspecifyingthevarianceusedtoscaletheresiduals.Possiblevaluesare\"each\",whichestimatesthevarianceforeachresidualseparately,andsum(default),whichassumesthesamevarianceforalltheresiduals. var.type Value anobjectofclassrs.zph.Thisfunctionwouldusuallybefollowedbyaplotoftheresult.Theplotgivesanestimateofthetime-dependentcoefficientbeta(t).Iftheproportionalhazardsassumptionistrue,beta(t)willbeahorizontalline.References StareJ.,PoharM.,HendersonR.\"Goodnessoffitforrelativesurvivalmodels.\"StatisticsinMedicine243911-3925,2005.SeeAlso rsadd,rsmul,rstrans,resid,cox.zph. slopopExamples data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+ratetable(age=age*365,sex=sex, year=year),ratetable=slopop,data=rdata,int=5) rszph<-rs.zph(fit) 15 slopopCensusDataSetfortheSlovenePopulation Description CensusdatasetfortheSlovenepopulation.Usage data(slopop)Examples data(slopop) srvxp.fitWorkFunctiontoComputeExpectedSurvival Description Computeexpectedsurvivalforagroupofpeople.Thisfunctionisnottobecalledbytheuser.Usage srvxp.fit(x,y,ratetable)Arguments xy ratetableValue Avectorofsurvivaltimes. adata.frameoramatrix.Eachrowrepresentsoneperson.Thecolumnsmustmatchthedimensionsoftheratetable,inthecorrectorder.avectorofsurvivaltimesofthesamelengthasthenumberofrowsofx.atableofeventrates,organizedasaratetableobject,suchassurvexp.us. 16survfit.rsadd survfit.rsaddComputeaPredicitedSurvivalCurve Description Computesapredictedsurvivalcurvebasedontheadditivemodelestimatedbyrsaddfunction.Usage survfit.rsadd(object,newdata,se.fit=TRUE,conf.int=0.95,individual=FALSE, conf.type=c(\"log\\"log-log\\"plain\\"none\"))Arguments objectnewdata arsaddobject adataframewiththesamevariablenamesasthosethatappearinthersaddfor-mula.Thecurve(s)producedwillberepresentativeofacohortwho’scovariatescorrespondtothevaluesinnewdata. alogicalvalueindicatingwhetherstandarderrorsshouldbecomputed.DefaultisTRUE. thelevelforatwo-sidedconfidenceintervalonthesurvivalcurve(s).Defaultis0.95. alogicalvalueindicatingwhetherthedataframerepresentsdifferenttimeepochsforonlyoneindividual(T),orwhethermultiplerowsindicatemultipleindivid-uals(F,thedefault).Iftheformeronlyonecurvewillbeproduced;ifthelattertherewillbeonecurveperrowinnewdata. Oneofnone,plain,log(thedefault),orlog-log.Thefirstoptioncausesconfidenceintervalsnottobegenerated.Thesecondcausesthestandardinter-valscurve+-k*se(curve),wherekisdeterminedfromconf.int.Thelogoptioncalculatesintervalsbasedonthecumulativehazardorlog(survival).Thelastoptionbasesintervalsontheloghazardorlog(-log(survival)). se.fitconf.intindividual conf.type Details Whenpredictingthesurvivalcurve,theratetablevaluesforfutureyearswillbeequaltothoseofthelastgivenyear.Thesameratetableswillbeusedforfittingandpredicting.Topredictarelativesurvivalcurve,users.surv.rsadd.Value asurvfitobject;seethehelponsurvfit.objectfordetails.Thesurvfitmethodsareusedforprint,plot,lines,andpoints.SeeAlso survfit,survexp,rs.surv survsplitExamples data(slopop)data(rdata) fit<-rsadd(Surv(time,cens)~sex+ratetable(age=age*365,sex=sex, year=year),ratetable=slopop,data=rdata,method=\"EM\") survfit.rsadd(fit,newdata=data.frame(sex=1,age=60,year=17000)) 17 survsplitSplitaSurvivalDataSetatSpecifiedTimes Description Givenasurvivaldatasetandasetofspecifiedcuttimes,thefunctionsplitseachrecordintomultiplerecordsateachcuttime.Thenewdatasetisbeincountingprocessformat,withastarttime,stoptime,andeventstatusforeachrecord.MoregeneralthansurvSplitasitalsoworkswiththedataalreadyinthecountingprocessformat.Usage survsplit(data,cut,end,event,start,id=NULL,zero=0, episode=NULL,interval=NULL)Arguments datacutendeventstartidzeroepisodeintervalValue New,longer,dataframe.SeeAlso survSplit. dataframe. vectoroftimepointstocutat. characterstringwithnameofeventtimevariable.characterstringwithnameofcensoringindicator. characterstringwithnameofstartvariable(willbecreatedifitdoesnotexist).characterstringwithnameofnewidvariabletocreate(optional). Ifstartdoesn’talreadyexist,thisisthetimethattheoriginalrecordsstart.Maybeavectororsinglevalue. characterstringwithnameofnewepisodevariable(optional).thisargumentisusedbymax.likfunction 18transrate transrateReorganizeDataintoaRatetableObject Description Thefunctionassistsinreorganizingcertaintypesofdataintoaratetableobject.Usage transrate(men,women,yearlim,int.length=1)Arguments men amatrixcontainingtheyearly(conditional)probabilitiesofoneyearsurvivalformen.Rowsrepresentage(increasing1yearperline,startingwith0),thecolumnsrepresentcohortyears(thelimitsareinyearlim,theincreaseisinint.length. amatrixcontainingtheyearly(conditional)probabilitiesofoneyearsurvivalforwomen. thefirstandlastcohortyeargiveninthetables.thelengthofintervalsinwhichcohortyearsaregiven. womenyearlimint.lengthDetails Thisfunctiononlyappliesforratetablesthatareorganizedbyage,sexandyear.Value Anobjectofclassratetable.References PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006.SeeAlso ratetable.Examples men<-cbind(exp(-365*exp(-14.5+.08*(0:100))),exp(-365*exp(-14.7+.085*(0:100))))women<-cbind(exp(-365*exp(-15.5+.085*(0:100))),exp(-365*exp(-15.7+.09*(0:100))))table<-transrate(men,women,yearlim=c(1980,1990),int.length=10) transrate.hld19 transrate.hld ReorganizeDataobtainedfromHumanLife-TableDatabaseintoaRatetableObject Description Thefunctionassistsinreorganizingthe.txtfilesobtainedfromHumanLife-TableDatabase(http://www.lifetable.de->DatabyCountry)intoaratetableobject.Usage transrate.hld(file,cut.year,race)Arguments filecut.yearraceDetails ThisfunctionworkswithanytableorganisedintheformatprovidedbytheHumanLife-TableDatabase,butcurrentlyonlyworkswithTypeLT1(i.e.ageintervalsoflength1).Theagemustalwaysstartwithvalue0,butcanendatdifferentvalues(whenthathappens,thelastvalueiscarriedforward).Theratesbetweenthecutpointsaretakentobeconstant.Value Anobjectofclassratetable.References PoharM.,StareJ.\"RelativesurvivalanalysisinR.\"ComputerMethodsandProgramsinBiomedicine,81:272-278,2006.SeeAlso ratetable,transrate.hmd,joinrate,transrate. avectoroffilenameswhichthedataaretobereadfrom.Mustbein.texformatandinthesameformatasthefilesinHumanLife-TableDatabase. avectorofcutpointsforyears.Mustbespecifiedwhentheyearspansinthefilesarenotconsecutive. avectorofracenamesfortheinputfiles. 20Examples transrate.hmd ##Notrun: finpop<-transrate.hld(c(\"FIN_1981-85.txt\##End(Notrun)##Notrun: nzpop<-transrate.hld(c(\"NZL_1980-82_Non-maori.txt\ \"NZL_1980-82_Maori.txt\ cut.year=c(1980,1985),race=rep(c(\"nonmaori\ ##End(Notrun) transrate.hmd ReorganizeDataobtainedfromHumanMortalityDatabaseintoaRatetableObject Description Thefunctionassistsinreorganizingthe.txtfilesobtainedfromHumanMortalityDatabase(http://www.mortality.org)intoaratetableobject.Usage transrate.hmd(male,female)Arguments malefemaleDetails ThisfunctionworkswithtablesorganisedintheformatprovidedbytheHumanMortalityDatabase.Theperiodlifetables,organizedbydateofdeath,mustbedownloadedseparatelyformenandwomenforeachcountryandthetoplinedeleted.Thefunctiononlyworksfortablesthathaveyearlycutpointsforageaswellascalendaryear(1x1).Theonlytwocolumnsneededarecalendaryear(Year)andprobabilityofdeath(qx).Deathprobabilitiesmustbecalculateduptoage110(inyearlyintervals).Value Anobjectofclassratetable.SeeAlso ratetable,transrate.hld,joinrate,transrate. a.txtfile,containingthedataonmales.a.txtfile,containingthedataonfemales. transrate.hmdExamples ##Notrun: auspop<-transrate.hmd(\"mltper_1x1.txt\##End(Notrun) 21 Index ∗Topicdatasets rdata,4slopop,14∗Topicsurvival invtime,1joinrate,2plot.rs.zph,3 residuals.rsadd,5rs.br,8rs.surv,10rs.zph,13rsadd,6rsmul,9rstrans,11rsurvaux,13srvxp.fit,14 survfit.rsadd,15survsplit,16transrate,17 transrate.hld,18transrate.hmd,19cox.zph,14em(rsadd),6glmxp(rsadd),6invtime,1,12joinrate,2,19 kernerleftch(rsurvaux),13Kernmatch(rsurvaux),13lik.fit(rsadd),6maxlik(rsadd),6mlfit(rsurvaux),13plot.cox.zph,4 plot.rs.br(rs.br),8plot.rs.zph,3 print.rs.br(rs.br),8print.rsadd(rsadd),6 print.summary.rsadd(rsadd),6ratetable,3,18,19rdata,4resid,9,14 resid.com(residuals.rsadd),5residuals.rsadd,5 rformulate(rsurvaux),13rs.br,8 rs.surv,10,16rs.zph,4,13 rsadd,5,6,9,10,12,14rsfitterem(rsadd),6rsmul,7,9,12 rstrans,2,7,10,11rsurvaux,13 slopop,14srvxp.fit,14 summary.rsadd(rsadd),6survexp,12 survfit.rsadd,15survSplit,17survsplit,16 transrate,3,17,19 transrate.hld,3,18,19transrate.hmd,3,19,19 22 因篇幅问题不能全部显示,请点此查看更多更全内容