SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Omit a constant [ Reply ]
By: Arne Henningsen on 2012-12-25 08:32
[forum:38669]
Dear Rui

Unfortunately, I do not understand your question. You do not need to create new variables (columns) in your data frame and you can impose the homogeneity (adding-up) condition at each equation by normalization by one input price (numéraire). I am happy to see in your other message that you solved the problem. If you want, you can post how you solved your problem in this thread so that others can benefit from your experience.

Best regards,
Arne

RE: Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-11 18:48
[forum:38637]
Never mind, I was able to find a solution.
Thanks for all your support.

RE: Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-11 04:10
[forum:38633]
Dear Anne,

Sorry to bother you again, but a new problem arose:

I'm trying to add a new set of restrictions, namely that the sum of a set of coefficients is one and the sum of another is zero.I have the following original equations in the model:

C ~ α + β1 log X + β2 log Y + γ1 log Z + γ2 log XX
C1 ~ β1 + β2 log YY + γ1 log ZZ

And I want to add the constraint that the sum of βi equal 1 and the some of γi equal zero

To do that I've added 2 new equations to the model:

C2 ~ 0 + β1.Y1 + β2.Y2
C3 ~ 0 + γ1.Y3 + γ2. Y4

I've created columns in my data frame with values of 0 for variable C3 and values of 1 for Y1, Y2, Y3, Y4 and C2 (see example at the end of the message)

But now when I try to run my model with equations C, C1, C2, C3 I get the error "Error in LU.dgC(as(a, "dgCMatrix"), tol = tol, errSing = TRUE) :
cs_lu(A) failed: near-singular A (or out of memory)"

At first I ran the model with the equations and the restricting matrix restrict.regMat and I got this singularity error, and I thought the problem was in the restricting matrix, but then I ran the model unrestricted (with makes all coefficients independent) and even then I get this singularity error (without these new equations the model runs just fine).
I even tried to simplify the model by eliminating some equations and using only a sample of the data (the original model had 7 equations with 8 variables and 300+ observations for each variable, and the simplified one had 4 equations, 5 variables and 40 observations) set but I get the same problem when I add these two equations.

Any ideas on what to do to solve this? Since the problem arises when I add the new equations (and I'm sure my way of doing this is quite rudimentary), do you know how can I add restraints on the sum of groups of coefficients?

Thank you again for all your help.

All the best,
Rui Neiva


P.S.: This is how the new columns I've added look like:

C2 C3 Y1 Y2 Y3 Y4
obs1 1 0 1 1 1 1
obs2 1 0 1 1 1 1
.
.
.
obsi 1 0 1 1 1 1

RE: Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-08 18:46
[forum:38464]
Dear Anne,

Thank you for all your help.

My model seems to be working smoothly now :)

Have a great weekend.

Best,
Anne

RE: Omit a constant [ Reply ]
By: Arne Henningsen on 2012-12-08 08:57
[forum:38428]
So your model is indeed:

C = B1 + B2 X + B3 Y + B4 Z
C1 = B2 + B5 A + B4 B

Right?

Then your argument restrict.regMat should be set equal to the following matrix:

B1 B2 B3 B4 B5
B1 1 0 0 0 0
B2 0 1 0 0 0
B3 0 0 1 0 0
B4 0 0 0 1 0
B2 0 1 0 0 0
B5 0 0 0 0 1
B4 0 0 0 1 0

Best,
Arne

RE: Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-08 01:40
[forum:38399]
Dear Anne,

Thank you so much for your response. I’m trying to use the matrix M method outlined on page 19 of that document with the systemfit documentation.

Let’s say I have the following system (with A, B, C, C1, X, Y, Z being numerals and the βs being the coefficients)

C = β1+β2.X + β3.Y + β4.Z
C1 = β5 + β6.A + β7.B

Β5 should be equal to β2 and β7 to β4

Should my matrix look like this?

1 2 3 4
1 0 0 0 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
5 0 1 0 0
6 0 0 0 0
7 0 0 0 1

If you could tell me if my thinking is correct I would appreciate as I don’t want to run the entire model (8 equations, with a high number of coefficients) without being sure if I’m following the right track.

Have a good weekend and thank you once again for all your help.
All the best,
Rui Neiva

RE: Omit a constant [ Reply ]
By: Arne Henningsen on 2012-12-04 20:42
[forum:38041]
Dear Rui

Please take a look at sections 2.3 and 4.2 of http://www.jstatsoft.org/v23/i04/paper

Best regards,
Arne

RE: Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-04 20:14
[forum:38038]
Dear Anne,

Thank you for your quick response. And thank you for pointing me out that this is not a characteristic of systemfit but of the formula function.

Realizing that my next question if probably also not exclusive to systemfit, I would like to expose the problem I'm trying to solve and my question:

I'm using systemfit to solve a system of equations (using the SURE method) of a translog cost function plus the associated cost share equations. For example, let's say I have a cost C that results from capital K (price k) and labor L (price l), and that I'm solving the system with the translog cost function and the cost share equation for labor.

The intercept on this cost share equation (let's call it βL) is the same term that appears in the translog cost function as βL.log(l), i.e., my question is: how do I define that the terms in the different equations are the same?

Once again thank you for your help.

RE: Omit a constant [ Reply ]
By: Arne Henningsen on 2012-12-03 07:17
[forum:37737]
Dear Rui

The specification of model formulas is described in the documentation of "formula". There, you can read:

"The - operator removes the specified terms [...]. It can also used to remove the intercept term: when fitting a linear model y ~ x - 1 specifies a line through the origin. A model with no intercept can be also specified as y ~ x + 0 or y ~ 0 + x."

Best regards,
Arne

Omit a constant [ Reply ]
By: Rui Neiva on 2012-12-03 04:02
[forum:37736]
On note 7 of the systemfit package documentation the following is stated: "A regression constant is always implied if not explicitly omitted". Can you explain to me how to omit this constant?
Thank you for your help.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge