Announcement

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

  • code for including initial value of the dependent variable as a regresssor

    Dear All,
    I am examining the effect of social spending schemes on income inequality in SA countries. Since inequality in African economies results from historical (colonial), structural, economic, and political factors, I plan to include the initial value of the inequality (dependent variable, GINI coefficient) as a regressor to control the initial difference in inequality among the countries (in a panel data analysis).
    I ran the following STATA code for Unconditional quantile regression. However, I failed to include the initial value of the dependent variable in the regression. Could you suggest how to include it?

    sqreg gini social_protection_Spending lnlnpercapit trade d_gdp inf_cpi unemp government_effctivenss , quantile(.1 .2 .3 .4 .5 .6 .7 .8 .9) reps(800)

    Best

  • #2
    What kind of data do you have? The -sqreg- command is not ideal for use with panel data. If you don't have panel data, then either you already have a variable that gives the initial value of gini in your data set, or, if not, then you need to add such a variable to your data set from whatever data source you are using. Then just add its name to the list of variables preceding the comma. In that context, it's no different from any other covariate.

    If you do have panel data then use -xtqreg- instead: it does fixed-effects estimation of quantile regression. And since the initial value of gini (or of anything else) is inherently a time-invariant attribute of the panel, the fixed-effects estimation automatically adjusts for its effect without you having to do explicitly incorporate it in the model.

    In the future, please do not leave those who want to help you guessing about the organization of your data. This post is twice as long as it needs to be because it has to cover two situations, one of which surely is counterfactual. It is only rarely the case that coding problems can be solved without knowledge of the underlying data and relevant metadata. So when asking for coding help, always show example data, and always use the -dataex- command to do that. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      Dear Clyde Schechter, I thought -sqreg- can be used for panel data analysis.
      Thank you for suggesting the correct code -xtqreg-
      noted for the recommendations. Thanks again.

      Comment

      Working...
      X