{"id":2330,"date":"2023-07-22T18:09:17","date_gmt":"2023-07-22T18:09:17","guid":{"rendered":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/"},"modified":"2023-07-22T18:09:17","modified_gmt":"2023-07-22T18:09:17","slug":"r-aliased-coefficienten-in-het-model","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/","title":{"rendered":"Hoe op te lossen in r: er zijn aliasco\u00ebffici\u00ebnten in het model"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Een fout die je tegen kunt komen in R is:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>Error in vive.default(model): there are aliased coefficients in the model\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Deze fout treedt doorgaans op als er <a href=\"https:\/\/statorials.org\/nl\/multicollineariteitsregressie\/\" target=\"_blank\" rel=\"noopener\">multicollineariteit<\/a> bestaat in een regressiemodel. Dat wil zeggen dat twee of meer voorspellende variabelen in het model sterk (of perfect) gecorreleerd zijn.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wanneer dit gebeurt, zeggen we dat een variabele een &#8222;alias&#8220; is van een andere variabele, wat problemen veroorzaakt bij het aanpassen van een regressiemodel.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Het volgende voorbeeld laat zien hoe u deze fout in de praktijk kunt corrigeren.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Hoe de fout te reproduceren<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Stel dat we het volgende <a href=\"https:\/\/statorials.org\/nl\/meervoudige-lineaire-regressie-r\/\" target=\"_blank\" rel=\"noopener\">regressiemodel<\/a> in R toepassen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#make this example reproducible\n<\/span>set. <span style=\"color: #3366ff;\">seeds<\/span> (0)\n\n<span style=\"color: #008080;\">#define data\n<\/span>x1 &lt;- rnorm(100)\nx2 &lt;- rnorm(100)\nx3 &lt;- x2*3\ny &lt;- rnorm(100)\n\n<span style=\"color: #008080;\">#fit regression model\n<\/span>model &lt;- lm(y~x1+x2+x3)\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">We kunnen de <strong>vive()<\/strong> -functie van het <strong>autopakket<\/strong> gebruiken om de VIF-waarden voor elke voorspellende variabele in het model te berekenen om te bepalen of multicollineariteit een probleem is:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #000000;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (car)\n<\/span><\/span>\n<span style=\"color: #008080;\">#calculate VIF values for predictor variables<\/span><span style=\"color: #000000;\">\nlively(model)\n\n<\/span>Error in vive.default(model): there are aliased coefficients in the model\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">We ontvangen een foutmelding waarin staat dat <strong>er aliasco\u00ebffici\u00ebnten in het model voorkomen.<\/strong> \u201c<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dit vertelt ons dat twee of meer voorspellende variabelen in het model perfect gecorreleerd zijn.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Hoe u de fout kunt oplossen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Om te bepalen welke voorspellende variabelen perfect gecorreleerd zijn, kunnen we de functie <strong>cor()<\/strong> gebruiken om een <a href=\"https:\/\/statorials.org\/nl\/hoe-een-correlatiematrix-te-lezen\/\" target=\"_blank\" rel=\"noopener\">correlatiematrix<\/a> voor de variabelen te maken:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#place variables in data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x1, x2, x3, y)\n\n<span style=\"color: #008080;\">#create correlation matrix for data frame\n<\/span>cor(df)\n\n           x1 x2 x3 y\nx1 1.00000000 0.126886263 0.126886263 0.065047543\nx2 0.12688626 1.000000000 1.000000000 -0.009107573\nx3 0.12688626 1.000000000 1.000000000 -0.009107573\ny 0.06504754 -0.009107573 -0.009107573 1.000000000\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">We kunnen zien dat de variabelen <strong>x2<\/strong> en <strong>x3<\/strong> een<a href=\"https:\/\/statorials.org\/nl\/pearson-correlatiecoefficient-1\/\" target=\"_blank\" rel=\"noopener\">correlatieco\u00ebffici\u00ebnt<\/a> van 1 hebben. Dit vertelt ons dat deze twee variabelen de fout veroorzaken omdat ze perfect gecorreleerd zijn.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Om deze fout te corrigeren, past u eenvoudigweg het regressiemodel opnieuw aan en laat u een van deze twee variabelen weg.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Het maakt niet uit welke variabele we weglaten, aangezien ze allebei exact dezelfde informatie bieden in het regressiemodel.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Laten we voor de eenvoud <strong>x3<\/strong> verwijderen en het regressiemodel opnieuw aanpassen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (car)\n<\/span>\n#make this example reproducible\n<span style=\"color: #000000;\">set. <span style=\"color: #3366ff;\">seeds<\/span> (0)\n\n<span style=\"color: #008080;\">#define data\n<\/span>x1 &lt;- rnorm(100)\nx2 &lt;- rnorm(100)\nx3 &lt;- x2*3\ny &lt;- rnorm(100)\n\n<span style=\"color: #008080;\">#fit regression model\n<\/span>model &lt;- lm(y~x1+x2)\n\n<span style=\"color: #008080;\">#calculate VIF values for predictor variables in model<\/span>\nlively(model)\n\n      x1 x2 \n1.016364 1.016364 \n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Merk op dat we deze keer geen fouten ontvangen bij het berekenen van de VIF-waarden voor het model, omdat multicollineariteit niet langer een probleem is.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Gerelateerd:<\/strong> <a href=\"https:\/\/statorials.org\/nl\/variantie-inflatiefactor-r\/\" target=\"_blank\" rel=\"noopener\">VIF-waarden berekenen en interpreteren in R<\/a><\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende fouten in R kunt oplossen:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/r-vervanging-op-lengte-nul\/\" target=\"_blank\" rel=\"noopener\">Hoe te repareren in R: vervanging heeft een lengte van nul<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/r-argumenten-impliceren-een-ander-aantal-regels\/\" target=\"_blank\" rel=\"noopener\">Hoe op te lossen in R: argumenten hebben betrekking op een verschillend aantal regels<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/r-argument-is-niet-numeriek-of-logisch\/\" target=\"_blank\" rel=\"noopener\">Hoe op te lossen in R: argument is noch numeriek noch logisch: return na<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Een fout die je tegen kunt komen in R is: Error in vive.default(model): there are aliased coefficients in the model Deze fout treedt doorgaans op als er multicollineariteit bestaat in een regressiemodel. Dat wil zeggen dat twee of meer voorspellende variabelen in het model sterk (of perfect) gecorreleerd zijn. Wanneer dit gebeurt, zeggen we dat [&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":[],"class_list":["post-2330","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.\" \/>\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\/nl\/r-aliased-coefficienten-in-het-model\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T18:09:17+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\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/\",\"url\":\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/\",\"name\":\"Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-22T18:09:17+00:00\",\"dateModified\":\"2023-07-22T18:09:17+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe op te lossen in r: er zijn aliasco\u00ebffici\u00ebnten in het model\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials","description":"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.","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\/nl\/r-aliased-coefficienten-in-het-model\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.","og_url":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/","og_site_name":"Statorials","article_published_time":"2023-07-22T18:09:17+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/","url":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/","name":"Hoe op te lossen in R: er zijn aliasco\u00ebffici\u00ebnten in het model - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-22T18:09:17+00:00","dateModified":"2023-07-22T18:09:17+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u de volgende fout in R kunt oplossen: Fout in vive.default(model): Er zijn aliased co\u00ebffici\u00ebnten in het model.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/r-aliased-coefficienten-in-het-model\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe op te lossen in r: er zijn aliasco\u00ebffici\u00ebnten in het model"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/2330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=2330"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/2330\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=2330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=2330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=2330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}