{"id":1298,"date":"2022-02-14T14:50:48","date_gmt":"2022-02-14T13:50:48","guid":{"rendered":"https:\/\/microdata.spirehost.no\/?post_type=eksempel&#038;p=1298"},"modified":"2023-08-18T13:31:06","modified_gmt":"2023-08-18T12:31:06","slug":"advanced-logistic-regression-analysis","status":"publish","type":"eksempel","link":"https:\/\/www.microdata.no\/en\/eksempel\/advanced-logistic-regression-analysis\/","title":{"rendered":"Advanced logistic regression analysis"},"content":{"rendered":"\n<p>The example illustrates how to proceed in order to analyse the probability of getting a job and earning over NOK 500,000 one year after one is in a state without a job. The age group we are looking at is 16-60.<\/p>\n\n\n\n<p>The analysis checks for various demographic characteristics as well as status on the labour market (unemployed, ordinary labour market measures, vocationally disabled, other jobseeker conditions, as well as work disability).<\/p>\n\n\n\n<p>Some descriptive statistics are first created, and finally a logit analysis including marginal effects is run (the option <code>mfx(dydx)<\/code> used for this).<\/p>\n\n\n\n<p>As can be seen, all explanatory variables have significant estimated coefficient values. The value of Pseudo R2 shows that the model explains approx. 18% of the total variation for the dependent variable. Such values \u200b\u200bare not unusual in socio-economic analyses.<\/p>\n\n\n<div id=\"rose-block_b0e6a1ace2d9b245f2db2e877bb11393\" class=\"rose-code codeblock-wrapper\">\n<pre tabindex=\"0\" class=\"codeblock\"><code>\/\/Connect to database\r\nrequire no.ssb.fdb:23 as db\r\n\r\n\/\/Create population of persons 16-60 \u00e5r without a job in November 2018, and resident in Norway per 1. Januar 2019\r\ncreate-dataset demographydata\r\nimport db\/BEFOLKNING_FOEDSELS_AAR_MND as birth_year_month\r\nimport db\/BEFOLKNING_STATUSKODE 2019-01-01 as regstat\r\nimport db\/REGSYS_ARB_ARBMARK_STATUS 2018-11-16 as labourstat\r\n\r\ngenerate age = 2018 - int(birth_year_month \/ 100)\r\ngenerate job = 0\r\nreplace job = 1 if labourstat == '1' | labourstat == '2'\r\nkeep if age >= 16 & age <= 60 &#038; regstat == '1' &#038; job == 0\r\n\r\nhistogram age, discrete\r\n\r\n\/\/Import relevant variables (demography data are mostly measured per 1\/1 each year)\r\nimport db\/BEFOLKNING_KJOENN as gender\r\nimport db\/BEFOLKNING_INVKAT as imm_cat\r\nimport db\/SIVSTANDFDT_SIVSTAND 2018-11-16 as civstat\r\nimport db\/BEFOLKNING_BARN_I_REGSTAT_FAMNR 2019-01-01 as children\r\nimport db\/NUDB_BU 2018-11-16 as edu\r\nimport db\/NUDB_SOSBAK as social_background\r\nimport db\/BEFOLKNING_KOMMNR_FAKTISK 2019-01-01 as municipality\r\nimport db\/ARBSOEK2001FDT_HOVED 2018-11-16 as work_seeker_stat\r\nimport db\/UFOERP2011FDT_GRAD 2018-11-16 as disability_level\r\nimport db\/INNTEKT_BRUTTOFORM 2018-12-31 as wealth\r\nimport db\/INNTEKT_WYRKINNT 2019-12-31 as work_income19\r\n\r\n\/\/Create a dependent variable with two outcomes (dummy variable): High work income vs. low work income\r\nhistogram work_income19, width(100000) freq\r\nsummarize work_income19\r\ngenerate high_income = 0\r\nreplace high_income = 1 if work_income19 > 500000\r\npiechart high_income\r\n\r\n\/\/Adapt the independent variables so that they suit the statistical model (most of them need to be tranformed into dummy variables)\r\ngenerate male = 0\r\nreplace male = 1 if gender == '1'\r\npiechart male\r\n\r\ndestring civstat\r\ngenerate married = 0\r\nreplace married = 1 if civstat == 2\r\nreplace married = civstat if sysmiss(civstat)\r\npiechart married\r\n\r\ngenerate immigrant = 0\r\nreplace immigrant = 1 if imm_cat == 'B'\r\npiechart immigrant\r\n\r\ntabulate children, missing\r\ngenerate child = 0\r\nreplace child = 1 if children == 1\r\n\r\ngenerate more_children = 0\r\nreplace more_children = 1 if children > 1\r\n\r\ndestring edu\r\ngenerate high_edu = 0\r\nreplace high_edu = 1 if edu >= 700000 & edu < 900000\r\nreplace high_edu = edu if sysmiss(edu)\r\npiechart high_edu\r\n\r\ngenerate high_edu_parents = 0\r\nreplace high_edu_parents = 1 if social_background == '1'\r\npiechart high_edu_parents\r\n\r\ngenerate oslo = 0\r\nreplace oslo = 1 if municipality == '0301'\r\n\r\ngenerate bergen = 0\r\nreplace bergen = 1 if municipality == '1201'\r\n\r\ngenerate stavanger = 0\r\nreplace stavanger = 1 if municipality == '1103'\r\n\r\ngenerate trondheim = 0\r\nreplace trondheim = 1 if municipality == '5001'\r\n\r\nbarchart(sum) oslo bergen stavanger trondheim\r\n\r\ndestring work_seeker_stat\r\ntabulate work_seeker_stat, missing\r\n\r\ngenerate unempl = 0\r\nreplace unempl = 1 if work_seeker_stat == 1\r\n\r\ngenerate measure = 0\r\nreplace measure = 1 if work_seeker_stat == 3\r\n\r\ngenerate voc_disabled = 0\r\nreplace voc_disabled = 1 if work_seeker_stat == 5 | work_seeker_stat >= 10\r\n\r\ngenerate other_workseekers = 0\r\nreplace other_workseekers = 1 if work_seeker_stat == 2 | work_seeker_stat == 4 | work_seeker_stat == 7\r\n\r\ngenerate disabled = 1\r\nreplace disabled = 0 if sysmiss(disability_level)\r\n\r\nbarchart(sum) unempl measure voc_disabled other_workseekers disabled\r\n\r\nhistogram wealth, width(100000) freq\r\nsummarize wealth\r\ngenerate wealth_high = 0\r\nreplace wealth_high = 1 if wealth > 1000000\r\nreplace wealth_high = wealth if sysmiss(wealth)\r\npiechart wealth_high\r\n\r\n\/\/Use sankey diagram to show transitions between states\r\nsankey work_seeker_stat high_income\r\nsankey high_edu high_income\r\n\r\n\/\/Run logit analysis where the dependent variable is allways listed first (needs to be dummy)\r\nlogit high_income male married age immigrant child more_children high_edu high_edu_parents oslo bergen stavanger trondheim unempl measure voc_disabled other_workseekers disabled wealth_high, mfx(dydx)<\/code><\/pre>\n<\/div>","protected":false},"parent":0,"menu_order":123,"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-1298","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>Advanced logistic regression analysis - 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\/avansert-logistisk-regresjonsanalyse\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advanced logistic regression analysis - microdata.no\" \/>\n<meta property=\"og:description\" content=\"The example illustrates how to proceed in order to analyse the probability of getting a job and earning over NOK 500,000 one year after one is in a state without a job. The age group we are looking at is 16-60. The analysis checks for various demographic characteristics as well as status on the labour...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/\" \/>\n<meta property=\"og:site_name\" content=\"microdata.no\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-18T12:31:06+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\\\/avansert-logistisk-regresjonsanalyse\\\/\",\"url\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/avansert-logistisk-regresjonsanalyse\\\/\",\"name\":\"Advanced logistic regression analysis - microdata.no\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/#website\"},\"datePublished\":\"2022-02-14T13:50:48+00:00\",\"dateModified\":\"2023-08-18T12:31:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/avansert-logistisk-regresjonsanalyse\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/avansert-logistisk-regresjonsanalyse\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.microdata.no\\\/eksempel\\\/avansert-logistisk-regresjonsanalyse\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\\\/\\\/www.microdata.no\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced logistic regression analysis\"}]},{\"@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":"Advanced logistic regression analysis - 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\/avansert-logistisk-regresjonsanalyse\/","og_locale":"en_US","og_type":"article","og_title":"Advanced logistic regression analysis - microdata.no","og_description":"The example illustrates how to proceed in order to analyse the probability of getting a job and earning over NOK 500,000 one year after one is in a state without a job. The age group we are looking at is 16-60. The analysis checks for various demographic characteristics as well as status on the labour...","og_url":"https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/","og_site_name":"microdata.no","article_modified_time":"2023-08-18T12:31:06+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\/avansert-logistisk-regresjonsanalyse\/","url":"https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/","name":"Advanced logistic regression analysis - microdata.no","isPartOf":{"@id":"https:\/\/www.microdata.no\/#website"},"datePublished":"2022-02-14T13:50:48+00:00","dateModified":"2023-08-18T12:31:06+00:00","breadcrumb":{"@id":"https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.microdata.no\/eksempel\/avansert-logistisk-regresjonsanalyse\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/www.microdata.no\/en\/"},{"@type":"ListItem","position":2,"name":"Advanced logistic regression analysis"}]},{"@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\/1298","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=1298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}