{"id":841,"date":"2023-07-28T14:09:15","date_gmt":"2023-07-28T14:09:15","guid":{"rendered":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/"},"modified":"2023-07-28T14:09:15","modified_gmt":"2023-07-28T14:09:15","slug":"mcnemars-python-test","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/","title":{"rendered":"Hoe u de mcnemar-test in python uitvoert"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><strong>De McNemar-test<\/strong> wordt gebruikt om te bepalen of er een statistisch significant verschil is in verhoudingen tussen gepaarde gegevens.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In deze tutorial wordt uitgelegd hoe u de McNemar-test in Python uitvoert.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld: de McNemar-test in Python<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Stel dat onderzoekers willen weten of een bepaalde marketingvideo de mening van mensen over een bepaalde wet kan veranderen. Ze ondervragen 100 mensen om erachter te komen of ze de wet wel of niet steunen. Vervolgens laten ze de marketingvideo aan alle 100 mensen zien en ondervragen ze opnieuw nadat de video is afgelopen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">De volgende tabel toont het totale aantal mensen dat de wet steunde voor en na het bekijken van de video:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<th><\/th>\n<th colspan=\"2\"> <span style=\"color: #000000;\">Video v\u00f3\u00f3r marketing<\/span><\/th>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\">Video na marketing<\/span><\/td>\n<td> <span style=\"color: #000000;\"><strong>Steun<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\"><strong>Kan niet uitstaan<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\"><strong>Steun<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\">30<\/span><\/td>\n<td> <span style=\"color: #000000;\">40<\/span><\/td>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\"><strong>Kan niet uitstaan<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\">12<\/span><\/td>\n<td> <span style=\"color: #000000;\">18<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> <span style=\"color: #000000;\">Om te bepalen of er een statistisch significant verschil was in het aandeel mensen dat de wet steunde voor en na het bekijken van de video, kunnen we de McNemar-test uitvoeren.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Stap 1: Cre\u00eber de gegevens.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Eerst maken we een tabel waarin we onze gegevens bewaren:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>data = [[30, 40],\n         [12, 18]]\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Stap 2: Voer de McNemar-test uit<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Vervolgens kunnen we de <a href=\"https:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.contingency_tables.mcnemar.html\" target=\"_blank\" rel=\"noopener\">functie mcnemar()<\/a> uit de Python statsmodels-bibliotheek gebruiken, die de volgende syntaxis gebruikt:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>mcnemar(matrix, exact=Waar, correctie=Waar)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Goud:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>tafel:<\/strong> Een vierkante kruistabel<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>exact:<\/strong> Als exact waar is, wordt de binominale verdeling gebruikt. Als correct onwaar is, wordt de Chi-kwadraatverdeling gebruikt<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>correctie:<\/strong> indien waar, wordt er gebruik gemaakt van een continu\u00efteitscorrectie. Deze correctie wordt doorgaans toegepast als het aantal tabelcellen kleiner is dan 5.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u deze functie kunt gebruiken in ons specifieke voorbeeld:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">from<\/span> statsmodels.stats.contingency_tables <span style=\"color: #008000;\">import<\/span> mcnemar\n\n<span style=\"color: #008080;\">#McNemar's Test with no continuity correction<\/span>\nprint(mcnemar(data, exact=False))\n\npvalue 0.000181\nstatistic 14.019\n\n<span style=\"color: #008080;\">#McNemar's Test with continuity correction<\/span>\nprint(mcnemar(data, exact=False, correction=False))\n\npvalue 0.000103\nstatistic 15,077<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">In beide gevallen \u2013 ongeacht of continu\u00efteitscorrectie wordt toegepast \u2013 is de p-waarde van de test kleiner dan 0,05.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dit betekent dat we in beide gevallen de nulhypothese zouden verwerpen en zouden concluderen dat het aandeel mensen dat de wet steunde voor en na het bekijken van de marketingvideo statistisch verschillend was.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>De McNemar-test wordt gebruikt om te bepalen of er een statistisch significant verschil is in verhoudingen tussen gepaarde gegevens. In deze tutorial wordt uitgelegd hoe u de McNemar-test in Python uitvoert. Voorbeeld: de McNemar-test in Python Stel dat onderzoekers willen weten of een bepaalde marketingvideo de mening van mensen over een bepaalde wet kan veranderen. [&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-841","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 de McNemar-test in Python uit te voeren - Statorials<\/title>\n<meta name=\"description\" content=\"Een eenvoudige uitleg over het uitvoeren van de McNemar-test 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\/nl\/mcnemars-python-test\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de McNemar-test in Python uit te voeren - Statorials\" \/>\n<meta property=\"og:description\" content=\"Een eenvoudige uitleg over het uitvoeren van de McNemar-test in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/mcnemars-python-test\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T14:09:15+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\/mcnemars-python-test\/\",\"url\":\"https:\/\/statorials.org\/nl\/mcnemars-python-test\/\",\"name\":\"Hoe de McNemar-test in Python uit te voeren - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-28T14:09:15+00:00\",\"dateModified\":\"2023-07-28T14:09:15+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"Een eenvoudige uitleg over het uitvoeren van de McNemar-test in Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/mcnemars-python-test\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/mcnemars-python-test\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/mcnemars-python-test\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe u de mcnemar-test in python uitvoert\"}]},{\"@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 de McNemar-test in Python uit te voeren - Statorials","description":"Een eenvoudige uitleg over het uitvoeren van de McNemar-test 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\/nl\/mcnemars-python-test\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de McNemar-test in Python uit te voeren - Statorials","og_description":"Een eenvoudige uitleg over het uitvoeren van de McNemar-test in Python.","og_url":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/","og_site_name":"Statorials","article_published_time":"2023-07-28T14:09:15+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\/mcnemars-python-test\/","url":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/","name":"Hoe de McNemar-test in Python uit te voeren - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-28T14:09:15+00:00","dateModified":"2023-07-28T14:09:15+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"Een eenvoudige uitleg over het uitvoeren van de McNemar-test in Python.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/mcnemars-python-test\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/mcnemars-python-test\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe u de mcnemar-test in python uitvoert"}]},{"@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\/841","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=841"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}