{"id":1138,"date":"2023-07-27T13:02:39","date_gmt":"2023-07-27T13:02:39","guid":{"rendered":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/"},"modified":"2023-07-27T13:02:39","modified_gmt":"2023-07-27T13:02:39","slug":"gerar-uma-distribuicao-normal-em-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/","title":{"rendered":"Como gerar uma distribui\u00e7\u00e3o normal em r (com exemplos)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Voc\u00ea pode gerar rapidamente uma <a href=\"https:\/\/statorials.org\/pt\/a-distribuicao-normal\/\" target=\"_blank\" rel=\"noopener noreferrer\">distribui\u00e7\u00e3o normal<\/a> em R usando a fun\u00e7\u00e3o <strong>rnorm()<\/strong> , que usa a seguinte sintaxe:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>rnorm(n, mean=0, sd=1)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Ouro:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>n:<\/strong> N\u00famero de observa\u00e7\u00f5es.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>m\u00e9dia:<\/strong> m\u00e9dia da distribui\u00e7\u00e3o normal. O valor padr\u00e3o \u00e9 0.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>dp:<\/strong> desvio padr\u00e3o da distribui\u00e7\u00e3o normal. O valor padr\u00e3o \u00e9 1.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Este tutorial mostra um exemplo de uso desta fun\u00e7\u00e3o para gerar uma distribui\u00e7\u00e3o normal em R.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Relacionado:<\/strong> <a href=\"https:\/\/statorials.org\/pt\/dnorm-pnorm-rnorm-qnorm-em-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Um guia para dnorm, pnorm, qnorm e rnorm em R<\/a><\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo: gerando uma distribui\u00e7\u00e3o normal em R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como gerar uma distribui\u00e7\u00e3o normal em R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#make this example reproducible\n<span style=\"color: #000000;\">set.seed(1)<\/span>\n\n#generate sample of 200 obs. that follows normal dist. with mean=10 and sd=3<\/span>\ndata &lt;- rnorm(200, mean=10, sd=3)\n\n<span style=\"color: #008080;\">#view first 6 observations in sample\n<\/span>head(data)\n\n[1] 8.120639 10.550930 7.493114 14.785842 10.988523 7.538595\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Podemos encontrar rapidamente a m\u00e9dia e o desvio padr\u00e3o desta distribui\u00e7\u00e3o:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find mean of sample\n<span style=\"color: #000000;\">mean(data)\n\n[1] 10.10662\n<\/span>\n#find standard deviation of sample\n<span style=\"color: #000000;\">sd(data)\n\n[1] 2.787292\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Tamb\u00e9m podemos criar um histograma r\u00e1pido para visualizar a distribui\u00e7\u00e3o dos valores dos dados:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\">hist(data, col=' <span style=\"color: #008000;\">steelblue<\/span> ')\n<\/span><\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11442 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistr1.png\" alt=\"Gere uma distribui\u00e7\u00e3o normal em R\" width=\"452\" height=\"451\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Podemos at\u00e9 realizar um<a href=\"https:\/\/statorials.org\/pt\/teste-shapiro-wilk-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">teste de Shapiro-Wilk<\/a> para ver se o conjunto de dados vem de uma popula\u00e7\u00e3o normal:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\">shapiro.test(data)\n\n\tShapiro-Wilk normality test\n\ndata:data\nW = 0.99274, p-value = 0.4272\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">O valor p do teste acabou sendo <strong>0,4272<\/strong> . Como este valor n\u00e3o \u00e9 inferior a 0,05, podemos assumir que os dados amostrais prov\u00eam de uma popula\u00e7\u00e3o normalmente distribu\u00edda.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Este resultado n\u00e3o deve ser surpreendente, uma vez que geramos os dados usando a fun\u00e7\u00e3o <strong>rnorm()<\/strong> , que gera naturalmente uma amostra aleat\u00f3ria de dados de uma distribui\u00e7\u00e3o normal.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/pt\/tracar-a-distribuicao-normal-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Como tra\u00e7ar uma distribui\u00e7\u00e3o normal em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/dnorm-pnorm-rnorm-qnorm-em-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Um guia para dnorm, pnorm, qnorm e rnorm em R<\/a><br \/><a href=\"https:\/\/statorials.org\/pt\/teste-shapiro-wilk-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Como realizar um teste de Shapiro-Wilk para normalidade em R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Voc\u00ea pode gerar rapidamente uma distribui\u00e7\u00e3o normal em R usando a fun\u00e7\u00e3o rnorm() , que usa a seguinte sintaxe: rnorm(n, mean=0, sd=1) Ouro: n: N\u00famero de observa\u00e7\u00f5es. m\u00e9dia: m\u00e9dia da distribui\u00e7\u00e3o normal. O valor padr\u00e3o \u00e9 0. dp: desvio padr\u00e3o da distribui\u00e7\u00e3o normal. O valor padr\u00e3o \u00e9 1. Este tutorial mostra um exemplo de uso [&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-1138","post","type-post","status-publish","format-standard","hentry","category-guia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)<\/title>\n<meta name=\"description\" content=\"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.\" \/>\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\/pt\/gerar-uma-distribuicao-normal-em-r\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T13:02:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistr1.png\" \/>\n<meta name=\"author\" content=\"Dr. benjamim anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. benjamim anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/\",\"url\":\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/\",\"name\":\"Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-27T13:02:39+00:00\",\"dateModified\":\"2023-07-27T13:02:39+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como gerar uma distribui\u00e7\u00e3o normal em r (com exemplos)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/pt\/#website\",\"url\":\"https:\/\/statorials.org\/pt\/\",\"name\":\"Statorials\",\"description\":\"O seu guia para a literacia estat\u00edstica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/pt\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\",\"name\":\"Dr. benjamim anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. benjamim anderson\"},\"description\":\"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais\",\"sameAs\":[\"https:\/\/statorials.org\/pt\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)","description":"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.","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\/pt\/gerar-uma-distribuicao-normal-em-r\/","og_locale":"pt_PT","og_type":"article","og_title":"Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)","og_description":"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.","og_url":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/","og_site_name":"Statorials","article_published_time":"2023-07-27T13:02:39+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistr1.png"}],"author":"Dr. benjamim anderson","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Dr. benjamim anderson","Tempo estimado de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/","url":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/","name":"Como gerar uma distribui\u00e7\u00e3o normal em R (com exemplos)","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-27T13:02:39+00:00","dateModified":"2023-07-27T13:02:39+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica como gerar uma distribui\u00e7\u00e3o normal em R, com v\u00e1rios exemplos.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/gerar-uma-distribuicao-normal-em-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"Como gerar uma distribui\u00e7\u00e3o normal em r (com exemplos)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/pt\/#website","url":"https:\/\/statorials.org\/pt\/","name":"Statorials","description":"O seu guia para a literacia estat\u00edstica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/pt\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-PT"},{"@type":"Person","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666","name":"Dr. benjamim anderson","image":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr. benjamim anderson"},"description":"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais","sameAs":["https:\/\/statorials.org\/pt"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/comments?post=1138"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1138\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=1138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=1138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=1138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}