Announcement

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

  • Correcting the Standard Errors in a Manual IV Regression

    Hello!

    I'm running an IV regression in Stata on a monthly panel dataset for the Brazilian Amazon. Specifically, at the municipality-level, I am regressing the % vote share for specific candidates in local municipal elections (with observations once every 4 years) on the number of environmental fines in the municipality, using monthly average cloud cover as the instrument. But because electoral observations are every 4 years, I computed this manually - by:

    1) Fixed effects regression of monthly fines on monthly cloud in the first stage of the IV
    2) Save the predicted values
    3) Summing the predicted values for all 4 years before an election (so for the 2012 election, the value for 'predicted fines' would be the sum of all fines from 2008-12)
    4) Fixed effects regression of the % Vote Share on the Sum of Predicted Fines, at the municipality-level

    However, I am aware that using this manual method would result in incorrect standard errors - I've seen the issue raised in other posts, but unfortunately none I have seen have been able to solve this. Could anyone please advise how to correct the standard errors?

    Please find attached sample data and some code below.

    Code:
    clear
    xtset muni_code year_month
    
    /// First Stage:
    xtreg fines_count deter_cloud i.year_month , fe vce(cluster muni_code)
    predict xhat
    bys Concat_MuniCode_ElectPeriod: egen xhat_sum = total(xhat)
    
    /// Second Stage:
    xtreg vote_pct_farmer_council xhat_sum i.year_month , fe vce(cluster muni_code)
    Attached Files
Working...
X