Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SWIID data and unbalanced panel data analysis

    Hello,

    I am using SWIID data set to explore how inequality affect economic growth(measured by GDP per capita) using panel data analysis, but I encounter several problems. I will first show my code and analysis steps.

    //step1 generate GINI coefficient using SWIID following Prof. Solt's instruction code
    cd C:\data
    using SWIIDv5_1
    use SWIIDv5_1.dta, clear
    // Summarize the dataset
    keep country year _*
    foreach v in gini_net gini_market rel_red abs_red {
    egen `v' = rowmean(_*`v')
    egen `v'_se = rowsd(_*`v')
    gen `v'_95ub = `v' + 1.96*`v'_se
    gen `v'_95lb = `v' - 1.96*`v'_se
    }
    drop _*
    sort country year

    save gini


    //step2 retrieving GDP per capita
    set more off
    wbopendata, indicator(NY.GDP.PCAP.CD) long clear
    rename countryname country
    rename ny_gdp_pcap_cd gdppc
    save gdppc

    //step3 merge GINI and GDP per capita accroding to country and year
    use gini
    merge 1:1 country year using gdppc
    keep if _merge==3
    drop _merge
    save ginigdppc
    //I get an unbalanced panel data of gini and GDP per capita
    encode country, gen(c)
    xtset c year

    /* no; data are mi set
    Use mi xtset to set or query these data; mi xtset has the same syntax as
    xtset.

    Perhaps you did not type xtset. Some commands call xtset to obtain
    information about the settings. In that case, that command is not
    appropriate for running directly on mi data. Use mi extract to select
    the data on which you want to run the command, which is probably m=0.
    r(119); */

    mi xtset x year

    /*
    panel variable: c (unbalanced)
    time variable: year, 1960 to 2015, but with gaps
    delta: 1 unit

    */

    mi xtdes
    /*
    mi xtdes
    subcommand mi xtdes is unrecognized
    */
    How to deal with it? everytime I xtset or xtdes, Stata said I should use mi xtset, but even I have used mi xtset the data as panel data, I cannot use xtdes or xtreg command afterwards.
    Could you please tell me
    1. how to deal with unbalanced data
    2. how to deal with SWIID mi, since it always shows that the data is multiple inputated. But I am using the official instruction provided by Prof. Solt, the author of SWIID.
    Last edited by Zhicheng Wang; 21 Mar 2017, 14:43.
Working...
X