{"id":2947,"date":"2023-07-19T23:07:53","date_gmt":"2023-07-19T23:07:53","guid":{"rendered":"https:\/\/statorials.org\/de\/glm-r-carre\/"},"modified":"2023-07-19T23:07:53","modified_gmt":"2023-07-19T23:07:53","slug":"glm-r-carre","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/glm-r-carre\/","title":{"rendered":"So berechnen sie das r-quadrat f\u00fcr glm in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Wenn wir ein lineares Regressionsmodell anpassen, verwenden wir h\u00e4ufig <strong>das R-Quadrat,<\/strong> um zu bewerten, wie gut ein Modell zu den Daten passt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">R im Quadrat stellt den Anteil der Varianz in der <a href=\"https:\/\/statorials.org\/de\/variablen-erklarende-antworten\/\" target=\"_blank\" rel=\"noopener\">Antwortvariablen<\/a> dar, der durch die Pr\u00e4diktorvariablen in einem Regressionsmodell erkl\u00e4rt werden kann.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Diese Zahl reicht von 0 bis 1, wobei h\u00f6here Werte auf eine bessere Modellanpassung hinweisen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">F\u00fcr allgemeine lineare Modelle wie <a href=\"https:\/\/statorials.org\/de\/logistische-regression-1\/\" target=\"_blank\" rel=\"noopener\">logistische Regressionsmodelle<\/a> und <a href=\"https:\/\/statorials.org\/de\/fischregression\/\" target=\"_blank\" rel=\"noopener\">Poisson-Regressionsmodelle<\/a> gibt es jedoch keinen R-Quadrat-Wert.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Stattdessen k\u00f6nnen wir eine Metrik namens <strong>McFaddens R-Quadrat<\/strong> berechnen, die von 0 bis knapp 1 reicht, wobei h\u00f6here Werte eine bessere Modellanpassung anzeigen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir verwenden die folgende Formel, um das R-Quadrat von McFadden zu berechnen:<\/span><\/p>\n<p> <span style=\"color: #000000;\">McFaddens R-Quadrat = 1 \u2013 (Log-Likelihood- <sub>Modell<\/sub> \/ <sub>Null-<\/sub> Log-Likelihood)<\/span><\/p>\n<p> <span style=\"color: #000000;\">Gold:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Log-Likelihood- <sub>Modell<\/sub><\/strong> : Log-Likelihood-Wert des aktuell angepassten Modells<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong><sub>Null-<\/sub> Log-Likelihood<\/strong> : Log-Likelihood-Wert des Nullmodells (nur Modell mit Schnittpunkt)<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">In der Praxis zeigen Werte \u00fcber 0,40 an, dass ein Modell sehr gut zu den Daten passt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Das folgende Beispiel zeigt, wie das R-Quadrat von McFadden f\u00fcr ein logistisches Regressionsmodell in R berechnet wird.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel: Berechnung des R-Quadrats von McFadden in R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">F\u00fcr dieses Beispiel verwenden wir den <strong>Standarddatensatz<\/strong> aus dem ISLR-Paket. Mit dem folgenden Code k\u00f6nnen wir eine Zusammenfassung des Datensatzes laden und anzeigen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install and load ISLR package\n<span style=\"color: #000000;\">install. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">ISLR<\/span> ')<\/span>\n<span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (ISLR)<\/span>\n\n#define dataset<\/span>\ndata &lt;- ISLR::Default\n\n<span style=\"color: #008080;\">#view summary of dataset\n<\/span>summary(data)\n\n default student balance income     \n No:9667 No:7056 Min. : 0.0 Min. : 772  \n Yes: 333 Yes:2944 1st Qu.: 481.7 1st Qu.:21340  \n                       Median: 823.6 Median: 34553  \n                       Mean: 835.4 Mean: 33517  \n                       3rd Qu.:1166.3 3rd Qu.:43808  \n                       Max. :2654.3 Max. :73554  \n\n<span style=\"color: #008080;\">#find total observations in dataset<\/span>\nnrow(data)\n\n[1] 10000\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dieser Datensatz enth\u00e4lt die folgenden Informationen zu 10.000 Personen:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Standard:<\/strong> Gibt an, ob eine Person in Verzug geraten ist oder nicht.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Student:<\/strong> gibt an, ob eine Person Student ist oder nicht.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Guthaben:<\/strong> Durchschnittliches Guthaben einer Person.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Einkommen:<\/strong> Einkommen des Einzelnen.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Wir werden Studentenstatus, Bankguthaben und Einkommen verwenden, um ein logistisches Regressionsmodell zu erstellen, das die Wahrscheinlichkeit vorhersagt, dass eine bestimmte Person zahlungsunf\u00e4hig wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#fit logistic regression model<\/span>\nmodel &lt;- glm(default~student+balance+income, family=' <span style=\"color: #ff0000;\">binomial<\/span> ', data=data)\n\n<span style=\"color: #008080;\">#view model summary<\/span>\nsummary(model)\n\nCall:\nglm(formula = default ~ balance + student + income, family = \"binomial\", \n    data = data)\n\nDeviance Residuals: \n    Min 1Q Median 3Q Max  \n-2.4691 -0.1418 -0.0557 -0.0203 3.7383  \n\nCoefficients:\n              Estimate Std. Error z value Pr(&gt;|z|)    \n(Intercept) -1.087e+01 4.923e-01 -22.080 &lt; 2e-16 ***\nbalance 5.737e-03 2.319e-04 24.738 &lt; 2e-16 ***\nstudentYes -6.468e-01 2.363e-01 -2.738 0.00619 ** \nincome 3.033e-06 8.203e-06 0.370 0.71152    \n---\nSignificant. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\n(Dispersion parameter for binomial family taken to be 1)\n\n    Null deviance: 2920.6 on 9999 degrees of freedom\nResidual deviance: 1571.5 on 9996 degrees of freedom\nAIC: 1579.5\n\nNumber of Fisher Scoring iterations: 8\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Als N\u00e4chstes verwenden wir die folgende Formel, um den R-Quadrat-Wert von McFadden f\u00fcr dieses Modell zu berechnen:<\/span><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#calculate McFadden's R-squared for model<\/span>\nwith(summary(model), 1 - deviance\/null. <span style=\"color: #3366ff;\">deviance<\/span> )\n\n[1] 0.4619194\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Der R-Quadrat-Wert von McFadden betr\u00e4gt <strong>0,4619194<\/strong> . Dieser Wert ist ziemlich hoch, was darauf hindeutet, dass unser Modell gut zu den Daten passt und \u00fcber eine hohe Vorhersagekraft verf\u00fcgt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Beachten Sie auch, dass wir auch die Funktion <strong>pR2()<\/strong> aus dem <strong>pscl-<\/strong> Paket verwenden k\u00f6nnten, um den McFadden-R-Quadrat-Wert f\u00fcr das Modell zu berechnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install and load pscl package<\/span>\ninstall. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">pscl<\/span> ')\n<span style=\"color: #008000;\">library<\/span> (pscl)\n\n<span style=\"color: #008080;\">#calculate McFadden's R-squared for model<\/span>\npR2(model)[' <span style=\"color: #ff0000;\">McFadden<\/span> ']\n\n McFadden \n0.4619194\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Beachten Sie, dass dieser Wert dem zuvor berechneten entspricht.<\/span><\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Die folgenden Tutorials erkl\u00e4ren, wie Sie andere h\u00e4ufige Aufgaben in R ausf\u00fchren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/de\/r-zum-quadrat-von-r\/\" target=\"_blank\" rel=\"noopener\">So berechnen Sie das R-Quadrat in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/r-quadrate-in-r-passt\/\" target=\"_blank\" rel=\"noopener\">So berechnen Sie das angepasste R-Quadrat in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/guter-r-quadrat-wert\/\" target=\"_blank\" rel=\"noopener\">Was ist ein guter R-Quadrat-Wert?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wenn wir ein lineares Regressionsmodell anpassen, verwenden wir h\u00e4ufig das R-Quadrat, um zu bewerten, wie gut ein Modell zu den Daten passt. R im Quadrat stellt den Anteil der Varianz in der Antwortvariablen dar, der durch die Pr\u00e4diktorvariablen in einem Regressionsmodell erkl\u00e4rt werden kann. Diese Zahl reicht von 0 bis 1, wobei h\u00f6here Werte auf [&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 berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.\" \/>\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\/glm-r-carre\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/glm-r-carre\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-19T23:07:53+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\/glm-r-carre\/\",\"url\":\"https:\/\/statorials.org\/de\/glm-r-carre\/\",\"name\":\"So berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-19T23:07:53+00:00\",\"dateModified\":\"2023-07-19T23:07:53+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/glm-r-carre\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/glm-r-carre\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/glm-r-carre\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So berechnen sie das r-quadrat f\u00fcr glm in r\"}]},{\"@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 berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials","description":"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.","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\/glm-r-carre\/","og_locale":"de_DE","og_type":"article","og_title":"So berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials","og_description":"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.","og_url":"https:\/\/statorials.org\/de\/glm-r-carre\/","og_site_name":"Statorials","article_published_time":"2023-07-19T23:07:53+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\/glm-r-carre\/","url":"https:\/\/statorials.org\/de\/glm-r-carre\/","name":"So berechnen Sie das R-Quadrat f\u00fcr glm in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-19T23:07:53+00:00","dateModified":"2023-07-19T23:07:53+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird erl\u00e4utert, wie ein Pseudo-R-Quadrat-Wert f\u00fcr GLM-Modelle in R berechnet wird, einschlie\u00dflich eines vollst\u00e4ndigen Beispiels.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/glm-r-carre\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/glm-r-carre\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/glm-r-carre\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So berechnen sie das r-quadrat f\u00fcr glm in r"}]},{"@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\/2947"}],"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=2947"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/2947\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=2947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=2947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=2947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}