Hi to the community of Statalist.
I am currently researching for a politics paper. Therefore I use the following very large dataset https://www.v-dem.net/data/v-party-dataset/ in Stata 15.
I try to do a fixed effects regression but my regression either turns out to have no objects (r2000) in the xtreg command or it fails because of the "repeated time values within panel" (r451).
This is where I am so far:
* EU after 2004
keep if country_name == "Austria" | country_name=="Belgium" | country_name=="Bulgaria" | country_name=="Croatia" | country_name=="Cyprus" | country_name=="Czech Republic" | country_name=="Denmark" | country_name=="Estonia" | country_name=="Finland" | country_name=="France" | country_name=="Germany" | country_name=="Greece" | country_name=="Hungary" | country_name=="Ireland" | country_name=="Italy" | country_name=="Latvia" | country_name=="Lithuania" | country_name=="Luxembourg" | country_name=="Malta" | country_name=="Netherlands" | country_name=="Poland" | country_name=="Portugal" | country_name=="Romania" | country_name=="Slovakia" | country_name=="Slovenia" | country_name=="Spain" | country_name=="Sweden"
keep if year >= 2004
* Generate the independent variable - liberal governing party
gen libgov = 0
replace libgov = 1 if v2pagovsup <= 2 & ep_type_populism >= 3
bysort country_id year: replace libgov = libgov[_n-1] if libgov == .
label var libgov "Liberal Governing Party".
* Generate the dependent variable - right wing parties
gen rightwing = 0
replace rightwing = 1 if v2pagovsup >= 2 & ep_type_populism <= 3
bysort country_id year: replace rightwing = rightwing[_n-1] if rightwing == .
label var rightwing "Right Wing Opposition Parties"
* Sort and structure the dataset as a panel data
sort country_id year
drop if year==year[_n-1]
xtset country_id year
* Lag the independent variable by one year for each European state individually
by country_id: gen libgov_lag = L1.libgov
label var libgov_lag "Lagged Liberal Governing Party"
* Control variables - countries, economic politics and societal politics
gen country_controls = country_id
gen econ_politics = v2pariglef
gen soc_politics = ep_v6_lib_cons
label var country_controls "Country Controls"
label var econ_politics "Economic Politics"
label var soc_politics "Societal Politics"
* Check for collinearity using the vif command
* vif libgov_lag country_controls econ_politics soc_politics
* Run the fixed effects regression
xtreg rightwing libgov_lag country_controls econ_politics soc_politics, fe
The marked drop command seems to ruin the regression.
Help is much appreciated! Thank you in advance!
I am currently researching for a politics paper. Therefore I use the following very large dataset https://www.v-dem.net/data/v-party-dataset/ in Stata 15.
I try to do a fixed effects regression but my regression either turns out to have no objects (r2000) in the xtreg command or it fails because of the "repeated time values within panel" (r451).
This is where I am so far:
* EU after 2004
keep if country_name == "Austria" | country_name=="Belgium" | country_name=="Bulgaria" | country_name=="Croatia" | country_name=="Cyprus" | country_name=="Czech Republic" | country_name=="Denmark" | country_name=="Estonia" | country_name=="Finland" | country_name=="France" | country_name=="Germany" | country_name=="Greece" | country_name=="Hungary" | country_name=="Ireland" | country_name=="Italy" | country_name=="Latvia" | country_name=="Lithuania" | country_name=="Luxembourg" | country_name=="Malta" | country_name=="Netherlands" | country_name=="Poland" | country_name=="Portugal" | country_name=="Romania" | country_name=="Slovakia" | country_name=="Slovenia" | country_name=="Spain" | country_name=="Sweden"
keep if year >= 2004
* Generate the independent variable - liberal governing party
gen libgov = 0
replace libgov = 1 if v2pagovsup <= 2 & ep_type_populism >= 3
bysort country_id year: replace libgov = libgov[_n-1] if libgov == .
label var libgov "Liberal Governing Party".
* Generate the dependent variable - right wing parties
gen rightwing = 0
replace rightwing = 1 if v2pagovsup >= 2 & ep_type_populism <= 3
bysort country_id year: replace rightwing = rightwing[_n-1] if rightwing == .
label var rightwing "Right Wing Opposition Parties"
* Sort and structure the dataset as a panel data
sort country_id year
drop if year==year[_n-1]
xtset country_id year
* Lag the independent variable by one year for each European state individually
by country_id: gen libgov_lag = L1.libgov
label var libgov_lag "Lagged Liberal Governing Party"
* Control variables - countries, economic politics and societal politics
gen country_controls = country_id
gen econ_politics = v2pariglef
gen soc_politics = ep_v6_lib_cons
label var country_controls "Country Controls"
label var econ_politics "Economic Politics"
label var soc_politics "Societal Politics"
* Check for collinearity using the vif command
* vif libgov_lag country_controls econ_politics soc_politics
* Run the fixed effects regression
xtreg rightwing libgov_lag country_controls econ_politics soc_politics, fe
The marked drop command seems to ruin the regression.
Help is much appreciated! Thank you in advance!
Comment