+-------+ ----+ Title +------------------------------------------------------------
xtregsam: Swamy-Arora Random-Effects Panel Data Regression
+-------------------+ ----+ Table of Contents +------------------------------------------------
Syntax Description Options Ridge Options Weight Options Weighted Variable Type Options Other Options Model Selection Diagnostic Criteria Heteroscedasticity Tests Saved Results References
*** Examples
Author
+--------+ ----+ Syntax +-----------------------------------------------------------
xtregsam depvar indepvars [if] [in] , id(var) it(var) [ ridge(orr|grr1|grr2|grr3) kr(#) lmhet diag mfx(lin|log) predict(new_var) resid(new_var) weights(yh|yh2|abse|e2|le2|x|xi|x2|xi2) wvar(varname) iter(#) noconstant coll dn tolog level(#) ]
+-------------+ ----+ Description +------------------------------------------------------
xtregsam estimates Swamy-Arora Random-Effects Panel Data with Ridge and Weighted Regression, and calculate Panel Heteroscedasticity, Model Selection Diagnostic Criteria, and Marginal Effects and Elasticities
R2, R2 Adjusted, and F-Test, are obtained from 4 ways: 1- (Buse 1973) R2. 2- Raw Moments R2. 3- squared correlation between predicted (Yh) and observed dependent variable (Y). 4- Ratio of variance between predicted (Yh) and observed dependent variable (Y).
- Adjusted R2: R2_a=1-(1-R2)*(N-1)/(N-K-1). - F-Test=R2/(1-R2)*(N-K-1)/(K).
+---------+ ----+ Options +----------------------------------------------------------
* id(var) Cross Sections ID variable name * it(var) Time Series ID variable name
+---------------+ ----+ Ridge Options +----------------------------------------------------
kr(#) Ridge k value, must be in the range (0 < k < 1).
IF kr(0) in ridge(orr, grr1, grr2, grr3), the model will be normal panel regression.
ridge(orr) : Ordinary Ridge Regression [Judge,et al(1988,p.878) eq.21.4.2] > . ridge(grr1): Generalized Ridge Regression [Judge,et al(1988,p.881) eq.21.4.12 > ]. ridge(grr2): Iterative Generalized Ridge [Judge,et al(1988,p.881) eq.21.4.12 > ]. ridge(grr3): Adaptive Generalized Ridge [Strawderman(1978)].
xtregsam estimates Ordinary Ridge regression as a multicollinearity remediation method. General form of Ridge Coefficients and Covariance Matrix are:
Br = inv[X'X + kI] X'Y
Cov=Sig^2 * inv[X'X + kI] (X'X) inv[X'X + kI]
where: Br = Ridge Coefficients Vector (k x 1). Cov = Ridge Covariance Matrix (k x k). Y = Dependent Variable Vector (N x 1). X = Independent Variables Matrix (N x k). k = Ridge Value (0 < k < 1). I = Diagonal Matrix of Cross Product Matrix (Xs'Xs). Xs = Standardized Variables Matrix in Deviation from Mean. Sig2 = (Y-X*Br)'(Y-X*Br)/DF
+----------------+ ----+ Weight Options +---------------------------------------------------
wvar(varname) Weighted Variable Name
xtregsam not like official Stata command xtreg in weight option, xtregsam can use large types of weighted regression options. wvar( ) must be combined with: weights(x, xi, x2, xi2)"
+--------------------------------+ ----+ Weighted Variable Type Options +-----------------------------------
weights(yh) Yh - Predicted Value weights(yh2) Yh^2 - Predicted Value Squared weights(abse) abs(E) - Absolute Value of Residual weights(e2) E^2 - Residual Squared weights(le2) log(E^2) - Log Residual Squared weights(x) (x) Variable weights(xi) (1/x) Inverse Variable weights(x2) (x^2) Squared Variable weights(xi2) (1/x^2) Inverse Squared Variable
+---------------+ ----+ Other Options +----------------------------------------------------
coll keep collinear variables; default is removing collinear vari > ables.
noconstant Exclude Constant Term from Equation
xtregsam not like official Stata command xtreg in constant t > erm option, xtregsam can exclude constant term. weights option also can be used here.
dn Use (N) divisor instead of (N-K) for Degrees of Freedom (DF)
iter(#) number of iterations; Default is iter(100)
level(#) confidence intervals level. Default is level(95)
mfx(lin, log) functional form: Linear model (lin), or Log-Log model (log), to compute Marginal Effects and Elasticities - In Linear model: marginal effects are the coefficients (Bm), and elasticities are (Es = Bm X/Y). - In Log-Log model: elasticities are the coefficients (Es), and the marginal effects are (Bm = Es Y/X). - mfx(log) and tolog options must be combined, to transform linear variables > to log form.
tolog Convert dependent and independent variables to LOG Form in the memory for Log-Log regression. tolog Transforms depvar and indepvars to Log Form without lost the original data variables
predict(new_variable) Predicted values variable
resid(new_variable) Residuals values variable computed as Ue=Y-Yh ; that is known as combined residual: [Ue = > U_i + E_it] overall error component is computed as: [E_it] see: xtreg postestimation##predict
+-------------------------------------+ ----+ Model Selection Diagnostic Criteria +------------------------------
diag Model Selection Diagnostic Criteria: - Log Likelihood Function LLF - Akaike Information Criterion (1974) AIC - Akaike Information Criterion (1973) Log AIC - Schwarz Criterion (1978) SC - Schwarz Criterion (1978) Log SC - Amemiya Prediction Criterion (1969) FPE - Hannan-Quinn Criterion (1979) HQ - Rice Criterion (1984) Rice - Shibata Criterion (1981) Shibata - Craven-Wahba Generalized Cross Validation (1979) GCV
+------------------------------------------+ ----+ Groupwise Panel Heteroscedasticity Tests +------------------------- lmhet Groupwise Panel Heteroscedasticity Tests: * Ho: Panel Homoscedasticity - Ha: Panel Groupwise Heteroscedasticity - Lagrange Multiplier LM Test - Likelihood Ratio LR Test - Wald Test
+---------------+ ----+ Saved Results +----------------------------------------------------
xtregsam saves the following results in e():
*** Model Selection Diagnostic Criteria: e(N) number of observations e(r2bu) R-squared (Buse 1973) e(r2bu_a) R-squared Adj (Buse 1973) e(r2raw) Raw Moments R2 e(r2raw_a) Raw Moments R2 Adj e(f) F-test e(fp) F-test P-Value e(wald) Wald-test e(waldp) Wald-test P-Value
e(r2h) R2 Between Predicted (Yh) and Observed DepVar (Y) e(r2h_a) Adjusted r2h e(fh) F-test due to r2h e(fhp) F-test due to r2h P-Value
e(r2v) R2 Variance Ratio Between Predicted (Yh) and Observed DepVar > (Y) e(r2v_a) Adjusted r2v e(fv) F-test due to r2v e(fvp) F-test due to r2v P-Value
e(sig) Root MSE (Sigma) e(llf) Log Likelihood Function LLF e(aic) Akaike Information Criterion (1974) AIC e(laic) Akaike Information Criterion (1973) Log AIC e(sc) Schwarz Criterion (1978) SC e(lsc) Schwarz Criterion (1978) Log SC e(fpe) Amemiya Prediction Criterion (1969) FPE e(hq) Hannan-Quinn Criterion (1979) HQ e(rice) Rice Criterion (1984) Rice e(shibata) Shibata Criterion (1981) Shibata e(gcv) Craven-Wahba Generalized Cross Validation (1979) GCV
*** Groupwise Heteroscedasticity Tests: e(lmhglm) Lagrange Multiplier LM Test e(lmhglmp) Lagrange Multiplier LM Test P-Value e(lmhglr) Likelihood Ratio LR Test e(lmhglrp) Likelihood Ratio LR Test P-Value e(lmhgw) Wald Test e(lmhgwp) Wald Test P-Value
Matrixes e(b) coefficient vector e(V) variance-covariance matrix of the estimators e(mfxlin) Marginal Effect and Elasticity in Lin Form e(mfxlog) Marginal Effect and Elasticity in Log Form
+------------+ ----+ References +-------------------------------------------------------
Breusch, Trevor & Adrian Pagan (1980) "The Lagrange Multiplier Test and its Applications to Model Specification in Econometrics", Review of Economic Studies 47; 239-253.
Greene, William (2007) "Econometric Analysis", 6th ed., Macmillan Publishing Company Inc., New York, USA..
Judge, Georege, R. Carter Hill, William . E. Griffiths, Helmut Lutkepohl, & Tsoung-Chao Lee (1988) "Introduction To The Theory And Practice Of Econometrics", 2nd ed., John Wiley & Sons, Inc., New York, USA.
Judge, Georege, W. E. Griffiths, R. Carter Hill, Helmut Lutkepohl, & Tsoung-Chao Lee(1985) "The Theory and Practice of Econometrics", 2nd ed., John Wiley & Sons, Inc., New York, USA.
Swamy, P.A.V.B. (1970) "Efficient Inference in a Random Coefficient Regression Model" Econometrica 38; 311-323.
Swamy, P.A.V.B. & S.S. Arora (1972) "The Exact Finite Sample Properties of the Estimators of Coefficients in the Error Components Regression Models", Econometrica, 40; 261–275.
+----------+ ----+ Examples +---------------------------------------------------------
clear all
sysuse xtregsam.dta, clear
db xtregsam
xtregsam y x1 x2 , id(id) it(t) mfx(lin) predict(Yh) resid(Eu) diag lmh
xtregsam y x1 x2 , id(id) it(t) mfx(log) predict(Yh) resid(Eu) diag lmh tolog
xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(orr) kr(0.5)
xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(grr1)
xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(grr2)
xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(grr3)
xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(grr1) weight(x) wvar(x1) diag > lmh -------------------------------------------------------------------------------
. clear all . sysuse xtregsam.dta, clear . xtregsam y x1 x2 , id(id) it(t) mfx(lin) ridge(grr1) weight(x) wvar(x1) diag > lmh
============================================================================== * Swamy-Arora Random-Effects Panel Data: Ridge and Weighted Regression ============================================================================== y = x1 + x2 ------------------------------------------------------------------------------ * Weighted Regression Type: (X) - Variable: (x1) * ------------------------------------------------------------------------------ Ridge k Value = 0.07455 | Generalized Ridge Regression ------------------------------------------------------------------------------ Sample Size = 49 | Cross Sections Number = 7 Wald Test = 4101.4361 | P-Value > Chi2(2) = 0.0000 F-Test = 2050.7181 | P-Value > F(2 , 40) = 0.0000 (Buse 1973) R2 = 0.7394 | Raw Moments R2 = 0.9519 (Buse 1973) R2 Adj = 0.6873 | Raw Moments R2 Adj = 0.9422 Root MSE (Sigma) = 8.6794 | Log Likelihood Function = -170.4428 ------------------------------------------------------------------------------ - R2h= 0.5516 R2h Adj= 0.4620 F-Test = 28.30 P-Value > F(2 , 40) 0.0000 - R2v= 0.4338 R2v Adj= 0.3206 F-Test = 17.62 P-Value > F(2 , 40) 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | -.2667096 .0095986 -27.79 0.000 -.2861092 -.24731 x2 | -1.350062 .0327156 -41.27 0.000 -1.416183 -1.283941 _cons | 64.33976 .5427087 118.55 0.000 63.24291 65.43662 ------------------------------------------------------------------------------
============================================================================== * Panel Model Selection Diagnostic Criteria ==============================================================================
- Log Likelihood Function LLF = -170.4428 - Akaike Final Prediction Error AIC = 346.8855 - Schwartz Criterion SC = 352.5610 - Akaike Information Criterion ln AIC = 4.2414 - Schwarz Criterion ln SC = 4.3572 - Amemiya Prediction Criterion FPE = 79.9447 - Hannan-Quinn Criterion HQ = 72.6289 - Rice Criterion Rice = 70.0767 - Shibata Criterion Shibata = 69.0260 - Craven-Wahba Generalized Cross Validation-GCV = 69.7787 ------------------------------------------------------------------------------
============================================================================== * Panel Groupwise Heteroscedasticity Tests ============================================================================== Ho: Panel Homoscedasticity - Ha: Panel Groupwise Heteroscedasticity
- Lagrange Multiplier LM Test = 7.3373 P-Value > Chi2(6) 0.2908 - Likelihood Ratio LR Test = 7.1253 P-Value > Chi2(6) 0.3094 - Wald Test = 12.4812 P-Value > Chi2(7) 0.0858 ------------------------------------------------------------------------------
* Linear: Marginal Effect - Elasticity *
+-----------------------------------------------------------------------------+ | Variable | Marginal_Effect(B) | Elasticity(Es) | Mean | |--------------+--------------------+--------------------+--------------------| | x1 | -0.2667 | -0.2918 | 38.4362 | | x2 | -1.3501 | -0.5525 | 14.3749 | +-----------------------------------------------------------------------------+ Mean of Dependent Variable = 35.1288
+--------+ ----+ Author +-----------------------------------------------------------
Emad Abd Elmessih Shehata Professor (PhD Economics) Agricultural Research Center - Agricultural Economics Research Institute - Eg > ypt Email: emadstat@hotmail.com WebPage: http://emadstat.110mb.com/stata.htm WebPage at IDEAS: http://ideas.repec.org/f/psh494.html WebPage at EconPapers: http://econpapers.repec.org/RAS/psh494.htm
+-------------------+ ----+ XTREGSAM Citation +------------------------------------------------
Shehata, Emad Abd Elmessih (2012) XTREGSAM: "Swamy-Arora Random-Effects Panel Data: Ridge and Weighted Regression"
http://ideas.repec.org/c/boc/bocode/s457460.html
http://econpapers.repec.org/software/bocbocode/s457460.htm
Online Help:
* Econometric Regression Models:
* (1) (OLS) * Ordinary Least Squares Regression Models: olsreg OLS Econometric Ridge & Weighted Regression Models: Stata Module Too > lkit ridgereg OLS Ridge Regression Models gmmreg OLS Generalized Method of Moments (GMM): Ridge & Weighted Regression chowreg OLS Structural Change Regressions and Chow Test --------------------------------------------------------------------------- * (2) (2SLS-IV) * Two-Stage Least Squares & Instrumental Variables Regression M > odels: reg2 2SLS-IV Econometric Ridge & Weighted Regression Models: Stata Module > Toolkit gmmreg2 2SLS-IV Generalized Method of Moments (GMM): Ridge & Weighted Regres > sion limlreg2 Limited-Information Maximum Likelihood (LIML) IV Regression meloreg2 Minimum Expected Loss (MELO) IV Regression ridgereg2 Ridge 2SLS-LIML-GMM-MELO-Fuller-kClass IV Regression ridge2sls Two-Stage Least Squares Ridge Regression ridgegmm Generalized Method of Moments (GMM) IV Ridge Regression ridgeliml Limited-Information Maximum Likelihood (LIML) IV Ridge Regression ridgemelo Minimum Expected Loss (MELO) IV Ridge Regression --------------------------------------------------------------------------- * (3) * Panel Data Regression Models: regxt Panel Data Econometric Ridge & Weighted Regression Models: Stata Mod > ule Toolkit xtregdhp Han-Philips (2010) Linear Dynamic Panel Data Regression xtregam Amemiya Random-Effects Panel Data: Ridge & Weighted Regression xtregbem Between-Effects Panel Data: Ridge & Weighted Regression xtregbn Balestra-Nerlove Random-Effects Panel Data: Ridge & Weighted Regress > ion xtregfem Fixed-Effects Panel Data: Ridge & Weighted Regression xtregmle Trevor Breusch MLE Random-Effects Panel Data: Ridge & Weighted Regre > ssion xtregrem Fuller-Battese GLS Random-Effects Panel Data: Ridge & Weighted Regre > ssion xtregsam Swamy-Arora Random-Effects Panel Data: Ridge & Weighted Regression xtregwem Within-Effects Panel Data: Ridge & Weighted Regression xtregwhm Wallace-Hussain Random-Effects Panel Data: Ridge & Weighted Regressi > on xtreghet MLE Random-Effects Multiplicative Heteroscedasticity Panel Data Regr > ession --------------------------------------------------------------------------- * (4) (MLE) * Maximum Likelihood Estimation Regression Models: mlereg MLE Econometric Regression Models: Stata Module Toolkit mleregn MLE Normal Regression mleregln MLE Log Normal Regression mlereghn MLE Half Normal Regression mlerege MLE Exponential Regression mleregle MLE Log Exponential Regression mleregg MLE Gamma Regression mlereglg MLE Log Gamma Regression mlereggg MLE Generalized Gamma Regression mlereglgg MLE Log Generalized Gamma Regression mleregb MLE Beta Regression mleregev MLE Extreme Value Regression mleregw MLE Weibull Regression mlereglw MLE Log Weibull Regression mleregilg MLE Inverse Log Gauss Regression --------------------------------------------------------------------------- * (5) * Autocorrelation Regression Models: autoreg Autoregressive Least Squares Regression Models: Stata Module Toolkit alsmle Beach-Mackinnon AR(1) Autoregressive Maximum Likelihood Estimation R > egression automle Beach-Mackinnon AR(1) Autoregressive Maximum Likelihood Estimation R > egression autopagan Pagan AR(p) Conditional Autoregressive Least Squares Regression autoyw Yule-Walker AR(p) Unconditional Autoregressive Least Squares Regress > ion autopw Prais-Winsten AR(p) Autoregressive Least Squares Regression autoco Cochrane-Orcutt AR(p) Autoregressive Least Squares Regression autofair Fair AR(1) Autoregressive Least Squares Regression --------------------------------------------------------------------------- * (6) * Heteroscedasticity Regression Models: hetdep MLE Dependent Variable Heteroscedasticity hetmult MLE Multiplicative Heteroscedasticity Regression hetstd MLE Standard Deviation Heteroscedasticity Regression hetvar MLE Variance Deviation Heteroscedasticity Regression glsreg Generalized Least Squares Regression --------------------------------------------------------------------------- * (7) * Non Normality Regression Models: robgme MLE Robust Generalized Multivariate Error t Distribution bcchreg Classical Box-Cox Multiplicative Heteroscedasticity Regression bccreg Classical Box-Cox Regression bcereg Extended Box-Cox Regression --------------------------------------------------------------------------- * (8) (NLS) * Nonlinear Least Squares Regression Regression Models: autonls Non Linear Autoregressive Least Squares Regression qregnls Non Linear Quantile Regression --------------------------------------------------------------------------- * (9) * Logit Regression Models: logithetm Logit Multiplicative Heteroscedasticity Regression mnlogit Multinomial Logit Regression --------------------------------------------------------------------------- * (10) * Probit Regression Models: probithetm Probit Multiplicative Heteroscedasticity Regression mnprobit Multinomial Probit Regression --------------------------------------------------------------------------- * (11) * Tobit Regression Models: tobithetm Tobit Multiplicative Heteroscedasticity Regression ---------------------------------------------------------------------------
Panel Data Tests:
* (1) * Autocorrelation Tests: lmaxt Panel Data Autocorrelation Tests lmabxt Panel Data Autocorrelation Baltagi Test lmabgxt Panel Data Autocorrelation Breusch-Godfrey Test lmabpxt Panel Data Autocorrelation Box-Pierce Test lmabpgxt Panel Data Autocorrelation Breusch-Pagan-Godfrey Test lmadurhxt Panel Data Autocorrelation Dynamic Durbin h and Harvey LM Tests lmadurmxt Panel Data Autocorrelation Dynamic Durbin m Test lmadwxt Panel Data Autocorrelation Durbin-Watson Test lmavonxt Panel Data Von Neumann Ratio Autocorrelation Test lmawxt Panel Data Autocorrelation Wooldridge Test lmazxt Panel Data Autocorrelation Z Test --------------------------------------------------------------------------- * (2) * Heteroscedasticity Tests: lmhxt Panel Data Heteroscedasticity Tests lmhgwxt Panel Data Groupwise Heteroscedasticity Tests ghxt Panel Groupwise Heteroscedasticity Tests lmhlmxt Panel Data Groupwise Heteroscedasticity Breusch-Pagan LM Test lmhlrxt Panel Data Groupwise Heteroscedasticity Greene LR Test lmharchxt Panel Data Heteroscedasticity Engle (ARCH) Test lmhcwxt Panel Data Heteroscedasticity Cook-Weisberg Test lmhglxt Panel Data Heteroscedasticity Glejser Test lmhharvxt Panel Data Heteroscedasticity Harvey Test lmhhpxt Panel Data Heteroscedasticity Hall-Pagan Test lmhmssxt Panel Data Heteroscedasticity Machado-Santos-Silva Test lmhwaldxt Panel Data Heteroscedasticity Wald Test lmhwhitext Panel Data Heteroscedasticity White Test --------------------------------------------------------------------------- * (3) * Non Normality Tests: lmnxt Panel Data Non Normality Tests lmnadxt Panel Data Non Normality Anderson-Darling Test lmndhxt Panel Data Non Normality Doornik-Hansen Test lmndpxt Panel Data Non Normality D'Agostino-Pearson Test lmngryxt Panel Data Non Normality Geary Runs Test lmnjbxt Panel Data Non Normality Jarque-Bera Test lmnwhitext Panel Data Non Normality White Test --------------------------------------------------------------------------- * (4) * Panel Data Error Component Tests: lmecxt Panel Data Error Component Tests --------------------------------------------------------------------------- * (5) * Panel Data Diagonal Covariance Matrix Test: lmcovxt Panel Data Breusch-Pagan Diagonal Covariance Matrix LM Test --------------------------------------------------------------------------- * (6) * Panel Data ModeL Selection Diagnostic Criteria: diagxt Panel Data ModeL Selection Diagnostic Criteria --------------------------------------------------------------------------- * (7) * Panel Data Specification Tests: lmhausxt Panel Data Hausman Specification Test resetxt Panel Data REgression Specification Error Tests (RESET) --------------------------------------------------------------------------- * (8) * Panel Data Identification Variables: idt Create Identification Variables in Panel Data xtidt Create Identification Variables in Panel Data ---------------------------------------------------------------------------