{"id":489,"date":"2023-07-29T17:55:21","date_gmt":"2023-07-29T17:55:21","guid":{"rendered":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/"},"modified":"2023-07-29T17:55:21","modified_gmt":"2023-07-29T17:55:21","slug":"anderson-cheri-prova-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/","title":{"rendered":"Come eseguire un test di anderson-darling in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Un <strong>test di Anderson-Darling<\/strong> \u00e8 un test di bont\u00e0 di adattamento che misura quanto bene i tuoi dati si adattano a una distribuzione specificata. Questo test viene spesso utilizzato per determinare se i dati seguono o meno una <a href=\"https:\/\/statorials.org\/it\/la-distribuzione-normale\/\" target=\"_blank\" rel=\"noopener\">distribuzione normale<\/a> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Questo tipo di test \u00e8 utile per testare la normalit\u00e0, che \u00e8 un presupposto comunemente utilizzato in molti test statistici, tra cui regressione, ANOVA, test t e molti altri.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Esempio: test di Anderson-Darling in R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Per eseguire un test Anderson-Darling in R, possiamo utilizzare la funzione <strong>ad.test()<\/strong> nella libreria <strong>nortest<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Il codice seguente illustra come eseguire un test AD per verificare se un vettore di 100 valori segue o meno una distribuzione normale:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install (if not already installed) and load <em>nortest<\/em> library<\/span>\ninstall.packages('nortest')\nlibrary(nortest)\n\n<span style=\"color: #008080;\">#make this example reproducible<\/span>\nset.seed(1)\n\n<span style=\"color: #008080;\">#defined vector of 100 values that are normally distributed\n<span style=\"color: #000000;\">x &lt;- rnorm(100, 0, 1)<\/span>\n\n#conduct Anderson-Darling Test to test for normality\n<span style=\"color: #000000;\">ad.test(x)\n\n<\/span><span style=\"color: #000000;\"><span style=\"color: #000000;\">#<\/span> Anderson-Darling normality test\n#\n#data:x\n#A = 0.16021, p-value = 0.9471\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Questo test restituisce due valori:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>A<\/strong> : la statistica del test.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>valore p<\/strong> : il valore p corrispondente della statistica del test.<\/span><\/p>\n<p> <span style=\"color: #000000;\">L&#8217;ipotesi nulla del test AD \u00e8 che i dati <em>seguano<\/em> una distribuzione normale. Quindi, se il nostro valore p per il test \u00e8 inferiore al nostro livello di significativit\u00e0 (le scelte comuni sono 0,10, 0,05 e 0,01), allora possiamo rifiutare l&#8217;ipotesi nulla e concludere che abbiamo prove sufficienti per affermare che i nostri dati non seguono una traiettoria normale. distribuzione.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In questo caso, il nostro valore p \u00e8 0,9471. Poich\u00e9 questo numero non \u00e8 inferiore al nostro livello di significativit\u00e0 (diciamo 0,05), non abbiamo prove sufficienti per rifiutare l\u2019ipotesi nulla. Si pu\u00f2 dire con certezza che i nostri dati seguono una distribuzione normale, il che ha senso dato che abbiamo generato 100 valori che seguono una distribuzione normale con una media pari a 0 e una deviazione standard pari a 1 utilizzando la funzione <strong>rnorm()<\/strong> in R.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Correlato:<\/strong><\/span> Una guida a dnorm, pnorm, qnorm e rnorm in R<\/p>\n<p> <span style=\"color: #000000;\">Supponiamo invece di generare un vettore di 100 valori che segue una distribuzione uniforme tra 0 e 1. Possiamo eseguire nuovamente un test AD per vedere se questi dati seguono una distribuzione normale:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#make this example reproducible\n<\/span>set.seed(1)\n\n<span style=\"color: #008080;\">#defined vector of 100 values that are uniformly distributed\n<\/span>x &lt;- runif(100, 0, 1)\n\n<span style=\"color: #008080;\">#conduct Anderson-Darling Test to test for normality\n<\/span>ad.test(x)\n\n# Anderson-Darling normality test\n#\n#data:x\n#A = 1.1472, p-value = 0.005086\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">La nostra statistica del test <em>A<\/em> \u00e8 pari a 1,1472 e il corrispondente valore p \u00e8 pari a 0,005086. Poich\u00e9 il nostro valore p \u00e8 inferiore a 0,05, possiamo rifiutare l&#8217;ipotesi nulla e concludere che abbiamo prove sufficienti per affermare che questi dati non seguono una distribuzione normale. Questo \u00e8 il risultato che ci aspettavamo poich\u00e9 sappiamo che i nostri dati seguono in realt\u00e0 una distribuzione uniforme.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esecuzione di un test di Anderson-Darling su una colonna di un data frame in R<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Possiamo anche eseguire un test AD per una colonna specifica di un frame di dati in R. Ad esempio, considera il set di dati <strong>dell&#8217;iride<\/strong> incorporato:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view first six lines of <em>iris<\/em> dataset<\/span>\nhead(iris)\n\n# Sepal.Length Sepal.Width Petal.Length Petal.Width Species\n#1 5.1 3.5 1.4 0.2 setosa\n#2 4.9 3.0 1.4 0.2 setosa\n#3 4.7 3.2 1.3 0.2 setosa\n#4 4.6 3.1 1.5 0.2 setosa\n#5 5.0 3.6 1.4 0.2 setosa\n#6 5.4 3.9 1.7 0.4 setosa\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Supponiamo di voler sapere se la variabile <em>Petal.Width<\/em> \u00e8 distribuita normalmente. Potremmo prima creare un istogramma per visualizzare la distribuzione dei valori:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>hist(iris$Petal.Width, col = 'steelblue', main = 'Distribution of Petal Widths',\n     xlab = 'Petal Width')\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">I dati non sembrano essere distribuiti normalmente. Per confermarlo, possiamo eseguire un test AD per verificare formalmente se i dati sono distribuiti normalmente o meno:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#conduct Anderson-Darling Test to test for normality\n<\/span>ad.test(iris$Petal.Width)\n\n# Anderson-Darling normality test\n#\n#data: iris$Petal.Width\n#A = 5.1057, p-value = 1.125e-12\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Il valore p del test \u00e8 inferiore a 0,05, quindi abbiamo prove sufficienti per rifiutare l&#8217;ipotesi nulla e concludere che <em>Petal.Width<\/em> non segue una distribuzione normale.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un test di Anderson-Darling \u00e8 un test di bont\u00e0 di adattamento che misura quanto bene i tuoi dati si adattano a una distribuzione specificata. Questo test viene spesso utilizzato per determinare se i dati seguono o meno una distribuzione normale . Questo tipo di test \u00e8 utile per testare la normalit\u00e0, che \u00e8 un presupposto [&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 un test di Anderson-Darling in R - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.\" \/>\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\/anderson-cheri-prova-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come eseguire un test di Anderson-Darling in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T17:55:21+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=\"3 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/\",\"url\":\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/\",\"name\":\"Come eseguire un test di Anderson-Darling in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-29T17:55:21+00:00\",\"dateModified\":\"2023-07-29T17:55:21+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come eseguire un test di anderson-darling 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 un test di Anderson-Darling in R - Statorials","description":"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.","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\/anderson-cheri-prova-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come eseguire un test di Anderson-Darling in R - Statorials","og_description":"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.","og_url":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/","og_site_name":"Statorials","article_published_time":"2023-07-29T17:55:21+00:00","author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"3 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/","url":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/","name":"Come eseguire un test di Anderson-Darling in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-29T17:55:21+00:00","dateModified":"2023-07-29T17:55:21+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come eseguire facilmente un test di Anderson-Darling per la normalit\u00e0 in R.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/anderson-cheri-prova-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come eseguire un test di anderson-darling 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\/489"}],"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=489"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/489\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}