Dear Statalisters,
I am running a Panel Data Analysis ((Hausman test) Fixed and Random Effects regression model with a command xtreg including an interaction between two variable that varies within panels - i.e. Ownership_concentration and Lerner index. My panel data is split by banks,countries and years. The variable ownership_concentration has a value for each bank, where the variable Lerner has a value for each country.
I want to obtain the min, max and median using the margins command and evaluate the effect of ownership concentration on bank performance (ratio called EARTA) at the minimum, median and maximum levels of the Lerner index . However, I seem to either miss something in the syntax or STATA is not be unable to estimate what I want. Here is an illustrating example:
I have manually computed the Min, Max and the Median of the marginal effect so firstly I tried to put them manually in stata as follows:
And it didn't work. I also tried the following:
But again without any success. I read the posts for the factor variables, and the example provided by Carlo Lazzaro here - https://www.statalist.org/forums/for...integer-values , however I didn't quite get it how to apply this on my data and convert these variables in "factor variable" in order to run the margins command
I will really appreciate if you can guide me how to run the margins at min, max and median values for my variables as this is the last bit of my paper.
Thank you in advance for the help.
Petko
I am running a Panel Data Analysis ((Hausman test) Fixed and Random Effects regression model with a command xtreg including an interaction between two variable that varies within panels - i.e. Ownership_concentration and Lerner index. My panel data is split by banks,countries and years. The variable ownership_concentration has a value for each bank, where the variable Lerner has a value for each country.
I want to obtain the min, max and median using the margins command and evaluate the effect of ownership concentration on bank performance (ratio called EARTA) at the minimum, median and maximum levels of the Lerner index . However, I seem to either miss something in the syntax or STATA is not be unable to estimate what I want. Here is an illustrating example:
Code:
. xtreg earta ownership_concentration lerner ownconlerner ownconccovid19 lernercovid19 cir nldepstfunding size luqidasset equitytotalassets llptotalloans gdp_growth inflation islamic_d covid19_dummy d_iraq d_bahrain d_syrianarabrepublic d_palestinianterritories d_oman d_tunisia d_yemen d_saudiarabia d_jordan d_kuwait d_iran d_unitedarabemirates d_qatar d_lebanon d_egypt d_morocco d_libya d_algeria d_israel d_malta, fe
note: covid19_dummy omitted because of collinearity
note: d_libya omitted because of collinearity
note: d_malta omitted because of collinearity
Fixed-effects (within) regression Number of obs = 2167
Group variable: y Number of groups = 16
R-sq: within = 0.2803 Obs per group: min = 44
between = 0.4438 avg = 135.4
overall = 0.2340 max = 194
F(32,2119) = 25.79
corr(u_i, Xb) = -0.5324 Prob > F = 0.0000
------------------------------------------------------------------------------------------
earta | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
ownership_concentration | .0059562 .0024705 2.41 0.016 .0011114 .0108009
lerner | .0121662 .0049778 2.44 0.015 .0024043 .0219281
ownconlerner | -.0164077 .0058931 -2.78 0.005 -.0279645 -.0048509
ownconccovid19 | -.0026284 .002828 -0.93 0.353 -.0081743 .0029174
lernercovid19 | -.0015191 .0045828 -0.33 0.740 -.0105063 .007468
cir | -.001471 .0017703 -0.83 0.406 -.0049427 .0020008
nldepstfunding | .0077461 .0014321 5.41 0.000 .0049376 .0105547
size | .0017732 .0002883 6.15 0.000 .0012078 .0023387
luqidasset | .0019798 .0017517 1.13 0.259 -.0014555 .005415
equitytotalassets | .0036689 .0014629 2.51 0.012 .0008001 .0065378
llptotalloans | -.0060658 .0030525 -1.99 0.047 -.012052 -.0000797
gdp_growth | -.0059167 .0060532 -0.98 0.328 -.0177876 .0059542
inflation | .0027875 .0038994 0.71 0.475 -.0048595 .0104345
islamic_d | .0017168 .000785 2.19 0.029 .0001773 .0032564
covid19_dummy | 0 (omitted)
d_iraq | .0075815 .0034456 2.20 0.028 .0008244 .0143387
d_bahrain | .0107113 .0035187 3.04 0.002 .0038108 .0176118
d_syrianarabrepublic | .0118167 .0035673 3.31 0.001 .0048209 .0188125
d_palestinianterritories | .0235419 .0039567 5.95 0.000 .0157824 .0313014
d_oman | .0170214 .003953 4.31 0.000 .0092693 .0247736
d_tunisia | .0157249 .0037031 4.25 0.000 .0084628 .0229869
d_yemen | .0082683 .0051588 1.60 0.109 -.0018486 .0183851
d_saudiarabia | .0164683 .0039985 4.12 0.000 .0086269 .0243098
d_jordan | .0235108 .0036057 6.52 0.000 .0164397 .0305818
d_kuwait | .0112048 .0040661 2.76 0.006 .0032308 .0191789
d_iran | -.0062299 .003572 -1.74 0.081 -.013235 .0007751
d_unitedarabemirates | .0174788 .0039005 4.48 0.000 .0098297 .025128
d_qatar | .012014 .004056 2.96 0.003 .0040599 .0199681
d_lebanon | .0123726 .0032784 3.77 0.000 .0059433 .0188019
d_egypt | .026163 .0033168 7.89 0.000 .0196585 .0326676
d_morocco | .0221602 .0036586 6.06 0.000 .0149854 .0293351
d_libya | 0 (omitted)
d_algeria | .0227315 .0041034 5.54 0.000 .0146845 .0307785
d_israel | .0120014 .0035523 3.38 0.001 .0050351 .0189677
d_malta | 0 (omitted)
_cons | -.0161335 .0041132 -3.92 0.000 -.0241998 -.0080673
-------------------------+----------------------------------------------------------------
sigma_u | .00430835
sigma_e | .01308236
rho | .09784356 (fraction of variance due to u_i)
------------------------------------------------------------------------------------------
F test that all u_i=0: F(15, 2119) = 3.55 Prob > F = 0.0000
Code:
. margins ownership_concentration, at( ownconlerner=(0.0009 (-0.0044335964044118) -0.00740213039667478)) ownership_concentration: factor variables may not contain noninteger values r(452);
Code:
. margins , dydx( ownership_concentration ownconlerner)
Average marginal effects Number of obs = 2167
Model VCE : Conventional
Expression : Linear prediction, predict()
dy/dx w.r.t. : ownership_concentration ownconlerner
-----------------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
------------------------+----------------------------------------------------------------
ownership_concentration | .0059562 .0024705 2.41 0.016 .0011141 .0107982
ownconlerner | -.0164077 .0058931 -2.78 0.005 -.0279579 -.0048575
-----------------------------------------------------------------------------------------
. summarize ownership_concentration
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
ownership~on | 2167 .4421175 .2853384 .0025035 1
.
. local min = r(min)
.
. local max = r(max)
.
. local mean = r(mean)
. margins ownconlerner, at ( ownership_concentration = (`min' `mean' `max'))
ownconlerner: factor variables may not contain noninteger values
r(452);
I will really appreciate if you can guide me how to run the margins at min, max and median values for my variables as this is the last bit of my paper.
Thank you in advance for the help.
Petko

Comment