Hi,
I working on the gravity model of international trade, my i= 378, t=14, so I have 5000+ observations. My model is suffering by heteroskedasticity and autocorrelation. Therefore I need to use robust standard errors. I have many time invariant dummies therefore I don´t want to use FE because then very important variables will be omitted from the model (as distance, language, borders...)
I tried POLS, FE, RE as:
xtset i t
xtscc y x1 x2 x3 ....
xtreg y x1 x2 x3...., fe vce(robust)
xtreg y x1 x2 x3...., re cluster(i) or xtgls y x1 x2 x3, panels(correlated) corr(psar1)
Because of LM, RE > POLS and because of BP, FE >POLS. Because of heteroskedasticity, I shouldn´t use standard Hausman test, therefore I tried auxilliary regressions as:
qui xtreg y x1 x2 x3...., re
scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2)
gen in_sample = e(sample)
sort i t
qui foreach var of varlist y x1 x2 x3.... {
by i: egen `var’_bar = mean(`var’) if in_sample
gen `var’_re = `var’ - lambda_hat*`var’_bar if in_sample // GLS-transform
gen `var’_fe = `var’ - `var’_bar if in_sample // within-transform }
But STATA says: "invalid syntax" and I don´t know where is the problem
Threrefore I don´t know, if RE is suitable.
Is there any option how to solve which of these estimations is the best one? If I will have to use FE, is there any way how to keep omitted variables in my model? I think that the gravity model without variables as distance is not gravity model anymore. Therefore I want to keep time invariant variables in the model.
Thank you very much.
My data set looks like .png in the attachment
I working on the gravity model of international trade, my i= 378, t=14, so I have 5000+ observations. My model is suffering by heteroskedasticity and autocorrelation. Therefore I need to use robust standard errors. I have many time invariant dummies therefore I don´t want to use FE because then very important variables will be omitted from the model (as distance, language, borders...)
I tried POLS, FE, RE as:
xtset i t
xtscc y x1 x2 x3 ....
xtreg y x1 x2 x3...., fe vce(robust)
xtreg y x1 x2 x3...., re cluster(i) or xtgls y x1 x2 x3, panels(correlated) corr(psar1)
Because of LM, RE > POLS and because of BP, FE >POLS. Because of heteroskedasticity, I shouldn´t use standard Hausman test, therefore I tried auxilliary regressions as:
qui xtreg y x1 x2 x3...., re
scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2)
gen in_sample = e(sample)
sort i t
qui foreach var of varlist y x1 x2 x3.... {
by i: egen `var’_bar = mean(`var’) if in_sample
gen `var’_re = `var’ - lambda_hat*`var’_bar if in_sample // GLS-transform
gen `var’_fe = `var’ - `var’_bar if in_sample // within-transform }
But STATA says: "invalid syntax" and I don´t know where is the problem
Threrefore I don´t know, if RE is suitable.
Is there any option how to solve which of these estimations is the best one? If I will have to use FE, is there any way how to keep omitted variables in my model? I think that the gravity model without variables as distance is not gravity model anymore. Therefore I want to keep time invariant variables in the model.
Thank you very much.
My data set looks like .png in the attachment
Comment