{"id":1257,"date":"2023-07-27T02:53:55","date_gmt":"2023-07-27T02:53:55","guid":{"rendered":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/"},"modified":"2023-07-27T02:53:55","modified_gmt":"2023-07-27T02:53:55","slug":"waarschijnlijkheidsratio-test-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/","title":{"rendered":"Hoe een waarschijnlijkheidsratiotest uit te voeren in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Een <strong>waarschijnlijkheidsratiotest<\/strong> vergelijkt de \u2018goodness of fit\u2019 van twee geneste regressiemodellen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Een <a href=\"https:\/\/statorials.org\/nl\/genest-model\/\" target=\"_blank\" rel=\"noopener\">genest model<\/a> is eenvoudigweg een model dat een subset van voorspellende variabelen in het algehele regressiemodel bevat.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Stel dat we bijvoorbeeld het volgende regressiemodel hebben met vier voorspellende variabelen:<\/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;\">Een voorbeeld van een genest model is het volgende model met slechts twee van de oorspronkelijke voorspellende variabelen:<\/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;\">Om te bepalen of deze twee modellen significant van elkaar verschillen, kunnen we een waarschijnlijkheidsratiotest uitvoeren waarbij gebruik wordt gemaakt van de volgende nul- en alternatieve hypothesen:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>0<\/sub> :<\/strong> Het volledige model en het geneste model passen even goed bij de gegevens. U moet dus <strong>een genest model gebruiken<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>A<\/sub> :<\/strong> Het volledige model past aanzienlijk beter bij de gegevens dan het geneste model. U moet dus <strong>het volledige sjabloon gebruiken<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Als de p-waarde van de test onder een bepaald significantieniveau ligt (bijvoorbeeld 0,05), kunnen we de nulhypothese verwerpen en concluderen dat het volledige model een significant betere fit biedt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In het volgende voorbeeld ziet u hoe u een waarschijnlijkheidsratiotest uitvoert in R.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld: Likelihood ratio-test in R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de volgende twee regressiemodellen in R kunt passen met behulp van gegevens uit de ingebouwde <strong>mtcars-<\/strong> gegevensset:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Volledig model:<\/strong> mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> beschikbaar + \u03b2 <sub>2<\/sub> carb + \u03b2 <sub>3<\/sub> pk + \u03b2 <sub>4<\/sub> cil<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Model:<\/strong> mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> beschikbaar + \u03b2 <sub>2<\/sub> carb<\/span><\/p>\n<p> <span style=\"color: #000000;\">We zullen de functie <strong>lrtest()<\/strong> van het pakket <strong>lmtest<\/strong> gebruiken om een waarschijnlijkheidsratiotest uit te voeren op deze twee modellen:<\/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;\">Uit het resultaat kunnen we zien dat de chikwadraattoetsstatistiek <strong>2,0902<\/strong> is en de overeenkomstige p-waarde <strong>0,3517<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Omdat deze p-waarde niet kleiner is dan 0,05, zullen we er niet in slagen de nulhypothese te verwerpen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dit betekent dat het volledige model en het geneste model even goed bij de gegevens passen. We moeten daarom het geneste model gebruiken, omdat de extra voorspellende variabelen in het volledige model geen significante verbetering van de fit opleveren.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We zouden dan nog een waarschijnlijkheidsratiotest kunnen uitvoeren om te bepalen of een model met \u00e9\u00e9n enkele voorspellende variabele significant verschilt van een model met beide voorspellers:<\/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;\">Uit het resultaat kunnen we zien dat de p-waarde van de waarschijnlijkheidsratio-test <strong>0,008136<\/strong> is. Omdat dit getal kleiner is dan 0,05, zouden we de nulhypothese verwerpen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We zouden dus kunnen concluderen dat het model met twee voorspellers een significante verbetering in de fit oplevert ten opzichte van het model met \u00e9\u00e9n voorspeller.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Ons uiteindelijke model zou dus zijn:<\/span><\/p>\n<p> <span style=\"color: #000000;\">mpg = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> beschikbaar + \u03b2 <sub>2<\/sub> koolhydraten<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/nl\/eenvoudige-lineaire-regressie-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hoe eenvoudige lineaire regressie uit te voeren in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/meervoudige-lineaire-regressie-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hoe meervoudige lineaire regressie uit te voeren in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/betekent-codes-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hoe betekeniscodes in R te interpreteren<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Een waarschijnlijkheidsratiotest vergelijkt de \u2018goodness of fit\u2019 van twee geneste regressiemodellen. Een genest model is eenvoudigweg een model dat een subset van voorspellende variabelen in het algehele regressiemodel bevat. Stel dat we bijvoorbeeld het volgende regressiemodel hebben met vier voorspellende variabelen: Y = \u03b2 0 + \u03b2 1 x 1 + \u03b2 2 x 2 [&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-1257","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 u een waarschijnlijkheidsratiotest uitvoert in R - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.\" \/>\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\/waarschijnlijkheidsratio-test-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe u een waarschijnlijkheidsratiotest uitvoert in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-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\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/\",\"url\":\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/\",\"name\":\"Hoe u een waarschijnlijkheidsratiotest uitvoert in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-27T02:53:55+00:00\",\"dateModified\":\"2023-07-27T02:53:55+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe een waarschijnlijkheidsratiotest uit te voeren in r\"}]},{\"@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 u een waarschijnlijkheidsratiotest uitvoert in R - Statorials","description":"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.","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\/waarschijnlijkheidsratio-test-in-r\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe u een waarschijnlijkheidsratiotest uitvoert in R - Statorials","og_description":"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.","og_url":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-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\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/","url":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/","name":"Hoe u een waarschijnlijkheidsratiotest uitvoert in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-27T02:53:55+00:00","dateModified":"2023-07-27T02:53:55+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt aan de hand van een voorbeeld uitgelegd hoe u een waarschijnlijkheidsratiotest in R uitvoert.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/waarschijnlijkheidsratio-test-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe een waarschijnlijkheidsratiotest uit te voeren in r"}]},{"@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\/1257","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=1257"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/1257\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}