Page 2 of 2

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Sep 09, 2019 12:36 pm
by TomDoan
Understand that NLSYSTEM and SUR (in general) assume that the sigma matrix is unknown and has to be estimated. You're trying to freely estimate a 7 x 7 covariance matrix with 10 data points (and the residuals aren't even full rank to start).

1. That might not work at all (because of the remark in parentheses)
2. Even if it works, the sigma matrix will be so ill-conditioned that the results will be suspect. (SUR/NLSYSTEM uses the inverse of sigma; if sigma is nearly singular, that will throw the estimates off).

You need to come up with a different method for handling that. CV=%IDENTITY(7) will get you preliminary estimates of the coefficients. You would then need to do some type of shrinkage estimator on the covariance matrix to get something usable.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Sep 09, 2019 1:35 pm
by jack
What about using panel data?

I have expenditures of deciles on each commodity. So, I have 100 observations for each each variables.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Sep 09, 2019 3:02 pm
by TomDoan
I really have no idea. Deciles of what? Deciles aren't individuals. You've never answered the question about whether you're taking a model which is supposed to predict individual behavior and applying it across time, or taking a model which is supposed to predict aggregate behavior across time and applying it to individuals. Neither adaptation is likely to be simple.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Tue Sep 10, 2019 1:10 pm
by jack
I want to estimate demand equations for 8 commodities over a ten year period based on the Stone-Geary utility function.
Maximizing this function subject to the expenditure restriction leads to the linear expenditure system:
Image.
Where, p(i,t) is price of commodity i in year t and m(t) is total expenditures on all commodities in year t.

This model is nonlinear in terms of a(i) and u(i).
Fore solving it, first I estimate a(i)'s and then estimate u(i)'s.

A) Estimating a(i)'s

I have the aggregate value of households' expenditures on each commodities over the period. Therefore I have 8 observations for each commodity.
Now, I order households' expenditures for a given commodity in a given year from lowest to highest. Then, I divide the sorted data into ten equal parts, so that each part represents 1/10: 1st expenditure decile to 1oth expenditure decile. Therefore, I have 10 observations for each commodity in each year and 100 observations over the ten year period.
If I treat each expenditure decile as a "section", I can estimate a panel data model for each commodity separately as: C(i,t)=w+a(i)*M(t). [C(i,t) is the i'st expenditure decile in year t on commodity k; M(t) is the total expenditure of deciles in the year t on commodity k]. This is Engel function.
I can estimate a(i)'s for seven commodities in this way and for the last commodity I calculate a(8) as: a(8)=1-a(1)-a(2)-a(3)-a(4)-a(5)-a(6)-a(7).

B) estimating u(i)'s

At first, I substitute estimated a(i)'s from the former section into the linear expenditure system (for two commodities):
Image


and then I estimate u(i)'s using a SUR technique.

My questions:

1) Can can estimate part B in the RATS without getting the error ## REG12. SIGMA Is Singular/Not PSD At Row 7. Too Many Equations for Data Set Size?
2) Can I use a combination of panel data model and SUR for estimating part B?or panel simultaneous equations?

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Tue Sep 10, 2019 2:03 pm
by TomDoan
Is there a literature on estimating this model? If so, what type of data do they use? Offhand, it looks like it's supposed to be for a large number of individuals (which you don't have).

Your described use of "deciles" is clearly very, very wrong---you are grouping data based upon the values of the dependent variable.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Fri Aug 27, 2021 7:33 am
by jack
Dear Tom,
I ,again, want to estimate a Linear Expenditure System based on the Stone-Geary utility function:
Image

There are five groups of commodities over 15 years. I wrote a code (based on consumer.rpf) and run it. Here is the code:
pen data D:\five.xlsx
data(format=xlsx,org=cols) / c1 c2 c3 c4 c5 p1 p2 p3 p4 p5 y
nonlin(parmset=base) mu1 mu2 mu3 mu4 mu5 $
a1 a2 a3 a4 a5

