{"id":1255,"date":"2023-07-27T02:53:55","date_gmt":"2023-07-27T02:53:55","guid":{"rendered":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/"},"modified":"2023-07-27T02:53:55","modified_gmt":"2023-07-27T02:53:55","slug":"likelihood-ratio-test-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/","title":{"rendered":"So f\u00fchren sie einen likelihood-ratio-test in r durch"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Ein <strong>Likelihood-Ratio-Test<\/strong> vergleicht die Anpassungsg\u00fcte zweier verschachtelter Regressionsmodelle.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Ein <a href=\"https:\/\/statorials.org\/de\/verschachteltes-modell\/\" target=\"_blank\" rel=\"noopener\">verschachteltes Modell<\/a> ist einfach ein Modell, das eine Teilmenge von Pr\u00e4diktorvariablen im gesamten Regressionsmodell enth\u00e4lt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Angenommen, wir haben das folgende Regressionsmodell mit vier Pr\u00e4diktorvariablen:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Y = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> x <sub>1<\/sub> + \u03b2 <sub>2<\/sub> x <sub>2<\/sub> + \u03b2 <sub>3<\/sub> x <sub>3<\/sub> + \u03b2 <sub>4<\/sub> x <sub>4<\/sub> + \u03b5<\/span><\/p>\n<p> <span style=\"color: #000000;\">Ein Beispiel f\u00fcr ein verschachteltes Modell w\u00e4re das folgende Modell mit nur zwei der urspr\u00fcnglichen Pr\u00e4diktorvariablen:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Y = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> x <sub>1<\/sub> + \u03b2 <sub>2<\/sub> x <sub>2<\/sub> + \u03b5<\/span><\/p>\n<p> <span style=\"color: #000000;\">Um festzustellen, ob sich diese beiden Modelle erheblich unterscheiden, k\u00f6nnen wir einen Likelihood-Ratio-Test durchf\u00fchren, der die folgenden Null- und Alternativhypothesen verwendet:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>0<\/sub> :<\/strong> Das vollst\u00e4ndige Modell und das verschachtelte Modell passen gleich gut zu den Daten. Sie sollten also <strong>ein verschachteltes Modell verwenden<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>A<\/sub> :<\/strong> Das vollst\u00e4ndige Modell passt deutlich besser zu den Daten als das verschachtelte Modell. Sie m\u00fcssen also <strong>die vollst\u00e4ndige Vorlage verwenden<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wenn der p-Wert des Tests unter einem bestimmten Signifikanzniveau liegt (z. B. 0,05), k\u00f6nnen wir die Nullhypothese ablehnen und daraus schlie\u00dfen, dass das vollst\u00e4ndige Modell eine deutlich bessere Anpassung bietet.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Das folgende Beispiel zeigt, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel: Likelihood-Ratio-Test in R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die folgenden zwei Regressionsmodelle in R mithilfe von Daten aus dem integrierten <strong>mtcars-<\/strong> Datensatz angepasst werden:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Vollst\u00e4ndiges Modell:<\/strong> mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> verf\u00fcgbar + \u03b2 <sub>2<\/sub> Vergaser + \u03b2 <sub>3<\/sub> PS + \u03b2 <sub>4<\/sub> Zyl<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Modell:<\/strong> mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> verf\u00fcgbar + \u03b2 <sub>2<\/sub> Kohlenhydrate<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir werden die Funktion <strong>lrtest()<\/strong> des Pakets <strong>lmtest<\/strong> verwenden, um einen Likelihood-Ratio-Test f\u00fcr diese beiden Modelle durchzuf\u00fchren:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #993300;\">library<\/span> (lmtest)<\/span>\n\n#fit full model<\/span>\nmodel_full &lt;- lm(mpg ~ disp + carb + hp + cyl, data = mtcars)\n\n<span style=\"color: #008080;\">#fit reduced model\n<\/span>model_reduced &lt;- lm(mpg ~ disp + carb, data = mtcars)\n\n<span style=\"color: #008080;\">#perform likelihood ratio test for differences in models\n<\/span>lrtest(model_full, model_reduced)\n\nLikelihood ratio test\n\nModel 1: mpg ~ disp + carb + hp + cyl\nModel 2: mpg ~ available + carb\n  #Df LogLik Df Chisq Pr(&gt;Chisq)\n1 6 -77.558                     \n2 4 -78.603 -2 2.0902 0.3517<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Aus dem Ergebnis k\u00f6nnen wir ersehen, dass die Chi-Quadrat-Teststatistik <strong>2,0902<\/strong> und der entsprechende p-Wert <strong>0,3517<\/strong> betr\u00e4gt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Da dieser p-Wert nicht kleiner als 0,05 ist, k\u00f6nnen wir die Nullhypothese nicht ablehnen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dies bedeutet, dass das vollst\u00e4ndige Modell und das verschachtelte Modell gleich gut zu den Daten passen. Wir m\u00fcssen daher das verschachtelte Modell verwenden, da die zus\u00e4tzlichen Pr\u00e4diktorvariablen im vollst\u00e4ndigen Modell keine signifikante Verbesserung der Anpassung bewirken.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnten dann einen weiteren Likelihood-Ratio-Test durchf\u00fchren, um zu bestimmen, ob sich ein Modell mit einer einzelnen Pr\u00e4diktorvariablen signifikant von einem Modell mit beiden Pr\u00e4diktoren unterscheidet:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #993300;\">library<\/span> (lmtest)<\/span>\n\n#fit full model<\/span>\nmodel_full &lt;- lm(mpg ~ disp + carb, data = mtcars)\n\n<span style=\"color: #008080;\">#fit reduced model\n<\/span>model_reduced &lt;- lm(mpg ~ disp, data = mtcars)\n\n<span style=\"color: #008080;\">#perform likelihood ratio test for differences in models\n<\/span>lrtest(model_full, model_reduced)\n\nLikelihood ratio test\n\nModel 1: mpg ~ available + carb\nModel 2: mpg ~ available\n  #Df LogLik Df Chisq Pr(&gt;Chisq)   \n1 4 -78.603                        \n2 3 -82.105 -1 7.0034 0.008136 **\n---\nSignificant. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Aus dem Ergebnis k\u00f6nnen wir ersehen, dass der p-Wert des Likelihood-Ratio-Tests <strong>0,008136<\/strong> betr\u00e4gt. Da diese Zahl kleiner als 0,05 ist, w\u00fcrden wir die Nullhypothese ablehnen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir kommen daher zu dem Schluss, dass das Modell mit zwei Pr\u00e4diktoren eine deutliche Verbesserung der Anpassung gegen\u00fcber dem Modell mit einem Pr\u00e4diktor bietet.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Unser endg\u00fcltiges Modell w\u00e4re also:<\/span><\/p>\n<p> <span style=\"color: #000000;\">mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> verf\u00fcgbar + \u03b2 <sub>2<\/sub> Kohlenhydrate<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/de\/einfache-lineare-regression-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">So f\u00fchren Sie eine einfache lineare Regression in R durch<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/multiple-lineare-regression-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">So f\u00fchren Sie eine multiple lineare Regression in R durch<\/a><br \/><a href=\"https:\/\/statorials.org\/de\/bedeutungscodes-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Wie man Bedeutungscodes in R interpretiert<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ein Likelihood-Ratio-Test vergleicht die Anpassungsg\u00fcte zweier verschachtelter Regressionsmodelle. Ein verschachteltes Modell ist einfach ein Modell, das eine Teilmenge von Pr\u00e4diktorvariablen im gesamten Regressionsmodell enth\u00e4lt. Angenommen, wir haben das folgende Regressionsmodell mit vier Pr\u00e4diktorvariablen: Y = \u03b2 0 + \u03b2 1 x 1 + \u03b2 2 x 2 + \u03b2 3 x 3 + \u03b2 4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T02:53:55+00:00\" \/>\n<meta name=\"author\" content=\"Dr. Benjamin Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. Benjamin Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/\",\"url\":\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/\",\"name\":\"So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-27T02:53:55+00:00\",\"dateModified\":\"2023-07-27T02:53:55+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So f\u00fchren sie einen likelihood-ratio-test in r durch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/de\/#website\",\"url\":\"https:\/\/statorials.org\/de\/\",\"name\":\"Statorials\",\"description\":\"Ihr Leitfaden f\u00fcr statistische Kompetenz !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de-DE\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\",\"name\":\"Dr. Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. Benjamin Anderson\"},\"description\":\"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen\",\"sameAs\":[\"https:\/\/statorials.org\/de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch","description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/","og_locale":"de_DE","og_type":"article","og_title":"So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch","og_description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.","og_url":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-27T02:53:55+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"3 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/","url":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/","name":"So f\u00fchren Sie einen Likelihood-Ratio-Test in R - Statorials durch","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-27T02:53:55+00:00","dateModified":"2023-07-27T02:53:55+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie ein Likelihood-Ratio-Test in R durchgef\u00fchrt wird.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/likelihood-ratio-test-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So f\u00fchren sie einen likelihood-ratio-test in r durch"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/de\/#website","url":"https:\/\/statorials.org\/de\/","name":"Statorials","description":"Ihr Leitfaden f\u00fcr statistische Kompetenz !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de-DE"},{"@type":"Person","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0","name":"Dr. Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Dr. Benjamin Anderson"},"description":"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen","sameAs":["https:\/\/statorials.org\/de"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1255"}],"collection":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/comments?post=1255"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1255\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=1255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=1255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=1255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}