{"id":3537,"date":"2023-07-18T14:59:54","date_gmt":"2023-07-18T13:59:54","guid":{"rendered":"https:\/\/www.microdata.no\/?post_type=eksempel&#038;p=3537"},"modified":"2023-10-27T16:39:19","modified_gmt":"2023-10-27T15:39:19","slug":"descriptive-statistics-histogram-and-barchart","status":"publish","type":"eksempel","link":"https:\/\/www.microdata.no\/en\/eksempel\/descriptive-statistics-histogram-and-barchart\/","title":{"rendered":"Descriptive statistics: histogram and barchart"},"content":{"rendered":"\n<p>The <code>histogram<\/code> command is used to display frequency distributions\/value distributions for numerical variables in a graphical way where the values \u200b\u200bare grouped into appropriate intervals and columns are assigned that show the degree of occurrence for each interval. It is possible to control how many columns or how wide the column intervals should be, through options. With a limited number of values, it is recommended to use the <code>discrete<\/code> option. This produces a graph that shows one bar per value (rather than intervals).<\/p>\n\n\n\n<p>The <code>barchart<\/code> command is used to create bar charts for numerical variables, i.e. graphical display of the values \u200b\u200bobtained through the <code>summarize<\/code> command. It is possible to group the columns by categorical values.<\/p>\n\n\n<div id=\"rose-block_0e613e65fc0f17d0494495a17fbc6802\" class=\"rose-code codeblock-wrapper\">\n<pre tabindex=\"0\" class=\"codeblock\"><code>\/\/ Histogram og barchart\r\n\r\nrequire no.ssb.fdb:23 as db\r\n\r\ncreate-dataset demografidata\r\nimport db\/INNTEKT_WYRKINNT 2020-01-01 as innt\r\nimport db\/INNTEKT_BRUTTOFORM 2020-01-01 as formue\r\nimport db\/BEFOLKNING_KJOENN as kj\u00f8nn\r\nimport db\/BEFOLKNING_FOEDSELS_AAR_MND as faarmnd\r\n\r\n\/\/ Lager alder per 2020\r\ngenerate alder = 2020 - int(faarmnd\/100)\r\n\r\n\/\/ Histogram (frekvensfordelinger)\r\n\/\/ Dette er en m\u00e5te \u00e5 vise frekvensfordelinger for metriske\/kontinuerlige variabler p\u00e5 en grafisk m\u00e5te der verdiene grupperes i passende intervaller og tilegnes s\u00f8yler som viser graden av forekomst. S\u00f8ylearealene i diagrammet summerer seg til 1 som default, men en kan overstyre dette gjennom options. Gjennom options kan en dessuten selv velge inndelingen av av verdier (hvor mange s\u00f8yler en \u00f8nsker), legge p\u00e5 en normalfordelingskurve som referanse m.m.\r\n\r\nhistogram innt\r\nhistogram innt, freq\r\nhistogram innt, fraction\r\nhistogram innt, percent\r\n\r\nhistogram innt, normal\r\nhistogram innt, bin(6) freq\r\nhistogram innt, width(100000) freq\r\n\r\nhistogram innt, by(kj\u00f8nn)\r\nhistogram innt if innt > 100000\r\n\r\n\r\n\/\/ Ved bruk av discrete-option kan en ogs\u00e5 lage histogrammer for diskrete variabler. Da vil hver kategori representeres av respektive s\u00f8yler\r\n\r\nhistogram alder, discrete\r\n\r\n\r\n\/\/ S\u00f8ylediagram\r\n\/\/ Slike diagrammer er fine til \u00e5 fremstille statistikk for kontinuerlige\/metriske variabler p\u00e5 en oversiktlig m\u00e5te. En kan kombinere flere variabler og bryte ned tallene p\u00e5 kategoriske egenskaper (kj\u00f8nn, utdanningsniv\u00e5 etc)\r\n\r\nbarchart (mean) innt, over(kj\u00f8nn)\r\nbarchart (mean) innt formue, over(kj\u00f8nn)<\/code><\/pre>\n<\/div>","protected":false},"parent":0,"menu_order":31,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":""},"class_list":["post-3537","eksempel","type-eksempel","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Descriptive statistics: histogram and barchart - microdata.no<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Descriptive statistics: histogram and barchart - microdata.no\" \/>\n<meta property=\"og:description\" content=\"The histogram command is used to display frequency distributions\/value distributions for numerical variables in a graphical way where the values \u200b\u200bare grouped into appropriate intervals and columns are assigned that show the degree of occurrence for each interval. It is possible to control how many columns or how wide the column intervals should be, through...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/\" \/>\n<meta property=\"og:site_name\" content=\"microdata.no\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-27T15:39:19+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/deskriptiv-statistikk-histogram-og-barchart\\\/\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/deskriptiv-statistikk-histogram-og-barchart\\\/\",\"name\":\"Descriptive statistics: histogram and barchart - microdata.no\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\"},\"datePublished\":\"2023-07-18T13:59:54+00:00\",\"dateModified\":\"2023-10-27T15:39:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/deskriptiv-statistikk-histogram-og-barchart\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/deskriptiv-statistikk-histogram-og-barchart\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/deskriptiv-statistikk-histogram-og-barchart\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\\\/\\\/www.microdata.no\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Descriptive statistics: histogram and barchart\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/\",\"name\":\"microdata.no\",\"description\":\"Gj\u00f8r det enklere \u00e5 analysere registerdata\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.microdata.no\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Descriptive statistics: histogram and barchart - microdata.no","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:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/","og_locale":"en_US","og_type":"article","og_title":"Descriptive statistics: histogram and barchart - microdata.no","og_description":"The histogram command is used to display frequency distributions\/value distributions for numerical variables in a graphical way where the values \u200b\u200bare grouped into appropriate intervals and columns are assigned that show the degree of occurrence for each interval. It is possible to control how many columns or how wide the column intervals should be, through...","og_url":"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/","og_site_name":"microdata.no","article_modified_time":"2023-10-27T15:39:19+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/","url":"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/","name":"Descriptive statistics: histogram and barchart - microdata.no","isPartOf":{"@id":"https:\/\/www.microdata.no\/#website"},"datePublished":"2023-07-18T13:59:54+00:00","dateModified":"2023-10-27T15:39:19+00:00","breadcrumb":{"@id":"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.microdata.no\/eksempel\/deskriptiv-statistikk-histogram-og-barchart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/www.microdata.no\/en\/"},{"@type":"ListItem","position":2,"name":"Descriptive statistics: histogram and barchart"}]},{"@type":"WebSite","@id":"https:\/\/www.microdata.no\/#website","url":"https:\/\/www.microdata.no\/","name":"microdata.no","description":"Gj\u00f8r det enklere \u00e5 analysere registerdata","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microdata.no\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"taxonomy_info":[],"featured_image_src_large":[],"author_info":[],"comment_info":"","_links":{"self":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/eksempel\/3537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/eksempel"}],"about":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/types\/eksempel"}],"wp:attachment":[{"href":"https:\/\/www.microdata.no\/en\/wp-json\/wp\/v2\/media?parent=3537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}