{"id":867,"date":"2023-07-28T11:53:32","date_gmt":"2023-07-28T11:53:32","guid":{"rendered":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/"},"modified":"2023-07-28T11:53:32","modified_gmt":"2023-07-28T11:53:32","slug":"wie-berechnet-man-vive-in-python","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/","title":{"rendered":"So berechnen sie vif in python"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/de\/multikollinearitatsregression\/\" target=\"_blank\" rel=\"noopener\">Multikollinearit\u00e4t<\/a> in der Regressionsanalyse tritt auf, wenn zwei oder mehr erkl\u00e4rende Variablen stark miteinander korrelieren, sodass sie im Regressionsmodell keine eindeutigen oder unabh\u00e4ngigen Informationen liefern.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wenn der Korrelationsgrad zwischen den Variablen hoch genug ist, kann dies zu Problemen bei der Anpassung und Interpretation des Regressionsmodells f\u00fchren.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Eine M\u00f6glichkeit, Multikollinearit\u00e4t zu erkennen, ist die Verwendung einer Metrik namens <strong>Variance Inflation Factor (VIF)<\/strong> , die die Korrelation und St\u00e4rke der Korrelation zwischen erkl\u00e4renden Variablen in einem <a href=\"https:\/\/statorials.org\/de\/lineare-regressionspython\/\" target=\"_blank\" rel=\"noopener\">Regressionsmodell<\/a> misst.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In diesem Tutorial wird erkl\u00e4rt, wie man VIF in Python berechnet.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel: VIF in Python berechnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">F\u00fcr dieses Beispiel verwenden wir einen Datensatz, der die Attribute von 10 Basketballspielern beschreibt:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">import<\/span> numpy <span style=\"color: #107d3f;\">as<\/span> np\n<span style=\"color: #107d3f;\">import<\/span> pandas <span style=\"color: #107d3f;\">as<\/span> pd\n\n<span style=\"color: #008080;\">#create dataset<\/span>\ndf = pd.DataFrame({'rating': [90, 85, 82, 88, 94, 90, 76, 75, 87, 86],\n                   'points': [25, 20, 14, 16, 27, 20, 12, 15, 14, 19],\n                   'assists': [5, 7, 7, 8, 5, 7, 6, 9, 9, 5],\n                   'rebounds': [11, 8, 10, 6, 6, 9, 6, 10, 10, 7]})\n\n<span style=\"color: #008080;\">#view dataset\n<\/span>df\n\n\trating points assists rebounds\n0 90 25 5 11\n1 85 20 7 8\n2 82 14 7 10\n3 88 16 8 6\n4 94 27 5 6\n5 90 20 7 9\n6 76 12 6 6\n7 75 15 9 10\n8 87 14 9 10\n9 86 19 5 7<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Angenommen, wir m\u00f6chten ein multiples lineares Regressionsmodell anpassen, indem wir die Bewertung als Antwortvariable und Punkte, Assists und Rebounds als erkl\u00e4rende Variablen verwenden.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Um den VIF f\u00fcr jede erkl\u00e4rende Variable im Modell zu berechnen, k\u00f6nnen wir die <a href=\"https:\/\/www.statsmodels.org\/stable\/generated\/statsmodels.stats.outliers_influence.variance_inflation_factor.html\" target=\"_blank\" rel=\"noopener\">Funktion variance_inflation_factor()<\/a> aus der statsmodels-Bibliothek verwenden:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">from<\/span> patsy <span style=\"color: #107d3f;\">import<\/span> damatrices\n<span style=\"color: #107d3f;\">from<\/span> statsmodels.stats.outliers_influence <span style=\"color: #107d3f;\">import<\/span> variance_inflation_factor\n\n<span style=\"color: #008080;\">#find design matrix for linear regression model using 'rating' as response variable<\/span> \ny, X = dmatrices('rating ~ points+assists+rebounds', data=df, return_type='dataframe')\n\n<span style=\"color: #008080;\">#calculate VIF for each explanatory variable<\/span>\nvivid = pd.DataFrame()\nvive['VIF'] = [variance_inflation_factor(X.values, i) for i in range(X.shape[1])]\nvivid['variable'] = X.columns\n\n<span style=\"color: #008080;\">#view VIF for each explanatory variable<\/span> \nlively\n\n\t       Variable VIF\n0 101.258171 Intercept\n1 1.763977 points\n2 1.959104 assists\n3 1.175030 rebounds<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen die VIF-Werte f\u00fcr jede der erkl\u00e4renden Variablen beobachten:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Punkte:<\/strong> 1,76<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Vorlagen:<\/strong> 1,96<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Rebounds:<\/strong> 1,18<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\"><em><strong>Hinweis:<\/strong> Ignorieren Sie das VIF f\u00fcr \u201eIntercept\u201c in der Vorlage, da dieser Wert nicht relevant ist.<\/em><\/span><\/p>\n<h2> <strong>So interpretieren Sie VIF-Werte<\/strong><\/h2>\n<p> <span style=\"color: #000000;\">Der VIF-Wert beginnt bei 1 und hat keine Obergrenze. Eine allgemeine Regel f\u00fcr die Interpretation von VIFs lautet:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">Ein Wert von 1 gibt an, dass keine Korrelation zwischen einer bestimmten erkl\u00e4renden Variablen und einer anderen erkl\u00e4renden Variablen im Modell besteht.<\/span><\/li>\n<li> <span style=\"color: #000000;\">Ein Wert zwischen 1 und 5 weist auf eine m\u00e4\u00dfige Korrelation zwischen einer bestimmten erkl\u00e4renden Variablen und anderen erkl\u00e4renden Variablen im Modell hin, ist jedoch oft nicht schwerwiegend genug, um besondere Aufmerksamkeit zu erfordern.<\/span><\/li>\n<li> <span style=\"color: #000000;\">Ein Wert gr\u00f6\u00dfer als 5 weist auf eine potenziell schwerwiegende Korrelation zwischen einer bestimmten erkl\u00e4renden Variablen und anderen erkl\u00e4renden Variablen im Modell hin. In diesem Fall sind die Koeffizientensch\u00e4tzungen und p-Werte in den Regressionsergebnissen wahrscheinlich unzuverl\u00e4ssig.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Da jeder der VIF-Werte der erkl\u00e4renden Variablen in unserem Regressionsmodell nahe bei 1 liegt, ist Multikollinearit\u00e4t in unserem Beispiel kein Problem.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multikollinearit\u00e4t in der Regressionsanalyse tritt auf, wenn zwei oder mehr erkl\u00e4rende Variablen stark miteinander korrelieren, sodass sie im Regressionsmodell keine eindeutigen oder unabh\u00e4ngigen Informationen liefern. Wenn der Korrelationsgrad zwischen den Variablen hoch genug ist, kann dies zu Problemen bei der Anpassung und Interpretation des Regressionsmodells f\u00fchren. Eine M\u00f6glichkeit, Multikollinearit\u00e4t zu erkennen, ist die Verwendung einer [&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 den VIF in Python \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.\" \/>\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\/wie-berechnet-man-vive-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So berechnen Sie den VIF in Python \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T11:53:32+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=\"2 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/\",\"url\":\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/\",\"name\":\"So berechnen Sie den VIF in Python \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-28T11:53:32+00:00\",\"dateModified\":\"2023-07-28T11:53:32+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So berechnen sie vif in python\"}]},{\"@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 den VIF in Python \u2013 Statorials","description":"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.","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\/wie-berechnet-man-vive-in-python\/","og_locale":"de_DE","og_type":"article","og_title":"So berechnen Sie den VIF in Python \u2013 Statorials","og_description":"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.","og_url":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/","og_site_name":"Statorials","article_published_time":"2023-07-28T11:53:32+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/","url":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/","name":"So berechnen Sie den VIF in Python \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-28T11:53:32+00:00","dateModified":"2023-07-28T11:53:32+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"Eine einfache Erkl\u00e4rung zur Berechnung des VIF (Variance Inflation Factor) in Python.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/wie-berechnet-man-vive-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So berechnen sie vif in python"}]},{"@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\/867"}],"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=867"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/867\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}