Dear tom,

I want to estimate a Linear Expenditure System based on the Stone-Geary utility function:

where: demand for commodity i; marginal expenditure share with ; and minimum quantity demanded from commodity i.

Maximizing this function subject to the expenditure restriction where is price of commodity i and m is total expenditure, leads to the linear expenditure system:

.

Time series form of the above equation is:

.

At first, I estimate by using the Engel function as: .

And after estimation of , I plug it into the above equation and finally I estimate the above equation by SUR.

But I don’t know how to estimate it in RATS by SUR. I don't know how to write a program for it in RATS.

I would be grateful if you could possibly guide me through it.

I want to estimate a Linear Expenditure System based on the Stone-Geary utility function:

where: demand for commodity i; marginal expenditure share with ; and minimum quantity demanded from commodity i.

Maximizing this function subject to the expenditure restriction where is price of commodity i and m is total expenditure, leads to the linear expenditure system:

.

Time series form of the above equation is:

.

At first, I estimate by using the Engel function as: .

And after estimation of , I plug it into the above equation and finally I estimate the above equation by SUR.

But I don’t know how to estimate it in RATS by SUR. I don't know how to write a program for it in RATS.

I would be grateful if you could possibly guide me through it.

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

Sorry. If you have the alpha's, what are the parameters to be estimated?

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

Thank you for your kind reply.

I want to derive demand functions and therefore cost functions for n commodities. The utility function is the Stone-Geary utility function. Maximizing utility function with respect to budget constrain leads to the linear expenditure system:

As you see, each equation has two parameters: and . In the first step, I use an Engel function (a panel model) for estimating : .

Then I use obtained from the first step in the linear expenditure system and obtain parameter via SUR method.

But I don’t know how to write a SUR program in RATS.

I want to derive demand functions and therefore cost functions for n commodities. The utility function is the Stone-Geary utility function. Maximizing utility function with respect to budget constrain leads to the linear expenditure system:

As you see, each equation has two parameters: and . In the first step, I use an Engel function (a panel model) for estimating : .

Then I use obtained from the first step in the linear expenditure system and obtain parameter via SUR method.

But I don’t know how to write a SUR program in RATS.

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

Use NLSYSTEM, not SUR.

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

Dear Tom,

As you know, it is really beyond my ability to write a program for it. I used to sue a kind of prototype one and adjust it according to my problem as I did with respect to MVGARCH and VAR models in the past.

It would be really kind of you to guide and help me in writing a model for it.

As you know, it is really beyond my ability to write a program for it. I used to sue a kind of prototype one and adjust it according to my problem as I did with respect to MVGARCH and VAR models in the past.

It would be really kind of you to guide and help me in writing a model for it.

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

consumer.rpf is the closest thing we have to that. It doesn't look like it's all that difficult---you almost literally just write down the FRML's that match your equations. You just need to add a mu>=0 to your PARMSET to force the mu's to be non-negative.

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

I installed winRATS standard 9.2. But I can't find consumer.wks. How I can find it?

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

With the program files (including consumer.rpf) in your Examples and Procedures folder.

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

Dear Tom,

with two commodities, the linear expenditure system will be as follow:

I have data on p*x, p and m.

Is it possible to estimate alpha and mu with a program like consumer.rft? Because the first term in right hand sides of each equation is multiplication of alpha with mu.

with two commodities, the linear expenditure system will be as follow:

I have data on p*x, p and m.

Is it possible to estimate alpha and mu with a program like consumer.rft? Because the first term in right hand sides of each equation is multiplication of alpha with mu.

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

Sure. That's the whole point of doing it with NLSYSTEM rather than SUR. Your model is linear in the observables, but not linear in the parameters. Also, it's not "seemingly unrelated" anyway---the mu's show up in both equations so they're very much related.

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

I wrote a code (based on consumer.rpf) and run it but I received this error from RATS:

## REG12. SIGMA Is Singular/Not PSD At Row 8. Too Many Equations for Data Set Size?

This is the code:

## REG12. SIGMA Is Singular/Not PSD At Row 8. Too Many Equations for Data Set Size?

This is the code:

- Code: Select all
`open data C:\les1.xlsx`

