Beschreibende Analyse In Stata Forex


Die Ergebnisse Ihrer statistischen Analysen helfen Ihnen, das Ergebnis Ihrer Studie zu verstehen, z. B. Ob Variablen eine Wirkung haben, ob Variablen zusammenhängen, ob Unterschiede zwischen Gruppen von Beobachtungen gleich oder verschieden sind usw. Statistiken sind Werkzeuge der Wissenschaft, nicht ein Selbstzweck. Statistiken sollten verwendet werden, um Ihre Ergebnisse zu bestätigen und Ihnen helfen, objektiv zu sagen, wenn Sie erhebliche Ergebnisse haben. Daher, wenn die Berichterstattung über die statistischen Ergebnisse für Ihre Studie relevant, unterwerfen sie die tatsächlichen biologischen Ergebnisse. Reporting Beschreibung (Zusammenfassung) Statistics Means. Berichten Sie immer den Mittelwert (Mittelwert) zusammen mit einem Maß der Variabilität (Standardabweichung (s) oder Standardfehler des Mittelwerts). Zwei allgemeine Möglichkeiten, den Mittelwert und die Variabilität auszudrücken, sind nachstehend gezeigt: Die Gesamtlänge der Braunforelle (n128) betrug im Mai 1994 durchschnittlich 34,4 cm (s 12,4 cm), Proben von Sebago Lake. quot s Standardabweichung (dieses Format wird von Huth bevorzugt (1994) Die Gesamtlänge der Braunforelle (n128) betrug im Mai 1994 durchschnittlich 34,4 plusmn 12,4 cm, Proben von Sebago Lake. quot Dieser Stil erfordert in den Methoden spezifisch, was die Variabilität mit dem Mittel gemeldet wird Statistiken in graphischer Form dargestellt werden (eine Abbildung), können Sie einfach das Ergebnis im Text ohne Verbalisierung der Summenwerte angeben: Die Gesamtlänge der Bachforelle im Sebago See stieg zwischen Mai und September 1994 um 3,8 cm (Bild 5).quot Frequenzen: Die Frequenzdaten sollten im Text mit geeigneten Maßnahmen wie Prozente, Proportionen oder Verhältnissen zusammengefasst werden. "Während der Fallumschlagszeit konzentrierten sich in den tiefsten Teilen des Sees 47 geschätzte Braunforellen und 24 Bachforellen (Tabelle 3).quot Berichtsergebnisse von Inferential - (Hypothesis) - Tests In diesem Beispiel wird das Schlüsselergebnis blau und das statistische Ergebnis angezeigt. Die den Fund bestärkt, ist rot. Die Gesamtlänge der Bachforellen im Sebago-See stieg im Mai zwischen Mai (34,4 plus 12,4 cm, n128) und September (38,2 plusmn 11,7 cm, n 114) 1994 (zweimaliger t-Test, p lt 0,001) signifikant an : VERMEIDEN, ganze Sätze zu schreiben, die einfach sagen, welchen Test Sie verwendet haben, um ein Ergebnis zu analysieren, gefolgt von einem anderen Ergebnis. Dies verschwendet kostbare Worte (Wirtschaft.) Und unnötig erhöht Ihre Papiere Länge. Zusammenfassung der statistischen Testergebnisse in Zahlen Wenn die in einer Figur gezeigten Ergebnisse mit einem inferentiellen Test getestet wurden, ist es sinnvoll, das Ergebnis des Tests in der Grafik zusammenzufassen, damit Ihr Leser die Bedeutung der Befunde schnell erfassen kann. Es ist unerlässlich, dass Sie Informationen in Ihre Materialien und Methoden oder in der Abbildung Legende enthalten, um zu erklären, wie zu interpretieren, welches System der Codierung Sie verwenden. Mehrere gemeinsame Methoden für die Zusammenfassung der statistischen Ergebnisse sind unten gezeigt. Beispiele: Vergleich von Gruppen (t-Tests, ANOVA, etc.) Der Vergleich der Mittelwerte von 2 oder mehr Gruppen wird üblicherweise in einem Balkendiagramm der Mittel und zugeordneten Fehlerbalken dargestellt. Für zwei Gruppen. Kann der größere Mittelwert 1-4 Sternchen haben, die über dem Fehlerbalken zentriert sind, um den relativen Pegel des p-Wertes anzuzeigen. Im allgemeinen bedeutet das Bezugszeichen plt 0,05, das Quotentmittel plt 0,01, das Quotentmittel plt 0,001 und das Quotierungsmittel plt0,0001. In allen Fällen sollte der p-Wert auch in der Figurenlegende angegeben werden. Das Sternchen kann auch mit tabellarischen Ergebnissen wie unten gezeigt verwendet werden. Beachten Sie, wie der Autor eine Fußnote verwendet hat, um die p-Werte zu definieren, die der Anzahl der Sternchen entsprechen. (Mit freundlicher Genehmigung von Shelley Ball) Für drei oder mehr Gruppen gibt es zwei Systeme, die typischerweise verwendet werden: Linien oder Buchstaben. Das System, das Sie verwenden, hängt davon ab, wie kompliziert es ist, das Ergebnis zusammenzufassen. Das erste Beispiel unten zeigt einen Vergleich von drei Mitteln. Die Linie, die zwei benachbarte Stäbe überspannt, zeigt an, daß sie nicht signifikant verschieden sind (basierend auf einem Vergleichstest mit mehreren Vergleichen), und weil die Linie nicht den pH-Wert 2 einschließt, zeigt sie an, daß der pH-Wert 2 signifikant von dem pH-Wert 5,3 Kontrolle) und der pH 3,5-Gruppe bedeutet. Beachten Sie, dass Informationen zur Interpretation des Codierungssystems (Zeile oder Buchstaben) in der Bildlegende enthalten sind. Wenn Linien nicht leicht gezeichnet werden können, um das Ergebnis zusammenzufassen, ist die häufigste Alternative, Großbuchstaben zu verwenden, die über den Fehlerbalken platziert werden. Briefe, die gemeinsam oder zwischen den Gruppen geteilt werden, würden keinen signifikanten Unterschied anzeigen. Beispiel: Zusammenfassen von Korrelations - und Regressionsanalysen Für Beziehungsdaten (X, Y-Diagramme), bei denen eine Korrelations - oder Regressionsanalyse durchgeführt wurde, ist es üblich, die markanten Teststatistiken (zB r, r-Quadrat) und einen p - Der Körper des Graphen in relativ kleiner Schriftart, um unauffällig zu sein. Wenn eine Regression durchgeführt wird, sollte die am besten passende Linie aufgetragen werden, und die Gleichung der Linie, die auch in dem Körper des Graphen vorgesehen ist. Modified 1-11-2012 Abteilung für Biologie, Bates College. Lewiston, ME 04240Regressionsbeispiel, Teil 1: deskriptive Analyse Jede Regressionsanalyse (oder irgendeine Art von statistischer Analyse für diese Angelegenheit) sollte mit einem sorgfältigen Blick auf den Rohstoff beginnen: die Daten. Woher kam es, wie war es gemessen, ist es sauber oder schmutzig, wie viele Beobachtungen zur Verfügung stehen, was sind die Einheiten, was sind typische Größen und Bereiche der Werte, und sehr wichtig, wie die Variablen aussehen. Viel von Ihrem Gehirn ist der Verarbeitung von visuellen Informationen gewidmet, und das Versagen, diesen Teil des Gehirns zu engagieren, ist wie das Schießen in der Dunkelheit. Die visuelle Analyse hilft Ihnen, systematische Muster sowie ungewöhnliche Ereignisse und Datenfehler zu identifizieren. Das Ziel dieser Analyse ist zu erklären und vorherzusagen, wie die Menge der wöchentlichen Verkäufe einer beliebten Marke von Bier hängt von seinem Preis in einer kleinen Kette von Supermärkten. Die Datendatei enthält 52 Wochen durchschnittliche Preis - und Gesamtverkaufssätze für drei verschiedene Kartongrößen: 12-packs, 18-packs und 30-packs. (Dies sind reale Daten, abgesehen von einigen sehr kleinen Anpassungen für die 30-Packs.) Eines der ersten Dinge, die bei der Zusammenstellung eines Datensatzes für die Regressionsanalyse zu berücksichtigen sind, ist die Wahl der Einheiten (d. h. Skalierung) für die Variablen. Am Ende des Tages werden Sie auf Fehlermaßnahmen schauen, die in den Einheiten der abhängigen Variablen ausgedrückt werden, und die Modellkoeffizienten werden in Einheiten der vorhergesagten Änderung in der abhängigen Variablen pro Änderungseinheit in der unabhängigen Variablen gemessen. Idealerweise sollten diese Zahlen so skaliert werden, dass sie leicht lesbar und leicht zu interpretieren und zu vergleichen sind. In dieser Analyse wurden die Preis - und Verkaufsvariablen bereits in eine pro Fall (d. H. Pro-24-Dose) umgewandelt. So dass die relativen Verkaufsvolumina für verschiedene Kartongrößen direkt vergleichbar sind und dass Regressionskoeffizienten für Modelle, die an Daten für verschiedene Kartongrößen angepasst sind, direkt vergleichbar sind. Die ersten Zeilen des Datensatzes (in einer Excel-Datei) sehen so aus: Die Spaltenüberschriften wurden so gewählt, dass sie als beschreibende Variablennamen für die Analyse geeignet sind. Der Wert von 19,98 für PRICE12PK in Woche 1 bedeutet, dass 24 Dosen Bier 19,98 kauften, wenn sie in 12 Packungen dieser Woche gekauft wurden (dh der Preis für ein einzelnes 12-Pack lag bei 9,99) und der Wert von 223,5 für CASES12PK bedeutet, dass 447 12- Packs verkauft (weil ein Fall ist zwei 12-packs). Let8217s beginnen mit einem Blick auf die deskriptive Statistik, die typische Größenordnungen und die Bereiche der Variablen zeigen: Hier ist zu sehen, dass das Verkaufsvolumen (gemessen in vergleichbaren Einheiten von Fällen) größer war für die kleineren Kartongrößen (399 Fälle8217 im Wert von 12- Packs vs. 165 für 30 Packs mit 18 Packs in der Mitte), während der durchschnittliche Preis pro Fall für die größeren Kartongrößen (14,38 pro Fall im Durchschnitt für 30 Packs, vs. 19,09 pro Fall) signifikant geringer war Für 12-packs, mit 18-packs wieder in der Mitte). Jedoch gab es erhebliche Variation in den Preisen jeder Kartongröße, wie durch die minimalen und maximalen Werte gezeigt. Da es sich um Zeitreihenvariablen handelt, ist es sehr wichtig, auf ihre Zeitreihenplots zu schauen. Wie nachfolgend dargestellt. (Eigentlich sollten Sie die Plots Ihrer Variablen versus Zeilennummer betrachten, auch wenn es sich nicht um Zeitreihen handelt Sie wissen nie, was Sie sehen können. Bei Nicht-Zeitreihen-Daten möchten Sie keine Verbindungslinien zwischen den Punkten zeichnen. ) Was in diesen Parzellen deutlich hervorgehoben wird, ist, dass die Preise verschiedener Kartongrößen systematisch von Woche zu Woche über ein breites Spektrum manipuliert werden, und in Wochen, in denen es zu Preissenkungen kommt, gibt es Verkaufsspitzen. Zum Beispiel gab es tiefe Einschnitte in den Preis von 18-packs in den Wochen 13 und 14, und ein entsprechend großer Anstieg der Verkäufe in diesen zwei Wochen. In der Tat, wenn Sie alle Fälle-verkauften Grundstücke betrachten, können Sie sehen, dass Verkaufsvolumen für jede Kartongröße ziemlich niedrig ist, es sei denn, dass sein Preis in einer bestimmten Woche geschnitten wird. (High-Volume-Biertrinker sind sehr preissensibel.) Eine andere Sache, die herausragt, ist das Muster der Preismanipulation war nicht das gleiche für alle Kartongrößen. Wurden die Preise für 12-Packs nicht sehr oft manipuliert, während die Preise für 30 Packs im ersten Halbjahr fast wöchentlich bearbeitet wurden und die Preise für 18 Packs häufiger in der zweiten Hälfte manipuliert wurden des Jahres. So, an diesem Punkt haben wir eine ziemlich gute Vorstellung davon, was die qualitativen Muster sind in Wochenpreisen und Umsatz. Wenn unser Ziel darin besteht, die Preis-Nachfrage-Beziehungen durch die Anpassung von Regressionsmodellen zu messen, interessieren uns auch die Korrelationen zwischen den Variablen und das Aussehen ihrer Streudiagramme. Hier ist die Korrelationsmatrix, d. h. die Tabelle aller paarweisen Korrelationen unter den Variablen. (Denken Sie daran, dass die Korrelation zwischen zwei Variablen eine Statistik ist, die die relative Stärke der linearen Beziehung zwischen ihnen auf einer Skala von -1 bis 1 misst.) Was hier klar hervorgehoben wird, ist (wie wir bereits aus der Betrachtung der Zeit wussten Serie-Diagrammen) gibt es für alle drei Kartongrößen (größer als 0,8 in der Größenordnung, wie sich herausstellt) sehr starke negative Korrelationen zwischen Preisen und Verkäufen, wobei es sich um Maßnahmen der Preiselastizität der Nachfrage handelt.8221 Es gibt auch einige schwächere positive Korrelationen Zwischen dem Preis von einer Kartongröße und Verkäufen von anderen - zum Beispiel eine Korrelation von 0,521 zwischen Preis von 18-packs und Verkäufe von 30-packs. Dies sind Maße von 8220cross-Preiselastizitäten8221, d. h. Substitutionseffekte. Konsumenten neigen dazu, weniger 30-packs zu kaufen, wenn der Preis von 18-packs reduziert wird, vermutlich weil sie 18-packs kaufen. Last but not least sollten wir die Scatterplot-Matrix der Variablen, d. h. die Matrix aller 2-Wege-Scatterplots, betrachten. Die Scatterplot-Matrix ist das visuelle Gegenstück der Korrelationsmatrix, und es sollte immer als Präludium zur Regressionsanalyse betrachtet werden, wenn es viele Variablen gibt. (Nahezu alle kommerzielle Regressions-Software bietet diese Funktion, obwohl die Ergebnisse sehr unterschiedlich sind in der grafischen Qualität. Die von RegressIt, die hier gezeigt werden, sind optional die Regressionslinie, Massenpunkt, Korrelation und quadriert Korrelation, und jede einzelne Tabelle kann bearbeitet werden.) Die vollständige Scatterplot-Matrix für diese Variablen ist ein 6x6-Array, aber wir interessieren uns besonders für die 3x3-Submatrix von Scatterplots, in denen das Verkaufsvolumen gegen den Preis für verschiedene Kombinationen von Kartongrößen geplottet wird: Jede dieser Plots zeigt nicht nur die Preis-Nachfrage-Beziehung für den Verkauf von einem Karton Größe vs Preis von einem anderen, aber es gibt auch eine Vorschau der Ergebnisse, die erhalten werden, wenn ein einfaches Regressionsmodell ausgestattet ist. Auf den folgenden Seiten werden Regressionsmodelle für 18-Packs an die Verkaufsdaten angepasst. Aus dem Scatterplot in der Mitte der Matrix wissen wir bereits viel über die Ergebnisse, die wir erhalten werden, wenn wir 18-Packs Umsatz auf 18-Pack-Umsatz zurücknehmen. Einige 8220red flags8221 winken bereits an diesem Punkt zwar. Die Preis-Nachfrage-Beziehungen sind recht stark, aber die Varianz des Umsatzes ist nicht über die gesamte Bandbreite der Preise in einem dieser Plots konsistent. Übrigens wurde alle oben dargestellte Ausgabe zu einem Zeitpunkt auf einem einzigen Excel-Arbeitsblatt mit wenigen Tastenanschlägen unter Verwendung der Datenanalyse-Prozedur in RegressIt generiert, wie unten gezeigt. Hoffentlich wird Ihre Software machen dies relativ einfach zu. Willkommen an das Institut für digitale Forschung und Bildung SAS Seminar Einführung in die Überlebensanalyse in SAS 1. Einleitung Überlebensanalyse Modelle Faktoren, die die Zeit, um ein Ereignis zu beeinflussen. Regelmäßige kleinste Quadrate Regressionsmethoden fallen kurz, weil die Zeit bis zum Ereignis in der Regel nicht normal verteilt ist, und das Modell kann nicht behandeln Zensur, sehr häufig in Überlebensdaten, ohne Änderung. Nichtparametrische Verfahren bieten ein einfaches und schnelles Betrachten der Überlebenserfahrung, und das Cox-Proportional-Hazards-Regressionsmodell bleibt die dominante Analysemethode. Dieses Seminar führt Verfahren und skizziert die Kodierung in SAS benötigt, um die Überlebensdaten durch diese beiden Methoden zu modellieren, sowie viele Techniken, um das Modell zu bewerten und möglicherweise zu verbessern. Besonderes Augenmerk wird auf die progressionste nichtparametrische Schätzung und auf die Proc phreg für die Cox-Regression und die Modellauswertung gelegt. Anmerkung: Eine Anzahl von Unterabschnitten heißt Hintergrund. Diese bieten einen statistischen Hintergrund für die Überlebensanalyse für den interessierten Leser (und für den Verfasser des Seminars). Vorausgesetzt, der Leser hat einen Hintergrund in der Überlebensanalyse, sind diese Abschnitte nicht notwendig, um zu verstehen, wie zu laufen Überlebensanalyse in SAS. Diese können in Zukunft entfernt oder erweitert werden. Anmerkung: Die Begriffe Ereignis und Ausfall werden in diesem Seminar austauschbar verwendet, ebenso wie Zeit bis Ereignis und Ausfallzeit. 1.1 Beispieldatensatz In diesem Seminar analysieren wir die Daten von 500 Probanden der Worcester Heart Attack Study (nachfolgend WHAS500, verteilt mit Hosmer Lemeshow (2008)). Diese Studie untersuchte mehrere Faktoren, wie Alter, Geschlecht und BMI, die die Überlebenszeit nach Herzinfarkt beeinflussen können. Follow-up Zeit für alle Teilnehmer beginnt bei der Aufnahme von Krankenhaus nach Herzinfarkt und endet mit Tod oder Verlust der Follow-up (Zensur). Die Variablen in der vorliegenden Seminar verwendet werden: lenfol: Länge der Follow-up, entweder durch Tod oder Zensur beendet. Das Ergebnis in dieser Studie. Fstat: die Zensurvariable, Verlust zu followup0, death1 Alter: Alter bei Hospitalisierung bmi: Körpermassenindex hr: anfängliche Herzfrequenz Geschlecht: males0, Weibchen1 Die Daten im WHAS500 unterliegen nur der Rechtszensur. Das heißt, für manche Themen wissen wir nicht, wann sie nach Herzinfarkt starben, aber wir wissen zumindest, wie viele Tage sie überlebt haben. 1.2. Hintergrund: Wichtige Verteilungen in der Überlebensanalyse Das Verständnis der Mechanismen hinter der Überlebensanalyse wird durch eine Einrichtung mit den verwendeten Verteilungen unterstützt, die aus der Wahrscheinlichkeitsdichtefunktion und kumulativen Dichtefunktionen der Überlebenszeiten abgeleitet werden können. 1.2.1. Hintergrund: Die Wahrscheinlichkeitsdichtefunktion f (t) Nehmen wir an, wir haben eine Zufallsvariable, die Zeit, die die Überlebenszeiten aufzeichnet. Die Funktion, die die Wahrscheinlichkeit des Beobachtens der Zeit zum Zeitpunkt t relativ zu allen anderen Überlebenszeiten beschreibt, wird als die Wahrscheinlichkeitsdichtefunktion (pdf) oder f (t) bezeichnet. Die Integration der pdf über eine Reihe von Überlebenszeiten gibt die Wahrscheinlichkeit der Beobachtung einer Überlebenszeit in diesem Intervall. Wenn zum Beispiel die Überlebenszeiten als exponentiell verteilt bekannt sind, ist die Wahrscheinlichkeit, eine Überlebenszeit innerhalb des Intervalls a, b zu beobachten, Pr (ale Timele b) intabf (t) dtintablambda e dt, wobei lambda der Geschwindigkeitsparameter von ist Die exponentielle Verteilung und ist gleich dem Kehrwert der mittleren Überlebenszeit. Die meisten der Zeit wissen wir nicht a priori die Verteilung der Produktion unserer beobachteten Überlebenszeiten, aber wir können bekommen und Idee, wie es aussieht, mit nichtparametrischen Methoden in SAS mit proc univariate. Hier sehen wir die geschätzte pdf der Überlebenszeiten in der whas500 gesetzt, aus denen alle zensiert Beobachtungen entfernt wurden, um die Darstellung und Erklärung zu unterstützen. In der Grafik oben sehen wir die Korrespondenz zwischen pdfs und Histogrammen. Dichtefunktionen sind im wesentlichen Histogramme, die aus Bins von verschwindend kleinen Breiten bestehen. Nichtsdestoweniger sehen wir, dass in diesen Daten kürzere Überlebenszeiten wahrscheinlicher sind, was darauf hinweist, dass das Risiko eines Herzinfarktes anfangs stark ist und sich im Laufe der Zeit verjüngt. (Technisch, weil es keine Zeit weniger als 0 gibt, sollte es kein Diagramm links von LENFOL0 geben) 1.2.2. Hintergrund: Die kumulative Verteilungsfunktion F (T) Die kumulative Verteilungsfunktion (cdf), F (t) beschreibt die Wahrscheinlichkeit, dass die Zeit kleiner oder gleich einer Zeit t oder Pr (Timele t) ist. Oben beschrieben wurde, dass die Integration der pdf über einen Bereich liefert die Wahrscheinlichkeit der Beobachtung Zeit in diesem Bereich. So definieren wir die kumulative Verteilungsfunktion als: Als Beispiel können wir das cdf verwenden, um die Wahrscheinlichkeit für die Beobachtung einer Überlebenszeit von bis zu 100 Tagen zu bestimmen. Die obige Beziehung zwischen dem cdf und pdf auch impliziert: In SAS, können wir eine Schätzung der cdf mit proc univariate Graph. In der obigen Grafik sehen wir, dass die Wahrscheinlichkeit, dass 200 Tage oder weniger überleben, bei 50 liegt. So hat ein Patient nach 200 Tagen ein gewisses Risiko akkumuliert, das sich nach diesem Punkt langsamer ansammelt. In Intervallen, in denen die Ereigniszeiten wahrscheinlicher sind (hier die Anfangsintervalle), erhöht sich der cdf schneller. 1.2.3. Hintergrund: Die Überlebensfunktion S (t) Eine einfache Transformation der kumulativen Verteilungsfunktion erzeugt die Überlebensfunktion S (t): Die Überlebensfunktion S (t) beschreibt die Wahrscheinlichkeit einer Überlebenszeit t oder Pr (Zeit T). Wenn wir die Schätzung von S (t) darstellen würden, würden wir sehen, dass es eine Reflexion von F (t) (um y0 ist und um 1 verschoben ist). Hier verwenden wir proc lifetest zu Graphen S (t). Es scheint, dass die Wahrscheinlichkeit, über 1000 Tage hinaus zu bleiben, etwas weniger als 0,2 beträgt, was durch das obige cdf bestätigt wird, wo wir sehen, dass die Wahrscheinlichkeit eines Überlebens von 1000 Tagen oder weniger etwas mehr als 0,8 beträgt. 1.2.4. Hintergrund: Die Gefährdungsfunktion h (t) Der primäre Fokus der Überlebensanalyse ist typischerweise die Modellierung der Hazardrate, die folgende Beziehung zu f (t) und S (t) aufweist: Die Gefährdungsfunktion beschreibt dann den Relativen Wahrscheinlichkeit des Ereignisses, das zum Zeitpunkt t (f (t)) auftritt, abhängig vom Überleben der Versuchspersonen bis zu dieser Zeit t (S (t)). Die Hazardrate beschreibt also die momentane Ausfallrate zum Zeitpunkt t und ignoriert die Akkumulation von Gefahren bis zur Zeit t (im Gegensatz zu F (t) und S (t)). Wir können die Gefährdungsfunktion auch mit proc lifetest einschätzen: Wie wir bereits gesehen haben, scheint die Gefährdung am Beginn der Nachbeobachtungszeit am größten zu sein, dann nimmt sie rasch ab und endet schließlich. In der Tat ist die Hazard Rate am Anfang mehr als 4 mal größer als die Gefahr 200 Tage später. So würden wir zu Beginn der Studie etwa 0,008 Ausfälle pro Tag erwarten, während 200 Tage später für diejenigen, die überleben würden, 0,002 Ausfälle pro Tag erwarten würden. 1.2.5. Hintergrund: Die kumulative Gefährdungsfunktion Ebenfalls nützlich zu verstehen ist die kumulative Gefährdungsfunktion, die, wie der Name schon sagt, Gefahren im Laufe der Zeit kumuliert. Er wird berechnet, indem die Gefährdungsfunktion über ein Zeitintervall integriert wird: Betrachten wir wieder die Gefährdungsfunktion h (t) als die Rate, mit der Störungen zum Zeitpunkt t auftreten. Wir nehmen an, dass die Hazardrate bei frac (x Anzahl der Ausfälle pro Zeiteinheit t) über dem Intervall 0, t konstant bleibt. Summieren wir dann über das gesamte Intervall, so würden wir erwarten, x Fehler, wie frac t x, zu beobachten (unter der Annahme wiederholter Fehler sind möglich, so dass Fehlschläge nicht entfernen ein von der Beobachtung). Eine Interpretation der kumulativen Hazardfunktion ist somit die erwartete Anzahl von Ausfällen im Zeitintervall 0, t. Es ist überhaupt nicht notwendig, dass die Gefährdungsfunktion für die obige Interpretation der kumulativen Gefährdungsfunktion konstant bleibt, aber für illustrative Zwecke ist es einfacher, die erwartete Anzahl von Fehlern zu berechnen, da die Integration nicht erforderlich ist. Wenn man die obige Beziehung als frac H (t) h (t) ausdrückt, sehen wir, dass die Gefährdungsfunktion die Rate beschreibt, mit der Gefahren im Laufe der Zeit akkumuliert werden. Mit Hilfe der Gleichungen h (t) frac und f (t) - frac können wir die folgenden Beziehungen zwischen der kumulativen Hazardfunktion und den anderen Überlebensfunktionen ableiten: Aus diesen Gleichungen geht hervor, dass die kumulative Hazardfunktion H (t) und Haben die Überlebensfunktion S (t) eine einfache monotone Beziehung, so dass, wenn die Survival-Funktion zu Beginn der Analysezeit maximal ist, die kumulative Hazard-Funktion auf ihrem Minimum ist. Im Laufe der Zeit schreitet die Survival-Funktion auf sie zu, während die kumulative Hazard-Funktion auf ihr Maximum fortschreitet. Aus diesen Gleichungen geht hervor, dass wir erwarten, dass pdf, f (t) hoch ist, wenn h (t) die Hazardrate hoch ist (der Anfang in dieser Studie) und wenn die kumulative Hazard H (t) ist Niedrig (der Anfang, für alle Studien). Mit anderen Worten, würden wir erwarten, eine Menge von Ausfallzeiten in einem bestimmten Zeitintervall zu finden, wenn 1) die Hazard Rate hoch ist und 2) es gibt noch eine Menge von Themen in Gefahr. Wir können die kumulative Hazard-Funktion mit proc lestetest schätzen. Deren Ergebnisse wir an proc sgplot zum Plotten senden. Wir sehen einen schärferen Anstieg der kumulativen Hazard zu Beginn der Analyse Zeit, was die größere Hazard Rate in diesem Zeitraum. 2. Datenaufbereitung und Exploration 2.1. Struktur der Daten Dieses Seminar umfasst sowohl prozess - als auch prozessorientierte Seminare. Und Daten können in einer von 2 Möglichkeiten für die Überlebensanalyse strukturiert werden. Zuerst kann es eine Zeile von Daten pro Subjekt geben, wobei eine Ergebnisvariable die Zeit bis zum Ereignis repräsentiert, eine Variable, die kodiert, ob das Ereignis aufgetreten ist oder nicht (zensiert) und erläuternde Variablen mit jeweils festen Werten Zeit. Sowohl proc lifetest als auch proc phreg akzeptieren so strukturierte Daten. Die WHAS500-Daten sind so strukturiert. Wir sehen in der obigen Tabelle, dass das typische Subjekt in unserem Datensatz eher männlich, 70 Jahre alt, mit einem bmi von 26,6 und Herz ist Rate von 87. Die mittlere Zeit bis zum Ereignis (oder Verlust für Follow-up) beträgt 882,4 Tage, nicht eine besonders nützliche Menge. Alle diese Variablen variieren einiges in diesen Daten. Die meisten Variablen sind zumindest geringfügig mit den anderen Variablen korreliert. 3. Nichtparametrische (beschreibende) Überlebensanalyse mit proc lifetest 3.1. Der Kaplan-Meier-Schätzer der Überlebensfunktion 3.1.1 Hintergrund: Der Kaplan-Meier-Schätzer: Der KaplanMeier-Überlebensfunktion-Schätzer wird berechnet als: wobei ni die Anzahl der gefährdeten Personen ist und di die Anzahl der Versuchspersonen ist, Ti Somit ist jeder Begriff im Produkt die bedingte Wahrscheinlichkeit des Überlebens jenseits der Zeit ti, dh die Wahrscheinlichkeit des Überlebens über die Zeit ti hinaus, da das Subjekt bis zur Zeit ti überlebt hat. Die Überlebensfunktion-Schätzung der unbedingten Wahrscheinlichkeit des Überlebens über die Zeit t hinaus (die Wahrscheinlichkeit des Überlebens über die Zeit t von dem Einsetzen des Risikos hinaus) wird dann durch Multiplizieren dieser bedingten Wahrscheinlichkeiten bis zur Zeit t zusammen erhalten. Betrachtet man die Tabelle von Product-Limit Survival Estimates unten, für das erste Intervall, von 1 Tag bis kurz vor 2 Tagen, ni 500, di 8, so hat S (1) frac 0,984. Die Wahrscheinlichkeit des Überlebens des nächsten Intervalls von 2 Tagen bis kurz vor 3 Tagen, in denen weitere 8 Menschen starben, da das Subjekt 2 Tage überlebt hat (die bedingte Wahrscheinlichkeit), beträgt 0,98374. Die unbedingte Wahrscheinlichkeit des Überlebens über 2 Tage (vom Einsetzen des Risikos) ist dann Hut S (2) frac timesfrac 0,984 times 0,98374,9680 3.1.2. Erfassung und Interpretation von Tabellen von Kaplan-Meier-Schätzungen von proc lifetest Die Überlebensanalyse beginnt oft mit der Untersuchung der Gesamtüberlebenserfahrung durch nichtparametrische Methoden wie Kaplan-Meier (Produktgrenze) und Lebenstabellenschätzer der Überlebensfunktion. Nichtparametrische Verfahren sind ansprechend, da keine Annahme der Form der Überlebensfunktion oder der Gefährdungsfunktion erforderlich ist. Jedoch modellieren nichtparametrische Verfahren die Hazardrate nicht direkt, noch schätzen sie die Größe der Wirkungen von Kovariaten ab. Im folgenden Code zeigen wir, wie man eine Tabelle und einen Graphen des Kaplan-Meier-Schätzers der Überlebensfunktion aus proc lifetest erhält: Bei einem Minimum proc lifetest ist die Angabe einer Ausfallzeitvariable, hier Lenfol, erforderlich. Auf den Zeitnachweis. Ohne weitere Spezifikation geht SAS davon aus, dass alle gemeldeten Zeiten unzensiert sind, wahre Ausfälle. Da viele Beobachtungen in WHAS500 rechtszensiert sind, müssen wir auch eine Zensurvariable und den numerischen Code angeben, der eine zensierte Beobachtung identifiziert, die unten mit fstat (0) durchgeführt wird. Alle Zahlen innerhalb der Klammern werden als Indikatoren für die Zensur behandelt, was bedeutet, dass alle Zahlen, die von den Klammern ausgeschlossen sind, als Indikatoren für das Ereignis behandelt werden. Wir geben auch die Option atrisk auf die proc lifetest - Anweisung an, um die Anzahl an Risiko in unserer Stichprobe zu verschiedenen Zeitpunkten anzuzeigen. Product-Limit Survival Estimates Oben sehen wir die Tabelle der Kaplan-Meier-Schätzungen der Überlebensfunktion von proc lestetest produziert. Jede Zeile der Tabelle entspricht einem Zeitintervall, das zum Zeitpunkt der LENFOL-Spalte für diese Zeile beginnt und kurz vor der Zeit in der LENFOL-Spalte in der ersten nachfolgenden Zeile mit einem anderen LENFOL-Wert endet. Beispielsweise beträgt das Zeitintervall, das durch die erste Zeile dargestellt wird, von 0 Tagen bis kurz vor 1 Tag. In diesem Intervall sehen wir, dass wir 500 Menschen gefährdet haben und dass niemand gestorben ist, da Beobachtete Ereignisse gleich 0 sind und die Schätzung der Überlebensfunktion 1,0000 beträgt. Im nächsten Intervall von 1 Tag bis kurz vor 2 Tagen starben 8 Personen, die durch 8 Zeilen von LENFOL1.00 und von Observed Events8 in der letzten Zeile mit LENFOL1.00 angezeigt wurden. Es ist wichtig zu beachten, dass die in der Survival-Säule aufgeführten Überlebenswahrscheinlichkeiten unbedingt sind. Und sind als die Wahrscheinlichkeit des Überlebens vom Beginn der Nachbeobachtungszeit bis zu den Zahlentagen in der LENFOL-Spalte zu interpretieren. Werfen wir einen Blick auf die späteren Überlebenszeiten in der Tabelle: Produkt-Limit Survival Schätzungen Von LENFOL368 bis 376, sehen wir, dass es mehrere Datensätze, wo es scheint keine Ereignisse aufgetreten. Dies sind tatsächlich zensierte Beobachtungen, die weiter durch das Erscheinen in der unmarkierten zweiten Spalte angezeigt werden. Subjekte, die nach einem bestimmten Zeitpunkt zensiert werden, tragen zur Überlebensfunktion bei, bis sie aus der Studie herausfallen, aber nicht als Ausfall gezählt werden. Wir können dies sehen in der Überlebensfunktion Schätzung für LENFOL382. Während des Intervalls 382.385 starb 1 von 355 Todesopfern, was eine bedingte Überlebenswahrscheinlichkeit (die Wahrscheinlichkeit des Überlebens in dem gegebenen Intervall, da das Subjekt bis zum Beginn des Intervalls überlebt hat) in diesem Intervall von frac ergibt 0,9972. Wir sehen, dass die unkonditionelle Wahrscheinlichkeit, über 382 Tage hinaus zu bleiben, 7220 ist, da Hut S (382) 0,7220p (überlebende Tage) mal 0,9971831 für p (Überlebenstage) frac. In der obigen Tabelle sehen wir, dass die Wahrscheinlichkeit, die über 363 Tage 0.7240 hinausgeht, die gleiche Wahrscheinlichkeit wie die, die wir für das Überleben bis zu 382 Tagen berechnet haben, was bedeutet, dass die zensierten Beobachtungen die Überlebensschätzungen beim Verlassen der Studie nicht ändern Gefährdet. 3.1.3. Graphing der Kaplan-Meier-Schätzung Graphen der Kaplan-Meier-Schätzung der Überlebensfunktion erlauben uns zu sehen, wie sich die Überlebensfunktion im Laufe der Zeit ändert und glücklicherweise sehr einfach in SAS zu erzeugen ist: Proc lifetest zeigt die Kaplan-Meier-Schätzung Ohne die Plot-Option auf die proc lifetest Aussage, so könnten wir den gleichen Code von oben, dass die Tabelle der Kaplan-Meier Schätzungen erzeugt, um die Grafik zu erzeugen verwendet haben. Jedoch möchten wir Vertrauensbänder und die Zahl hinzufügen, die Gefahr für das Diagramm ist, also addieren wir plotssurvival (atrisk cb). Die Schrittfunktionsform der Überlebensfunktion ist aus dem Diagramm der Kaplan-Meier-Schätzung ersichtlich. Wenn ein Subjekt zu einem bestimmten Zeitpunkt stirbt, fällt die Schrittfunktion ab, während zwischen den Ausfallzeiten der Graph flach bleibt. Die Überlebensfunktion sinkt am stärksten zu Beginn der Studie, was darauf hindeutet, dass die Hazard Rate ist am höchsten sofort nach Krankenhausaufenthalt während der ersten 200 Tage. Zensierte Beobachtungen werden durch vertikale Zecken auf dem Diagramm dargestellt. Beachten Sie, dass die Überlebenswahrscheinlichkeit sich nicht ändert, wenn wir auf eine zensierte Beobachtung stoßen. Da die Beobachtung mit dem längsten Follow-up zensiert wird, wird die Überlebensfunktion nicht 0 erreichen. Stattdessen bleibt die Überlebensfunktion an der Überlebenswahrscheinlichkeit, die im vorherigen Intervall geschätzt wird. Die Überlebensfunktion ist an diesem letzten Intervall nach 2358 Tagen undefiniert. Der blau-schattierte Bereich um die Überlebenskurve repräsentiert die 95 Vertrauensbande, hier Hall-Wellner-Vertrauensbänder. Dieses Vertrauensband wird für die gesamte Überlebensfunktion berechnet und muss in jedem gegebenen Intervall breiter sein als das punktweise Konfidenzintervall (das Vertrauensintervall um ein einzelnes Intervall), um sicherzustellen, dass in diesem Band alle 95 punktweisen Konfidenzintervalle enthalten sind. Viele Umwandlungen der Survivor-Funktion stehen für alternative Methoden zur Berechnung von Konfidenzintervallen über die Option conftype zur Verfügung, obwohl die meisten Transformationen sehr ähnliche Konfidenzintervalle ergeben sollten. 3.2. Nelson-Aalen-Schätzer der kumulativen Hazard-Funktion Aufgrund der einfachen Beziehung zur Überlebensfunktion S (t) e kann die kumulative Hazardfunktion zur Abschätzung der Überlebensfunktion herangezogen werden. Der Nelson-Aalen-Schätzer ist ein nicht-parametrischer Schätzer der kumulativen Hazardfunktion und ist gegeben durch: wobei di die Zahl ist, die aus ni im Intervall ti gefährdet ist. Der Schätzer wird dann durch Summierung des Anteils der gefährdeten Personen berechnet, die in jedem Intervall bis zum Zeitpunkt t fehlgeschlagen sind. Der Nelson-Aalen-Schätzer wird in SAS durch die nelson-Option auf die proc-lifetest-Anweisung angefordert. SAS wird sowohl Kaplan Meier-Schätzungen der Überlebensfunktion als auch Nelson-Aalen-Schätzungen der kumulativen Hazard-Funktion in einer Tabelle ausgeben. Überlebensfunktion und kumulative Hazard Rate Bestätigen Sie unser Verständnis der Berechnung des Nelson-Aalen-Schätzers durch Berechnung der geschätzten kumulativen Hazard am Tag 3: Hut H (3) frac frac frac 0,0385, der dem Wert in der Tabelle entspricht. Die Interpretation dieser Schätzung ist, dass wir bis zum Ende von 3 Tagen 0,0385 Ausfälle (pro Person) erwarten. Die Schätzung des Überlebens über 3 Tage hinaus basierend auf dieser Nelson-Aalen-Schätzung der kumulativen Hazard wäre dann S (3) exp (-0,0385) 0,9623. This matches closely with the Kaplan Meier product-limit estimate of survival beyond 3 days of 0.9620. One can request that SAS estimate the survival function by exponentiating the negative of the Nelson-Aalen estimator, also known as the Breslow estimator, rather than by the Kaplan-Meier estimator through the methodbreslow option on the proc lifetest statement. In very large samples the Kaplan-Meier estimator and the transformed Nelson-Aalen (Breslow) estimator will converge. 3.3. Calculating median, mean, and other survival times of interest in proc lifetest Researchers are often interested in estimates of survival time at which 50 or 25 of the population have died or failed. Because of the positive skew often seen with followup-times, medians are often a better indicator of an average survival time. We obtain estimates of these quartiles as well as estimates of the mean survival time by default from proc lifetest. We see that beyond beyond 1,671 days, 50 of the population is expected to have failed. Notice that the interval during which the first 25 of the population is expected to fail, 0,297) is much shorter than the interval during which the second 25 of the population is expected to fail, 297,1671). This reinforces our suspicion that the hazard of failure is greater during the beginning of follow-up time. 95 Confidence Interval 3.4. Comparing survival functions using nonparametric tests Suppose that you suspect that the survival function is not the same among some of the groups in your study (some groups tend to fail more quickly than others). One can also use non-parametric methods to test for equality of the survival function among groups in the following manner: When provided with a grouping variable in a strata statement in proc lifetest. SAS will produce graphs of the survival function (unless other graphs are requested) stratified by the grouping variable as well as tests of equality of the survival function across strata. For example, we could enter the class (categorical) variable gender on the strata statement to request that SAS compare the survival experiences of males and females. Test of Equality over Strata In the graph of the Kaplan-Meier estimator stratified by gender below, it appears that females generally have a worse survival experience. This is reinforced by the three significant tests of equality. 3.4.1. Background: Tests of equality of the survival function In the output we find three Chi-square based tests of the equality of the survival function over strata, which support our suspicion that survival differs between genders. The calculation of the statistic for the nonparametric Log-Rank and Wilcoxon tests is given by. where d is the observed number of failures in stratum i at time tj, hat e is the expected number of failures in stratum i at time tj, hat v is the estimator of the variance of d , and wi is the weight of the difference at time tj (see Hosmer and Lemeshow(2008) for formulas for hat e and hat v ). In a nutshell, these statistics sum the weighted differences between the observed number of failures and the expected number of failures for each stratum at each timepoint, assuming the same survival function of each stratum. In other words, if all strata have the same survival function, then we expect the same proportion to die in each interval. If these proportions systematically differ among strata across time, then the Q statistic will be large and the null hypothesis of no difference among strata is more likely to be rejected. The log-rank and Wilcoxon tests in the output table differ in the weights wj used. The log-rank or Mantel-Haenzel test uses wj 1, so differences at all time intervals are weighted equally. The Wilcoxon test uses wj nj, so that differences are weighted by the number at risk at time tj, thus giving more weight to differences that occur earlier in followup time. Other nonparametric tests using other weighting schemes are available through the test option on the strata statement. The -2Log(LR) likelihood ratio test is a parametric test assuming exponentially distributed survival times and will not be further discussed in this nonparametric section. 3.5. Nonparametric estimation of the hazard function Standard nonparametric techniques do not typically estimate the hazard function directly. However, we can still get an idea of the hazard rate using a graph of the kernel-smoothed estimate. As the hazard function h(t) is the derivative of the cumulative hazard function H(t), we can roughly estimate the rate of change in H(t) by taking successive differences in hat H(t) between adjacent time points, Delta hat H(t) hat H(tj) - hat H(t ). SAS computes differences in the Nelson-Aalen estimate of H(t). We generally expect the hazard rate to change smoothly (if it changes) over time, rather than jump around haphazardly. To accomplish this smoothing, the hazard function estimate at any time interval is a weighted average of differences within a window of time that includes many differences, known as the bandwidth. Widening the bandwidth smooths the function by averaging more differences together. However, widening will also mask changes in the hazard function as local changes in the hazard function are drowned out by the larger number of values that are being averaged together. Below is an example of obtaining a kernel-smoothed estimate of the hazard function across BMI strata with a bandwidth of 200 days: We request plots of the hazard function with a bandwidth of 200 days with plothazard(bw200) SAS conveniently allows the creation of strata from a continuous variable, such as bmi, on the fly with the strata statement We specify the left endpoints of each bmi to form 5 bmi categories: 15-18.5, 18.5-25, 25-30, 30-40, and 40. The lines in the graph are labeled by the midpoint bmi in each group. From the plot we can see that the hazard function indeed appears higher at the beginning of follow-up time and then decreases until it levels off at around 500 days and stays low and mostly constant. The hazard function is also generally higher for the two lowest BMI categories. The sudden upticks at the end of follow-up time are not to be trusted, as they are likely due to the few number of subjects at risk at the end. The red curve representing the lowest BMI category is truncated on the right because the last person in that group died long before the end of followup time. 4. Background: The Cox proportional hazards regression model 4.1. Background: Estimating the hazard function, h(t) Whereas with non-parametric methods we are typically studying the survival function, with regression methods we examine the hazard function, h(t). The hazard function for a particular time interval gives the probability that the subject will fail in that interval, given that the subject has not failed up to that point in time. The hazard rate can also be interpreted as the rate at which failures occur at that point in time, or the rate at which risk is accumulated, an interpretation that coincides with the fact that the hazard rate is the derivative of the cumulative hazard function, H(t). In regression models for survival analysis, we attempt to estimate parameters which describe the relationship between our predictors and the hazard rate. We would like to allow parameters, the betas, to take on any value, while still preserving the non-negative nature of the hazard rate. A common way to address both issues is to parameterize the hazard function as: In this parameterization, h(tx) is constrained to be strictly positive, as the exponential function always evaluates to positive, while beta0 and beta1 are allowed to take on any value. Notice, however, that t does not appear in the formula for the hazard function, thus implying that in this parameterization, we do not model the hazard rates dependence on time. A complete description of the hazard rates relationship with time would require that the functional form of this relationship be parameterized somehow (for example, one could assume that the hazard rate has an exponential relationship with time). However, in many settings, we are much less interested in modeling the hazard rates relationship with time and are more interested in its dependence on other variables, such as experimental treatment or age. For such studies, a semi-parametric model, in which we estimate regression parameters as covariate effects but ignore (leave unspecified) the dependence on time, is appropriate. 4.2. Background: The Cox proportional hazards model We can remove the dependence of the hazard rate on time by expressing the hazard rate as a product of h0(t), a baseline hazard rate which describes the hazard rates dependence on time alone, and r(x, betax), which describes the hazard rates dependence on the other x covariates: In this parameterization, h(t) will equal h0(t) when r(x, betax) 1. It is intuitively appealing to let r(x, betax) 1 when all x 0, thus making the baseline hazard rate, h0(t), equivalent to a regression intercept. Above, we discussed that expressing the hazard rates dependence on its covariates as an exponential function conveniently allows the regression coefficients to take on any value while still constraining the hazard rate to be positive. The exponential function is also equal to 1 when its argument is equal to 0. We will thus let r(x, betax) exp(xbetax), and the hazard function will be given by: This parameterization forms the Cox proportional hazards model . It is called the proportional hazards model because the ratio of hazard rates between two groups with fixed covariates will stay constant over time in this model. For example, the hazard rate when time t when x x1 would then be h(tx1) h0(t)exp(x1betax), and at time t when x x2 would be h(tx2) h0(t)exp(x2betax). The covariate effect of x, then is the ratio between these two hazard rates, or a hazard ratio(HR): Notice that the baseline hazard rate, h0(t) is cancelled out, and that the hazard rate does not depend on time t: The hazard rate HR will thus stay constant over time with fixed covariates. Because of this parameterization, covariate effects are multiplicative rather than additive and are expressed as hazard ratios, rather than hazard differences. As we see above, one of the great advantages of the Cox model is that estimating predictor effects does not depend on making assumptions about the form of the baseline hazard function, h0(t), which can be left unspecified. Instead, we need only assume that whatever the baseline hazard function is, covariate effects multiplicatively shift the hazard function and these multiplicative shifts are constant over time. Cox models are typically fitted by maximum likelihood methods, which estimate the regression parameters that maximize the probability of observing the given set of survival times. So what is the probability of observing subject i fail at time tj At the beginning of a given time interval tj, say there are Rj subjects still at-risk, each with their own hazard rates: The probability of observing subject j fail out of all Rj remaing at-risk subjects, then, is the proportion of the sum total of hazard rates of all Rj subjects that is made up by subject js hazard rate. For example, if there were three subjects still at risk at time tj, the probability of observing subject 2 fail at time tj would be: All of those hazard rates are based on the same baseline hazard rate h0(ti), so we can simplify the above expression to: We can similarly calculate the joint probability of observing each of the n subjects failure times, or the likelihood of the failure times, as a function of the regression parameters, beta, given the subjects covariates values xj: where Rj is the set of subjects still at risk at time tj. Maximum likelihood methods attempt to find the beta values that maximize this likelihood, that is, the regression parameters that yield the maximum joint probability of observing the set of failure times with the associated set of covariate values. Because this likelihood ignores any assumptions made about the baseline hazard function, it is actually a partial likelihood, not a full likelihood, but the resulting beta have the same distributional properties as those derived from the full likelihood. 5. Cox proportional hazards regression in SAS using proc phreg 5.1. Fitting a simple Cox regression model We request Cox regression through proc phreg in SAS. Previously, we graphed the survival functions of males in females in the WHAS500 dataset and suspected that the survival experience after heart attack may be different between the two genders. Perhaps you also suspect that the hazard rate changes with age as well. Below we demonstrate a simple model in proc phreg. where we determine the effects of a categorical predictor, gender, and a continuous predictor, age on the hazard rate: To specify that gender is a categorical predictor, we enter it on the class statement. We also would like survival curves based on our model, so we add plotssurvival to the proc phreg statement, although as we shall see this specification is probably insufficient for what we want. On the model statement, on the left side of the equation, we provide the follow up time variable, lenfol, and the censoring variable, fstat, with all censoring values listed in parentheses. On the right side of the equation we list all the predictors. Model Fit Statistics The above output is only a portion of what SAS produces each time you run proc phreg. In particular we would like to highlight the following tables: Model Fit Statistics. Displays fit statistics which are typically used for model comparison and selection. This is our first model, so we have no other model to compare with, except that by default SAS will display model fit statistics of a model with no predictors. We see here that adding gender and particularly age (as we will see below) as predictors improves the fit of the model, as all three statistics decrease Testing Global Null Hypothesis: BETA0. Displays test of hypothesis that all coefficients in the model are 0, that is, an overall test of whether the model as a whole can predict changes in the hazard rate. These tests are asymptotically equivalent, but may differ in smaller samples, in which case the likelihood ratio test is generally preferred. Here the tests agree, and it appears that at least one of our regression coefficients is significantly different from 0. Analysis of Maximum Likelihood Estimates. Displays model coefficients, tests of significance, and exponentiated coefficient as hazard ratio. Here it appears that although females have a 6 (Hazard Ratio 0.937) decrease in the hazard rate compared to males, this decrease is not significant. On the other hand, with each year of age the hazard rate increases by 7 (Hazard Ratio 1.069), a significant change. Our initial supsicion that the hazard rates were different between genders seems to be wrong once we account for age effects (females are generally older in this dataset), but as shall see the effects are more nuanced. Also notice that there is no intercept. In Cox regression, the intercept is absorbed into the baseline hazard function, which is left unspecified. 5.2. Producing graphs of the survival and baseline hazard function after Cox regression Handily, proc phreg has pretty extensive graphing capabilities. plotssurvival to the proc phreg statement./p When only plotssurvival is specified on the proc phreg statement, SAS will produce one graph, a reference curve of the survival function at the reference level of all categorical predictors and at the mean of all continuous predictors. Reference Set of Covariates for Plotting In this model, this reference curve is for males at age 69.845947 Usually, we are interested in comparing survival functions between groups, so we will need to provide SAS with some additional instructions to get these graphs. 5.2.1. Use the baseline statement to generate survival plots by group Acquiring more than one curve, whether survival or hazard, after Cox regression in SAS requires use of the baseline statement in conjunction with the creation of a small dataset of covariate values at which to estimate our curves of interest. Here are the typical set of steps to obtain survival plots by group: First, a dataset of covariate values is created in a data step. Each row contains a set of covariate values for which we would like a survival plot. This dataset name is then specified on the covariates option on the baseline statement. Internally, SAS will expand the dataset to contain one observation at each event time per set of covariate values in the covariates dataset. This expanded dataset can be named and then viewed with the out option, but obtaining the out dataset is not at all necessary to generate the survival plots. Two options on the baseline statement control grouping in the graphs. If a variable is specified after group (not used until later in the seminar), SAS will create separate graphs for each level of that variable. If a variable is specified after the rowid option, SAS will create separate lines within the same plot for each level of this variable. The group and rowid options on the baseline statment work in tandem with the (overlaygroup) option specified immediately after the plots option on the proc phreg statement. If plots(overlaygroup) is specified, and there is a variable specified on the group option on the baseline statement, SAS will create separate graphs by level of that variable. If additionally a variable is specified on the rowid option on the baseline statement, SAS will plot separate lines by this variable in each plot. If no group option is used, we can still get separate lines by the rowid variable on one plot by specifying no type of overlaying like so: plots(overlay). Omitting the (overlay) completely will tell SAS to create separate graphs by rowid . Both survival and cumulative hazard curves are available using the plots option on the proc phreg statement, with the keywords survival and cumhaz. respectively. Lets get survival curves (cumulative hazard curves are also available) for males and female at the mean age of 69.845947 in the manner we just described. We use a data step to create a dataset called covs with 2 rows of covariates We then specify covs on covariates option on the baseline statement. There are 326 discrete event times in the WHAS500 dataset, so the baseline statement will then expand the covariates dataset so that we have 326 entries each for males and females at the mean age. We specify the name of the output dataset, base, that contains our covariate values at each event time on the out option We request survival plots that are overlaid with the plot(overlay)(survival) specification on the proc phreg statement. If we did not specify (overlay). SAS would produce separate graphs for males and females. We also add the rowid option on the baseline statement, which tells SAS to label the curves on our graph using the variable gender . The survival curves for females is slightly higher than the curve for males, suggesting that the survival experience is possibly slightly better (if significant) for females, after controlling for age. The estimated hazard ratio of .937 comparing females to males is not significant. 5.3. Expanding and interpreting the Cox regression model with interaction terms In our previous model we examined the effects of gender and age on the hazard rate of dying after being hospitalized for heart attack. At this stage we might be interested in expanding the model with more predictor effects. For example, we found that the gender effect seems to disappear after accounting for age, but we may suspect that the effect of age is different for each gender. We could test for different age effects with an interaction term between gender and age. Based on past research, we also hypothesize that BMI is predictive of the hazard rate, and that its effect may be non-linear. Finally, we strongly suspect that heart rate is predictive of survival, so we include this effect in the model as well. In the code below we fit a Cox regression model where we allow examine the effects of gender, age, bmi, and heart rate on the hazard rate. Here, we would like to introdue two types of interaction: The interaction of 2 different variables, such as gender and age, is specified through the syntax genderage. which requests inidividual effects of each term as well as their interaction. This allows the effect of age to differ by gender (and the effect of gender to differ by age). The interaction of a continuous variable, such as bmi, with itself is specified by bmibmi. to model both linear and quadratic effects of that variable. A quadratic effect implies that the effect of the variable changes with the level of the variable itself (i. e. an interaction of the variable with itself). Model Fit Statistics We would probably prefer this model to the simpler model with just gender and age as explanatory factors for a couple of reasons. First, each of the effects, including both interactions, are significant. Second, all three fit statistics, -2 LOG L . AIC and SBC . are each 20-30 points lower in the larger model, suggesting the including the extra parameters improve the fit of the model substantially. Lets interpret our model. We should begin by analyzing our interactions. The significant AGEGENDER interaction term suggests that the effect of age is different by gender. Recall that when we introduce interactions into our model, each individual term comprising that interaction (such as GENDER and AGE ) is no longer a main effect, but is instead the simple effect of that variable with the interacting variable held at 0. Thus, for example the AGE term describes the effect of age when gender0, or the age effect for males. It appears that for males the log hazard rate increases with each year of age by 0.07086, and this AGE effect is significant, p hazardratio statement and graphs to interpret effects, particularly interactions Notice in the Analysis of Maximum Likelihood Estimates table above that the Hazard Ratio entries for terms involved in interactions are left empty. SAS omits them to remind you that the hazard ratios corresponding to these effects depend on other variables in the model. Below, we show how to use the hazardratio statement to request that SAS estimate 3 hazard ratios at specific levels of our covariates. After the keyword hazardratio. we can optionally apply a label, then we specify the variable whose levels are to be compared in the hazard, and finally after the option keyword at we tell SAS at which level of our other covariates to evaluate this hazard ratio. If the variable whose hazard rates are to computed is not involved in an interaction, specification of additional covariates is unncessary since the hazard ratio is constant across levels of all other covariates (a main effect). We calculate the hazard ratio describing a one-unit increase in age, or frac , for both genders. Notice the ALL following gender. which is used only with class variables to request the hazard ratio at all levels of the class variable. We also calculate the hazard ratio between females and males, or frac at ages 0, 20, 40, 60, and 80. Finally, we calculate the hazard ratio describing a 5-unit increase in bmi, or frac , at clinically revelant BMI scores. Notice the additional option units5. BMI classes are typically separated by about 5 points, so we would like to see how the hazard ratio between (approximately) adjacent BMI classes changes as bmi increases. Effect of 1-unit change in age by gender: Hazard Ratios for AGE In each of the tables, we have the hazard ratio listed under Point Estimate and confidence intervals for the hazard ratio. Confidence intervals that do not include the value 1 imply that hazard ratio is significantly different from 1 (and that the log hazard rate change is significanlty different from 0). Thus, in the first table, we see that the hazard ratio for age, frac , is lower for females than for males, but both are significantly different from 1. Thus, both genders accumulate the risk for death with age, but females accumulate risk more slowly. In the second table, we see that the hazard ratio between genders, frac , decreases with age, significantly different from 1 at age 0 and age 20, but becoming non-signicant by 40. We previously saw that the gender effect was modest, and it appears that for ages 40 and up, which are the ages of patients in our dataset, the hazard rates do not differ by gender. Finally, we see that the hazard ratio describing a 5-unit increase in bmi. frac , increases with bmi. The effect of bmi is significantly lower than 1 at low bmi scores, indicating that higher bmi patients survive better when patients are very underweight, but that this advantage disappears and almost seems to reverse at higher bmi levels. Graphs are particularly useful for interpreting interactions. We can plot separate graphs for each combination of values of the covariates comprising the interactions. Below we plot survivor curves across several ages for each gender through the follwing steps: We again first create a covariates dataset, here called covs2. to tell SAS at which covariate values we would like to estimate the survivor function. Here we want curves for both males and females at ages 40, 60, and 80. All predictors in the model must be in the covariates dataset, so we set bmi and hr to their means. We then specify the name of this dataset in the covariates option on the baseline statement. We request separate lines for each age using rowid and separate graphs by gender using group on the baseline statement. We request that SAS create separate survival curves by the group option, with separate curves by rowid overlaid on the same graph with the syntax plots(overlaygroup)(survival). As we surmised earlier, the effect of age appears to be more severe in males than in females, reflected by the greater separation between curves in the top graaph. 5.5. Create time-varying covariates with programming statements Thus far in this seminar we have only dealt with covariates with values fixed across follow up time. With such data, each subject can be represented by one row of data, as each covariate only requires only value. However, often we are interested in modeling the effects of a covariate whose values may change during the course of follow up time. For example, patients in the WHAS500 dataset are in the hospital at the beginnig of follow-up time, which is defined by hospital admission after heart attack. Many, but not all, patients leave the hospital before dying, and the length of stay in the hospital is recorded in the variable los. We, as researchers, might be interested in exploring the effects of being hospitalized on the hazard rate. As we know, each subject in the WHAS500 dataset is represented by one row of data, so the dataset is not ready for modeling time-varying covariates. Our goal is to transform the data from its original state: Notice the creation of start and stop variables, which denote the beginning and end intervals defined by hospitalization and death (or censoring). Notice also that care must be used in altering the censoring variable to accommodate the multiple rows per subject. If the data come prepared with one row of data per subject each time a covariate changes value, then the researcher does not need to expand the data any further. However, if that is not the case, then it may be possible to use programming statement within proc phreg to create variables that reflect the changing the status of a covariate. Alternatively, the data can be expanded in a data step, but this can be tedious and prone to errors (although instructive, on the other hand). Fortunately, it is very simple to create a time-varying covariate using programming statements in proc phreg. These statement essentially look like data step statements, and function in the same way. In the code below, we model the effects of hospitalization on the hazard rate. To do so: We create the variable inhosp. which is 1 if the patient is currently in the hospital ( lenfol los ), and 0 when the patient leaves ( lenfol los ). We also add the newly created time-varying covariate to the model statement. Analysis of Maximum Likelihood Estimates GENDER Female AGE It appears that being in the hospital increases the hazard rate, but this is probably due to the fact that all patients were in the hospital immediately after heart attack, when they presumbly are most vulnerable. 6. Exploring functional form of covariates In the Cox proportional hazards model, additive changes in the covariates are assumed to have constant multiplicative effects on the hazard rate (expressed as the hazard ratio (HR)): In other words, each unit change in the covariate, no matter at what level of the covariate, is associated with the same percent change in the hazard rate, or a constant hazard ratio. For example, if betax is 0.5, each unit increase in x will cause a 65 increase in the hazard rate, whether X is increasing from 0 to 1 or from 99 to 100, as HR exp(0.5(1)) 1.6487. However, it is quite possible that the hazard rate and the covariates do not have such a loglinear relationship. Constant multiplicative changes in the hazard rate may instead be associated with constant multiplicative, rather than additive, changes in the covariate, and might follow this relationship: HR exp(betax(log(x2)-log(x1)) exp(betax(logfrac )) This relationship would imply that moving from 1 to 2 on the covariate would cause the same percent change in the hazard rate as moving from 50 to 100. It is not always possible to know a priori the correct functional form that describes the relationship between a covariate and the hazard rate. Plots of the covariate versus martingale residuals can help us get an idea of what the functional from might be. 6.1 Plotting cumulative martingale residuals against covariates to determine the functional form of covariates The background necessary to explain the mathematical definition of a martingale residual is beyond the scope of this seminar, but interested readers may consult (Therneau, 1990). For this seminar, it is enough to know that the martingale residual can be interpreted as a measure of excess observed events . or the difference between the observed number of events and the expected number of events under the model: Therneau and colleagues(1990) show that the smooth of a scatter plot of the martingale residuals from a null model (no covariates at all) versus each covariate individually will often approximate the correct functional form of a covariate. Previously we suspected that the effect of bmi on the log hazard rate may not be purely linear, so it would be wise to investigate further. In the code below we demonstrate the steps to take to explore the functional form of a covariate: Run a null Cox regression model by leaving the right side of equation empty on the model statement within proc phreg . Save the martingale residuals to an output dataset using the resmart option in the output statement within proc phreg. In the code below we save the residuals to a variable named martingale. Use proc loess to plot scatter plot smooths of the covariate (here bmi) vs the martingale residuals. The loess method selects portions of the data into local neighborhoods and fits a regression surface to each neighboorhood. This allows the regression surface to take a wide variety of shapes. The smoothed regression surfaces should approximate the functional form of the covariate. Within proc loess we specify the martingale residual dataset on the proc loess statement. We specify which variables to model on the model statement. The fraction of the data contained in each neighborhood is determined by the smoothing parameter, and thus larger smoothing parameter values produce smoother surfaces. Below we request 4 smooths using the smooth option. A desirable feature of loess smooth is that the residuals from the regression do not have any structure. We can examine residual plots for each smooth (with loess smooth themselves) by specifying the plotsResidualsBySmooth option on the proc loess statement. In the left panel above, Fits with Specified Smooths for martingale, we see our 4 scatter plot smooths. In all of the plots, the martingale residuals tend to be larger and more positive at low bmi values, and smaller and more negative at high bmi values. This indicates that omitting bmi from the model causes those with low bmi values to modeled with too low a hazard rate (as the number of observed events is in excess of the expected number of events). On the right panel, Residuals at Specified Smooths for martingale, are the smoothed residual plots, all of which appear to have no structure. The surface where the smoothing parameter0.2 appears to be overfit and jagged, and such a shape would be difficult to model. However, each of the other 3 at the higher smoothing parameter values have very similar shapes, which appears to be a linear effect of bmi that flattens as bmi increases. This indicates that our choice of modeling a linear and quadratic effect of bmi was a reasonable one. One caveat is that this method for determining functional form is less reliable when covariates are correlated. However, despite our knowledge that bmi is correlated with age, this method provides good insight into bmis functional form. 6.2. Using the assess statement to explore functional forms SAS provides built-in methods for evaluating the functional form of covariates through its assess statement. These techniques were developed by Lin, Wei and Zing (1993). The basic idea is that martingale residuals can be grouped cumulatively either by follow up time and/or by covariate value. If our Cox model is correctly specified, these cumulative martingale sums should randomly fluctuate around 0. Significant departures from random error would suggest model misspecification. We could thus evaluate model specification by comparing the observed distribution of cumulative sums of martingale residuals to the expected distribution of the residuals under the null hypothesis that the model is correctly specified. The null distribution of the cumulative martingale residuals can be simulated through zero-mean Gaussian processes. If the observed pattern differs significantly from the simulated patterns, we reject the null hypothesis that the model is correctly specified, and conclude that the model should be modified. In such cases, the correct form may be inferred from the plot of the observed pattern. This technique can detect many departures from the true model, such as incorrect functional forms of covariates (discussed in this section), violations of the proportional hazards assumption (discussed later), and using the wrong link function (not discussed). Below we demonstrate use of the assess statement to the functional form of the covariates. Several covariates can be evaluated simultaneously. We compare 2 models, one with just a linear effect of bmi and one with both a linear and quadratic effect of bmi (in addition to our other covariates). Using the assess statement to check functional form is very simple: List all covariates whose functional forms are to be checked within parentheses after var on the assess statement. Only continuous covariates may be assessed this way, not class variables. We also specify the resample option, which performs a supremum test of the null hypothesis that the observed pattern of martingale residuals is not different from the expected pattern (i. e. that the model is correctly specified). Essentially, the supremum tests calculates the proportion of 1000 simulations that contain a maximum cumulative martingale residual larger than the observed maximum cumulative residual. This proportion is reported as the p-value. If only a small proportion, say 0.05, of the simulations have a maximum cumulative residual larger than the observed maximum, then that suggests that the observed residuals are larger than expected under the proposed model and that the model should be modified. First lets look at the model with just a linear effect for bmi. In each of the graphs above, a covariate is plotted against cumulative martingale residuals. The solid lines represent the observed cumulative residuals, while dotted lines represent 20 simulated sets of residuals expected under the null hypothesis that the model is correctly specified. Unless the seed option is specified, these sets will be different each time proc phreg is run. A solid line that falls significantly outside the boundaries set up collectively by the dotted lines suggest that our model residuals do not conform to the expected residuals under our model. None of the graphs look particularly alarming (click here to see an alarming graph in the SAS example on assess ). Additionally, none of the supremum tests are significant, suggesting that our residuals are not larger than expected. Nevertheless, the bmi graph at the top right above does not look particularly random, as again we have large positive residuals at low bmi values and smaller negative residuals at higher bmi values. This suggests that perhaps the functional form of bmi should be modified. Now lets look at the model with just both linear and quadratic effects for bmi. Supremum Test for Functional Form Pr gt MaxAbsVal The graph for bmi at top right looks better behaved now with smaller residuals at the lower end of bmi. The other covariates, including the additional graph for the quadratic effect for bmi all look reasonable. Thus, we again feel justified in our choice of modeling a quadratic effect of bmi. 7. Assessing the proportional hazards assumption A central assumption of Cox regression is that covariate effects on the hazard rate, namely hazard ratios, are constant over time. For example, if males have twice the hazard rate of females 1 day after followup, the Cox model assumes that males have twice the hazard rate at 1000 days after follow up as well. Violations of the proportional hazard assumption may cause bias in the estimated coefficients as well as incorrect inference regarding significance of effects. 7.1. Graphing Kaplan-Meier survival function estimates to assess proportional hazards for categorical covariates In the case of categorical covariates, graphs of the Kaplan-Meier estimates of the survival function provide quick and easy checks of proportional hazards. If proportional hazards holds, the graphs of the survival function should look parallel, in the sense that they should have basically the same shape, should not cross, and should start close and then diverge slowly through follow up time. Earlier in the seminar we graphed the Kaplan-Meier survivor function estimates for males and females, and gender appears to adhere to the proportional hazards assumption. 7.2. Plotting scaled Schoenfeld residuals vs functions of time to assess proportional hazards of a continuous covariate A popular method for evaluating the proportional hazards assumption is to examine the Schoenfeld residuals. The Schoenfeld residual for observation j and covariate p is defined as the difference between covariate p for observation j and the weighted average of the covariate values for all subjects still at risk when observation j experiences the event. Grambsch and Therneau (1994) show that a scaled version of the Schoenfeld residual at time k for a particular covariate p will approximate the change in the regression coefficient at time k: E(sstar ) hat p approx betaj(tk) In the relation above, sstar is the scaled Schoenfeld residual for covariate p at time k, betap is the time-invariant coefficient, and betaj(tk) is the time-variant coefficient. In other words, the average of the Schoenfeld residuals for coefficient p at time k estimates the change in the coefficient at time k. Thus, if the average is 0 across time, then that suggests the coefficient p does not vary over time and that the proportional hazards assumption holds for covariate p. It is possible that the relationship with time is not linear, so we should check other functional forms of time, such as log(time) and rank(time). We will use scatterplot smooths to explore the scaled Schoenfeld residuals relationship with time, as we did to check functional forms before. Here are the steps we will take to evaluate the proportional hazards assumption for age through scaled Schoenfeld residuals: Scaled Schoenfeld residuals are obtained in the output dataset, so we will need to supply the name of an output dataset using the out option on the output statement as before. Below, we call this dataset schoen. SAS provides Schoenfeld residuals for each covariate, and they are output in the same order as the coefficients are listed in the Analysis of Maximum Likelihood Estimates table. Only as many residuals are output as names are supplied on the ressch option. For this demonstration, we are particularly interested in the Schoenfeld residuals for age. We should check for non-linear relationships with time, so we include a data step that calculates the log of lenfol. Other functions can be explored as well. We then use proc loess to obtain our smooths. Flat lines at 0 suggest that the coefficient does not vary over time and that proportional hazards holds. Although possibly slightly positively trending, the smooths appear mostly flat at 0, suggesting that the coefficient for age does not change over time and that proportional hazards holds for this covariate. The same procedure could be repeated to check all covariates. 7.3. Using assess with the ph option to check proportional hazards The procedure Lin, Wei, and Zing(1990) developed that we previously introduced to explore covariate functional forms can also detect violations of proportional hazards by using a transform of the martingale residuals known as the empirical score process. Once again, the empirical score process under the null hypothesis of no model misspecification can be approximated by zero mean Gaussian processes, and the observed score process can be compared to the simulated processes to asses departure from proportional hazards. The assess statement with the ph option provides an easy method to assess the proportional hazards assumption both graphically and numerically for many covariates at once. Here we demonstrate how to assess the proportional hazards assumption for all of our covariates (graph for gender not shown): As before with checking functional forms, we list all the variables for which we would like to assess the proportional hazards assumption after the var option on the assess statement. We additionally add the option ph to tell SAS that we would like to assess proportional hazards in addition to checking functional forms. As before, we specify the resample option to request the supremum tests of the null hypothesis that proportional hazards holds. These tests calculate the proportion of simulated score processes that yielded a maximum score larger than the maximum observed score process. A very small proportion (p-value) suggests violation of proportional hazards. Supremum Test for Proportionals Hazards Assumption As we did with functional form checking, we inspect each graph for observed score processes, the solid blue lines, that appear quite different from the 20 simulated score processes, the dotted lines. None of the solid blue lines looks particularly aberrant, and all of the supremum tests are non-significant, so we conclude that proportional hazards holds for all of our covariates. 7.4. Dealing with nonproportionality If nonproportional hazards are detected, the researcher has many options with how to address the violation (Therneau Grambsch, 2000): Ignore the nonproportionality if it appears the changes in the coefficient over time are very small or if it appears the outliers are driving the changes in the coefficient. In large datasets, very small departures from proportional hazards can be detected. If, say, a regression coefficient changes only by 1 over time, it is unlikely that any overarching conclusions of the study would be affected. Additionally, a few heavily influential points may be causing nonproportional hazards to be detected, so it is important to use graphical methods to ensure this is not the case. Stratify the model by the nonproportional covariate. Stratification allows each stratum to have its own baseline hazard, which solves the problem of nonproportionality. However, one cannot test whether the stratifying variable itself affects the hazard rate significantly. Additionally, although stratifying by a categorical covariate works naturally, it is often difficult to know how to best discretize a continuous covariate. This can be easily accomplished in proc phreh with the strata statement. Run Cox models on intervals of follow up time rather than on its entirety. Proportional hazards may hold for shorter intervals of time within the entirety of follow up time. Some data management will be required to ensure that everyone is properly censored in each interval. Include covariate interactions with time as predictors in the Cox model. This can be accomplished through programming statements in proc phreg. as these interactions are time-varying covariates themselves. Indeed, including such an interaction has been used as a test of proportional hazards -- a significant interaction indicates violation of the assumption. Below, we provide code that shows how to include a covariate interaction with time in the model. We create the interaction variable hrtime by multiplying hr by lenfol. The interaction variable is of course included on the model statement as well. The output indicates that this interaction is non-significant, which is not surprising given that hr has not shown evidence of nonproportionality. Analysis of Maximum Likelihood Estimates 8. Influence Diagnostics 8.1. Inspecting dfbetas to assess influence of observations on individual regression coefficients After fitting a model it is good practice to assess the influence of observations in your data, to check if any outlier has a disproportionately large impact on the model. Once outliers are identified, we then decide whether to keep the observation or throw it out, because perhaps the data may have been entered in error or the observation is not particularly representative of the population of interest. The dfbeta measure quantifies how much an observation influences the regression coefficients in the model. For observation j, dfbetaj approximates the change in a coefficient when that observation is deleted. We thus calculate the coefficient with the observation, call it beta, and then the coefficient when observation j is deleted, call it betaj, and take the difference to obtain dfbetaj. Positive values of dfbetaj indicate that the exclusion of the observation causes the coefficient to decrease, which implies that inclusion of the observation causes the coefficient to increase. Thus, it might be easier to think of dfbetaj as the effect of including observation j on the the coefficient. SAS provides easy ways to examine the dfbeta values for all observations across all coefficients in the model. Plots of covariates vs dfbetas can help to identify influential outliers. Here are the steps we use to assess the influence of each observation on our regression coefficients: We obtain dfbeta values through in output datasets in SAS, so we will need to specify an output statement within proc phreg. On the output statement, we supply the name of the output dataset dfbeta on the out option. There are dfbeta values associated with each coefficient in the model, and they are output to the output dataset in the order that they appear in the parameter table Analysis of Maximum Likelihood Estimates (see above). The order of dfbetas in the current model are: gender, age, genderage, bmi, bmibmi, hr. SAS expects individual names for each dfbeta associated with a coefficient. If only k names are supplied and k is less than the number of distinct dfbetas, SAS will only output the first k dfbetas. Thus, to pull out all 6 dfbetas, we must supply 6 variable names for these dfbetas. We then plot each dfbeta against the associated coviarate using proc sgplot. Our aim is identifying which observations are influential, so we replace the marker symbol with the id number of the observation by specifying the variable id on the markerchar option. The dfbetas for age and hr look small compared to regression coefficients themselves (hat 0.07086 and hat 0.01277) for the most part, but id89 has a rather large, negative dfbeta for hr. We also identify id89 again and id112 as influential on the linear bmi coefficient (hat -0.23323), and their large positive dfbetas suggest they are pulling up the coefficient for bmi when they are included. Once you have identified the outliers, it is good practice to check that their data were not incorrectly entered. These two observations, id89 and id112, have very low but not unreasonable bmi scores, 15.9 and 14.8. However they lived much longer than expected when considering their bmi scores and age (95 and 87), which attenuates the effects of very low bmi. Thus, we can expect the coefficient for bmi to be more severe or more negative if we exclude these observations from the model. Indeed, exclusion of these two outliers causes an almost doubling of hat , from -0.23323 to -0.39619. Still, although their effects are strong, we believe the data for these outliers are not in error and the significance of all effects are unaffected if we exclude them, so we include them in the model. 8.2. Plotting likelihood displacement scores to assess influence on the overall model Not only are we interested in how influential observations affect coefficients, we are interested in how they affect the model as a whole. The likelihood displacement score quantifies how much the likelihood of the model, which is affected by all coefficients, changes when the observation is left out. This analysis proceeds in much the same was as dfbeta analysis, in that we will: Output the likelihood displacement scores to an output dataset, which we name on the out option on the output statement in proc phreg. Below, we name the output dataset ld. Name the variable to store the likelihood displacement score on the ld option on the output statement Graph the likelihood displacement scores vs follow up time using proc sgplot. We replace the marker symbols with the id number using the markerchar option again. We see the same 2 outliers we identifed before, id89 and id112, as having the largest influence on the model overall, probably primarily through their effects on the bmi coefficient. However, we have decided that there covariate scores are reasonable so we retain them in the model. References Therneau, TM, Grambsch, PM. (2000). Modeling Survival Data: Extending the Cox Model. Springer: New York. Note: This was the primary reference used for this seminar. It contains numerous examples in SAS and R. Grambsch, PM, Therneau, TM. (1994). Proportional hazards tests and diagnostics based on weighted residuals. Biometrika . 81. 515-526. Grambsch, PM, Therneau, TM, Fleming TR. (1995). Diagnostic plots to reveal functional form for covariates in multiplicative intensity models. Biometrics . 51. 1469-82. Hosmer, DW, Lemeshow, S, May S. (2008). Applied Survival Analysis. Wiley: Hoboken. Lin, DY, Wei, LJ, Ying, Z. (1993). Checking the Cox model with cumulative sums of martingale-based residuals. Biometrika . 80(30). 557-72. Therneau, TM, Grambsch PM, Fleming TR (1990). Martingale-based residuals for survival models. Biometrika . 77(1). 147-60. The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.

Comments

Popular posts from this blog

22 Gruppe Forex Indonesien

Forex Overbought Oversold Strategy Board

Day Handel Oszillatoren Forex