Hi all,
I am currently working on threshold regression on unbalanced panel data retrieved from World Bank. Please find my initial codes as follows:
I performed some tests on the linear model just to find very little significance of it. My supervisor suggested me to perform threshold regression (using the command xthreg) instead of xtreg. However, whenever I run xthreg, I keep getting the error that it requires balance panel. However, as you can clearly see after running the above codes, it is the nature of WB Data to have many gaps in between (balance panel is nearly impossible). Even if possible (using xtbalance), this will drop a huge amount of valuable data, which is very likely to bias our regression outputs. In my case it generates very little usable information to infer anything.
Has anyone encountered such problems when performing threshold regression? Could you please kindly share your approach to the problem?
Thank you all in advance.
I am currently working on threshold regression on unbalanced panel data retrieved from World Bank. Please find my initial codes as follows:
Code:
clear all cls **# Retrieve Full Raw Data from World Bank wbopendata, country(BRA;CZE;GRC;HUN;MYS;MEX;ZAF;TWN;THA;TUR;CHL;CHN;COL;EGY;ISL;IND;IDN;KWT;PHL;QAT;ROU;SAU;ARE;VNM) indicator(CC.PER.RNK;FD.AST.PRVT.GD.ZS;NY.GDP.PCAP.KD;FP.CPI.TOTL.ZG;NY.GDP.DEFL.KD.ZG;CM.MKT.LCAP.GD.ZS;RQ.PER.RNK;RL.PER.RNK;NE.TRD.GNFS.ZS;SI.POV.GINI) full long clear year(2001:2024) **# Clean and Use Relevant Variables keep countrycode year ny_gdp_pcap_kd fp_cpi_totl_zg cm_mkt_lcap_gd_zs rl_per_rnk ne_trd_gnfs_zs **# Declaration egen country_id = group(countrycode) order country_id, before(countrycode) xtset country_id year **# Remove in-between missing values drop if country_id==6 & year>2017 drop if country_id==12 drop if country_id==13 & year>2014 drop if country_id==17 & year<2009 drop if country_id==18 & year<2012 **# Rename Variables rename ny_gdp_pcap_kd gdp_pc rename fp_cpi_totl_zg inflation rename cm_mkt_lcap_gd_zs smc rename rl_per_rnk rule_law rename ne_trd_gnfs_zs trade_open **# (Natural) logarithmic transformation gen ln_gdp = ln(gdp_pc) gen ln_infl = ln(inflation) gen ln_smc = ln(smc) gen ln_rl = ln(rule_law) gen ln_trade = ln(trade_open) **# Generate First Differences of Variables gen d_smc=d.ln_smc gen d_rl=d.rule_law gen d_gdp=d.ln_gdp gen d_trade=d.trade_open list countrycode year d_smc d_rl inflation d_gdp d_trade, sepby(countrycode)
Has anyone encountered such problems when performing threshold regression? Could you please kindly share your approach to the problem?
Thank you all in advance.