data(format=xlsx,org=cols) / c1 c2 c3 c4 c5 c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*p5-a8*mu6*p6-a8*mu7*p7

*

compute mu1=mu2=mu3=mu4=mu5=mu6=mu7=mu8=0.0

compute a1=a2=a3=a4=a5=a6=a7=a8=0.0

*

nlsystem(parmset=base+nonnegative+summation,iters=500) / fx1 fx2 fx3 fx4 fx5 fx6 fx7 fx8

*

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

Can you estimate all 8? Most demands systems have an adding up constraint so you can also estimate N-1.

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

I deleted equation 8 but I again got the error:

## REG12. SIGMA Is Singular/Not PSD At Row 7. Too Many Equations for Data Set Size?

## REG12. SIGMA Is Singular/Not PSD At Row 7. Too Many Equations for Data Set Size?

- Code: Select all
`open data C:\Users\LapTop118\Desktop\les1.xlsx`

data(format=xlsx,org=cols) / c1 c2 c3 c4 c5 c6 c7 c8 p1 p2 p3 p4 p5 p6 p7 p8 m

nonlin(parmset=base) mu1 mu2 mu3 mu4 mu5 mu6 mu7 mu8 $

a1 a2 a3 a4 a5 a6 a7 a8

nonlin(parmset=nonnegative) mu1>=0.0 mu2>=0.0 mu3>=0.0 mu4>=0.0 $

mu5>=0.0 mu6>=0.0 mu7>=0.0 mu8>=0.0

nonlin(parmset=summation) a1+a2+a3+a4+a5+a6+a7+a8==1

*

frml fx1 c1 = (1-a1)*mu1*p1+a1*m-a1*mu2*p2+$

-a1*mu3*p3-a1*mu4*p4-a1*mu5*p5-a1*mu6*p6-a1*mu7*p7-a1*mu8*p8

frml fx2 c2 = (1-a2)*mu2*p2+a2*m-a2*mu1*p1+$

-a2*mu3*p3-a2*mu4*p4-a2*mu5*p5-a2*mu6*p6-a2*mu7*p7-a2*mu8*p8

frml fx3 c3 = (1-a3)*mu3*p3+a3*m-a3*mu1*p1+$

-a3*mu2*p2-a3*mu4*p4-a3*mu5*p5-a3*mu6*p6-a3*mu7*p7-a3*mu8*p8

frml fx4 c4 = (1-a4)*mu4*p4+a4*m-a4*mu1*p1+$

-a4*mu2*p2-a4*mu3*p3-a4*mu5*p5-a4*mu6*p6-a4*mu7*p7-a4*mu8*p8

frml fx5 c5 = (1-a5)*mu5*p5+a5*m-a5*mu1*p1+$

-a5*mu2*p2-a5*mu3*p3-a5*mu4*p4-a5*mu6*p6-a5*mu7*p7-a5*mu8*p8

frml fx6 c6 = (1-a6)*mu6*p6+a6*m-a6*mu1*p1+$

-a6*mu2*p2-a6*mu3*p3-a6*mu4*p4-a6*mu5*p5-a6*mu7*p7-a6*mu8*p8

frml fx7 c7 = (1-a7)*mu7*p7+a7*m-a7*mu1*p1+$

-a7*mu2*p2-a7*mu3*p3-a7*mu4*p4-a7*mu5*p5-a7*mu6*p6-a7*mu8*p8

*

compute mu1=mu2=mu3=mu4=mu5=mu6=mu7=mu8=0.0

compute a1=a2=a3=a4=a5=a6=a7=a8=0.0

*

nlsystem(parmset=base+nonnegative+summation,iters=10000) / fx1 fx2 fx3 fx4 fx5 fx6 fx7

*

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

There's nothing fundamentally wrong with the model---if I put in random data, it works. So there must be something wrong with your data set. How much data do you have?

- TomDoan
**Posts:**7457**Joined:**Wed Nov 01, 2006 5:36 pm

10 years for each variables (17 variables).

- jack
**Posts:**158**Joined:**Tue Sep 27, 2016 11:44 am

25 posts
• Page **1** of **2** • **1**, 2

Return to General Econometrics

Users browsing this forum: No registered users and 3 guests