{"id":674,"date":"2023-07-29T03:25:22","date_gmt":"2023-07-29T03:25:22","guid":{"rendered":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/"},"modified":"2023-07-29T03:25:22","modified_gmt":"2023-07-29T03:25:22","slug":"test-di-mcnemars-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/","title":{"rendered":"Come eseguire il test mcnemar in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><strong>Il test McNemar<\/strong> viene utilizzato per determinare se esiste una differenza statisticamente significativa nelle proporzioni tra i dati accoppiati.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Questo tutorial spiega come eseguire il test McNemar in R.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio: test di McNemar in R<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Supponiamo che i ricercatori vogliano sapere se un determinato video di marketing pu\u00f2 cambiare le opinioni delle persone su una particolare legge. Intervistano 100 persone per scoprire se sostengono o meno la legge. Quindi mostrano il video di marketing a tutte le 100 persone e le esaminano nuovamente al termine del video.<\/span><\/p>\n<p> <span style=\"color: #000000;\">La tabella seguente mostra il numero totale di persone che hanno sostenuto la legge prima e dopo aver visto il video:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<th><\/th>\n<th colspan=\"2\"> <span style=\"color: #000000;\">Video prima della commercializzazione<\/span><\/th>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\">Video dopo la commercializzazione<\/span><\/td>\n<td> <span style=\"color: #000000;\"><strong>Supporto<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\"><strong>Non sopporto<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\"><strong>Supporto<\/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>Non sopporto<\/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;\">Per determinare se ci fosse una differenza statisticamente significativa nella percentuale di persone che sostenevano la legge prima e dopo aver visto il video, possiamo eseguire il test McNemar.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Passaggio 1: creare i dati.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Innanzitutto, crea il set di dati in formato raster.<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data<\/span>\ndata &lt;- matrix(c(30, 12, 40, 18), nrow = 2,\n    dimnames = list(\"After Video\" = c(\"Support\", \"Do Not Support\"),\n                    \"Before Video\" = c(\"Support\", \"Do Not Support\")))\n\n<span style=\"color: #008080;\">#view data\n<\/span>data\n\n                Before Video\nAfter Video Support Do Not Support\n  Bracket 30 40\n  Do Not Support 12 18\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Passaggio 2: eseguire il test McNemar.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Successivamente, esegui il test McNemar utilizzando la seguente sintassi:<\/span><\/p>\n<p> <strong><span style=\"color: #000000;\">mcnemar.test(x,y=NULL,corretto=VERO)<\/span><\/strong><\/p>\n<p> <span style=\"color: #000000;\">Oro:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>x<\/strong> : una tabella di contingenza bidimensionale in forma di matrice o un oggetto fattore.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>y<\/strong> : un oggetto fattore; ignorato se x \u00e8 una matrice.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>corretto<\/strong> : TRUE = applica la correzione di continuit\u00e0 durante il calcolo delle statistiche del test; FALSO = non applicare la correzione di continuit\u00e0.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">In generale, \u00e8 opportuno applicare una correzione di continuit\u00e0 quando alcuni conteggi nella tabella sono bassi. In genere, questa correzione viene applicata quando il numero di celle \u00e8 inferiore a 5.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Effettueremo il test McNemar con e senza correzione di continuit\u00e0, solo per illustrare le differenze:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#Perform McNemar's Test with continuity correction<\/span>\nmcnemar.test(data)\n\n\tMcNemar's Chi-squared test with continuity correction\n\ndata:data\nMcNemar's chi-squared = 14.019, df = 1, p-value = 0.000181\n\n<span style=\"color: #008080;\">#Perform McNemar's Test without continuity correction<\/span>\nmcnemar.test(data, correct=FALSE) \n\n\tMcNemar's Chi-squared test\n\ndata:data\nMcNemar's chi-squared = 15.077, df = 1, p-value = 0.0001032<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">In entrambi i casi, il valore p del test \u00e8 inferiore a 0,05, quindi rifiuteremmo l\u2019ipotesi nulla e concluderemmo che la percentuale di persone che sostenevano la legge prima e dopo aver visto il video di marketing era statisticamente diversa.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Il test McNemar viene utilizzato per determinare se esiste una differenza statisticamente significativa nelle proporzioni tra i dati accoppiati. Questo tutorial spiega come eseguire il test McNemar in R. Esempio: test di McNemar in R Supponiamo che i ricercatori vogliano sapere se un determinato video di marketing pu\u00f2 cambiare le opinioni delle persone su una [&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>Come eseguire il test McNemar in R - Statorials<\/title>\n<meta name=\"description\" content=\"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.\" \/>\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\/it\/test-di-mcnemars-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come eseguire il test McNemar in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T03:25:22+00:00\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/\",\"url\":\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/\",\"name\":\"Come eseguire il test McNemar in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-29T03:25:22+00:00\",\"dateModified\":\"2023-07-29T03:25:22+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come eseguire il test mcnemar in r\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Come eseguire il test McNemar in R - Statorials","description":"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.","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\/it\/test-di-mcnemars-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come eseguire il test McNemar in R - Statorials","og_description":"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.","og_url":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/","og_site_name":"Statorials","article_published_time":"2023-07-29T03:25:22+00:00","author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/","url":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/","name":"Come eseguire il test McNemar in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-29T03:25:22+00:00","dateModified":"2023-07-29T03:25:22+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Una semplice spiegazione di come eseguire il test McNemar in R, incluso un esempio passo passo.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/test-di-mcnemars-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/test-di-mcnemars-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come eseguire il test mcnemar in r"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/674"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=674"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/674\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}