Paneldata analysis

Paneldata analysis is an advanced form of linear regression analysis where timedependent variance is adjusted for. This type of analysis has similarities with basic regression analysis (OLS). Among others, the dependent variable (listed first in the regress-panel expression) is required to measure continuous/metrical values only, e.g. income.

The main difference from OLS (the regress command) is the way the data need to be organized: A panel format is required, i.e. all variables are to be measured more than one time depending on the number of measurement dates specified through the import-panel command. A panel dataset will consist of T x N observations/records, where T equals the number of measurment while N represents the population size.

Note: Panel datasets can be very sizeable as each unit is measured more than once, for example by analysing the total population by using 2 measurements the dataset will typically consist of approximately 10 million observations (5 mill. x 2). Thus, use as small populations as necessary, preferably below 1 mill. units. Otherwise the system may be stressed and the executions more timeconsuming as a result.

//Connect to datastore
require no.ssb.fdb:13 as db

//Create panel dataset (should be as small as necessary)
//Population: Individuals who completed a masters degree during the autumn semester 2015
create-dataset population
import db/NUDB_AAR_FORSTE_FULLF_HOV as compl_master
keep if compl_master > 201507 & compl_master < 201601

//Create a new and empty dataset consisting of the units from the population dataset
clone-units population paneldata

//Import a set of variables with specific time measurments into the empty dataset
use paneldata
import-panel db/INNTEKT_WLONN db/SIVSTANDFDT_SIVSTAND db/BEFOLKNING_KOMMNR_FAKTISK 2016-01-01 2017-01-01 2018-01-01 2019-01-01

//Recode and run descriptive and regression analysis
rename INNTEKT_WLONN wage
generate married = 0
replace married = 1 if SIVSTANDFDT_SIVSTAND == '2'
generate oslo = 0
replace oslo = 1 if BEFOLKNING_KOMMNR_FAKTISK == '0301'

tabulate-panel married
tabulate-panel oslo
tabulate-panel married oslo

summarize-panel wage
transitions-panel oslo married

//Execute paneldata regression using fixed and random effects  
regress-panel wage married oslo, fe
regress-panel wage married oslo, re

//Perform hausman-test
hausman wage married oslo