Logistic regression analysis

The purpose of logistic regression analysis (logit/probit) is to estimate the effects of a set of explanatory variables on the probability of a certain outcome represented by a dichotomous dependent variable (job/not-jobb, measures/not-measures etc). The output can be adjusted through options (exclude the fixed joint, adjust the level of significance etc).

This example illustrates a basic logit analysis. Alternatively, the probit model can be used if preferred. Multinomial logistic analysis (more than 2 outcomes) can be performed through the commando mlogit.

//Start by importing relevant variables

create-dataset demografidata
import BEFOLKNING_KJOENN as kjonn
import BEFOLKNING_FOEDSELS_AAR_MND as faarmnd
import SIVSTANDFDT_SIVSTAND 2000-01-01 as sivstand
import INNTEKT_BRUTTOFORM 2000-01-01 as formue
import INNTEKT_WYRKINNT 2005-01-01 as innt05

//Create a dependent dichotomous variable (dummy): High vs. low income

generate høyinnt = 0
replace høyinnt = 1 if innt05 > 400000


//Adapt the independent variables to suit the statistical model

generate mann = 0
replace mann = 1 if kjonn == '1'

generate gift = 0
replace gift = 1 if sivstand == '2'

generate alder = 2000 - int(faarmnd / 100)
drop if alder < 16

generate formuehøy = 0
replace formuehøy = 1 if formue > 600000


// Perform logit analysis where the dependent variables is listed first (required)

logit høyinnt mann gift alder formuehøy