nonlin(parmset=nonnegative) mu1>=0.0 mu2>=0.0 mu3>=0.0 mu4>=0.0 $
mu5>=0.0
nonlin(parmset=summation) a1+a2+a3+a4+a5==1
*
frml fx1 c1 = (1-a1)*mu1*p1+a1*y-a1*mu2*p2+$
-a1*mu3*p3-a1*mu4*p4-a1*mu5*p5
frml fx2 c2 = (1-a2)*mu2*p2+a2*y-a2*mu1*p1+$
-a2*mu3*p3-a2*mu4*p4-a2*mu5*p5
frml fx3 c3 = (1-a3)*mu3*p3+a3*y-a3*mu1*p1+$
-a3*mu2*p2-a3*mu4*p4-a3*mu5*p5
frml fx4 c4 = (1-a4)*mu4*p4+a4*y-a4*mu1*p1+$
-a4*mu2*p2-a4*mu3*p3-a4*mu5*p5

*
compute mu1=mu2=mu3=mu4=mu5=0.0
compute a1=a2=a3=a4=a5=0.0
*
nlsystem(parmset=base+nonnegative+summation,iters=500) / fx1 fx2 fx3 fx4


And here is the result:

Non-Linear System Estimation
Convergence in 474 Iterations. Final criterion was 0.0000000 <= 0.0000100

Usable Observations 15
Log Likelihood -966.6275

Dependent Variable C1
Mean of Dependent Variable 46494219.467
Std Error of Dependent Variable 25002427.493
Standard Error of Estimate 7648651.761
Sum of Squared Residuals 8.77528e+14
Durbin-Watson Statistic 0.9187

Dependent Variable C2
Mean of Dependent Variable 8776947.4667
Std Error of Dependent Variable 3895075.1077
Standard Error of Estimate 1649934.7074
Sum of Squared Residuals 4.08343e+13
Durbin-Watson Statistic 2.1847

Dependent Variable C3
Mean of Dependent Variable 41941281.067
Std Error of Dependent Variable 23558927.974
Standard Error of Estimate 6686228.170
Sum of Squared Residuals 6.70585e+14
Durbin-Watson Statistic 1.6681

Dependent Variable C4
Mean of Dependent Variable 7399545.8667
Std Error of Dependent Variable 3688252.3484
Standard Error of Estimate 1078352.0334
Sum of Squared Residuals 1.74426e+13
Durbin-Watson Statistic 1.1589

Variable Coeff Std Error T-Stat Signif
*************************************************************************************
1. MU1 53169.225864 60007.662267 0.88604 0.37559564
2. MU2 -0.000000 0.000000 0.00000 0.00000000
3. MU3 134204.859039 52688.314835 2.54715 0.01086078
4. MU4 0.000000 0.000000 0.00000 0.00000000
5. MU5 852919.765401 45563.599847 18.71932 0.00000000
6. A1 0.467941 0.016459 28.43130 0.00000000
7. A2 0.092000 0.008779 10.47901 0.00000000
8. A3 0.361248 0.015149 23.84640 0.00000000
9. A4 0.078810 0.007386 10.67004 0.00000000
10. A5 0.000000 0.000000 0.00000 0.00000000

As you can see MU2 and MU4 are zero. Also A5 is zero. Why did I get such a results? What's wrong with it?
I also run the code for four groups of commodities and again MU2 and A4 are zero.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Sun Aug 29, 2021 9:10 am
by jack
Dear Tom,
I really need your help and guide about the above post.

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Aug 30, 2021 8:55 am
by TomDoan
The MU's are zero because of the non-negativity constraint. The A5 can't be estimated separately because of the adding up constraint. (And if you drop to 4 parameters, it would be A4 that isn't estimated).

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Aug 30, 2021 2:48 pm
by jack
Thanks for your kind reply.

But the sum of A1 to A4 is greater than 1 (1) and therefore A5 will be zero ! And MU's are necessary quantities of goods that consumers buy and it is really strange that two of them are negative (out of five groups of commodities) or zero!

Re: Question on Seemingly Unrelated Regression

Unread postPosted: Mon Aug 30, 2021 6:57 pm
by TomDoan
That's if the model is correct for the data. It seems fairly clear that yours aren't. Why are you choosing that particular model?