{"id":3629,"date":"2023-07-16T11:14:31","date_gmt":"2023-07-16T11:14:31","guid":{"rendered":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/"},"modified":"2023-07-16T11:14:31","modified_gmt":"2023-07-16T11:14:31","slug":"estrai-lerrore-standard-da-lm-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/","title":{"rendered":"Come estrarre gli errori standard dalla funzione lm() in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u00c8 possibile utilizzare i seguenti metodi per estrarre l&#8217;errore standard residuo e l&#8217;errore standard dei singoli coefficienti di regressione della funzione <a href=\"https:\/\/statorials.org\/it\/funzione-lm-in-r\/\" target=\"_blank\" rel=\"noopener\">lm()<\/a> in R:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 1: estrarre l&#8217;errore standard residuo<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#extract residual standard error of regression model\n<span style=\"color: #000000;\">summary(model)$sigma<\/span><\/span>\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Metodo 2: estrarre l&#8217;errore standard dei singoli coefficienti di regressione<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#extract standard error of individual regression coefficients\n<span style=\"color: #000000;\">sqrt(diag(vcov(model)))<\/span>\n<\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">L&#8217;esempio seguente mostra come utilizzare ciascun metodo nella pratica.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio: estrazione degli errori standard da lm() in R<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Supponiamo di adattare il seguente modello di regressione lineare multipla in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (rating=c(67, 75, 79, 85, 90, 96, 97),\n                 points=c(8, 12, 16, 15, 22, 28, 24),\n                 assists=c(4, 6, 6, 5, 3, 8, 7),\n                 rebounds=c(1, 4, 3, 3, 2, 6, 7))\n\n<span style=\"color: #008080;\">#fit multiple linear regression model\n<\/span>model &lt;- lm(rating ~ points + assists + rebounds, data=df)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Possiamo utilizzare la funzione <strong>summary()<\/strong> per visualizzare il riepilogo completo del modello di regressione:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view model summary\n<\/span>summary(model)\n\nCall:\nlm(formula = rating ~ points + assists + rebounds, data = df)\n\nResiduals:\n      1 2 3 4 5 6 7 \n-1.5902 -1.7181 0.2413 4.8597 -1.0201 -0.6082 -0.1644 \n\nCoefficients:\n            Estimate Std. Error t value Pr(&gt;|t|)   \n(Intercept) 66.4355 6.6932 9.926 0.00218 **\npoints 1.2152 0.2788 4.359 0.02232 * \nassists -2.5968 1.6263 -1.597 0.20860   \nrebounds 2.8202 1.6118 1.750 0.17847   \n---\nSignificant. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 3.193 on 3 degrees of freedom\nMultiple R-squared: 0.9589, Adjusted R-squared: 0.9179 \nF-statistic: 23.35 on 3 and 3 DF, p-value: 0.01396\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">L&#8217;errore standard residuo del modello \u00e8 3,193 e ciascuno degli errori standard per i singoli coefficienti di regressione pu\u00f2 essere visualizzato in <strong>Std.<\/strong> Colonna <strong>degli errori<\/strong> di output.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Per estrarre solo l\u2019errore standard residuo dal modello, possiamo utilizzare la seguente sintassi:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#extract residual standard error of regression model<\/span>\nsummary(model)$sigma\n\n[1] 3.19339<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">E per estrarre solo gli errori standard per ciascuno dei singoli coefficienti di regressione, possiamo utilizzare la seguente sintassi:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#extract standard error of individual regression coefficients<\/span>\nsqrt(diag(vcov(model)))\n\n(Intercept) points assists rebounds \n  6.6931808 0.2787838 1.6262899 1.6117911 \n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Si noti che questi valori corrispondono ai valori che abbiamo visto in precedenza nell&#8217;intero riepilogo dei risultati della regressione.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Correlato:<\/strong> <a href=\"https:\/\/statorials.org\/it\/come-interpretare-lerrore-standard-residuo\/\" target=\"_blank\" rel=\"noopener\">Come interpretare l&#8217;errore standard residuo<\/a><\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come eseguire altre attivit\u00e0 comuni in R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/regressione-lineare-semplice-in-r\/\" target=\"_blank\" rel=\"noopener\">Come eseguire una regressione lineare semplice in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/regressione-lineare-multipla-r\/\" target=\"_blank\" rel=\"noopener\">Come eseguire la regressione lineare multipla in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/traccia-residua-r\/\" target=\"_blank\" rel=\"noopener\">Come creare una trama residua in R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c8 possibile utilizzare i seguenti metodi per estrarre l&#8217;errore standard residuo e l&#8217;errore standard dei singoli coefficienti di regressione della funzione lm() in R: Metodo 1: estrarre l&#8217;errore standard residuo #extract residual standard error of regression model summary(model)$sigma Metodo 2: estrarre l&#8217;errore standard dei singoli coefficienti di regressione #extract standard error of individual regression coefficients [&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 estrarre gli errori standard dalla funzione lm() in R - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.\" \/>\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\/estrai-lerrore-standard-da-lm-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come estrarre gli errori standard dalla funzione lm() in R - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-16T11:14:31+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\/estrai-lerrore-standard-da-lm-in-r\/\",\"url\":\"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/\",\"name\":\"Come estrarre gli errori standard dalla funzione lm() in R - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-16T11:14:31+00:00\",\"dateModified\":\"2023-07-16T11:14:31+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come estrarre gli errori standard dalla funzione lm() 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 estrarre gli errori standard dalla funzione lm() in R - Statorials","description":"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.","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\/estrai-lerrore-standard-da-lm-in-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come estrarre gli errori standard dalla funzione lm() in R - Statorials","og_description":"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.","og_url":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-16T11:14:31+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\/estrai-lerrore-standard-da-lm-in-r\/","url":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/","name":"Come estrarre gli errori standard dalla funzione lm() in R - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-16T11:14:31+00:00","dateModified":"2023-07-16T11:14:31+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come estrarre gli errori standard dalla funzione lm() in R, con diversi esempi.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/estrai-lerrore-standard-da-lm-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come estrarre gli errori standard dalla funzione lm() 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\/3629"}],"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=3629"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/3629\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=3629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=3629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=3629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}