Error : G0159 Wrong number of parameters

Hi,

I am still new with Gauss and it came out with this error. Please help me with this. Thank you.

 

new; cls;
library lr; lrset;
format 8,8;
/*name of data file*/
dataset = "firmx1";
/*dependent variables*/
depvar = { Y1, Y2 };
pp = rows(depvar);
/*independent variables*/
veq1 = { const, X11 };
veq2 = { const, X21 };
invars = veq1|veq2;
/*number of parameters*/
np1 = rows(veq1);
np2 = rows(veq2);
numvar = np1|np2;

Q = LSUR( dataset, pp, invars, numvar );

end;

1 Answer



0



Hello,
I have looked over your code and have a few suggestions. I was unable to run your code because I do not have your data. However, I have noted a couple of things. First in defining your independent variables, veq1 and veq2, you use the variable const. However, it appears that you have not defined const prior to using it to define your independent variables.

The second issue, and more likely reason for your error code, is that you have four inputs into the lsur procedure. The lsur procedure requires 5 inputs. The proper usage is:

Q = LSUR(dataset,LHS_vars,RHS_vars,NUM_var,Restrict);

You are currently missing the Restrict input. The source code (or user manual) provides the following description of Restrict:


** Restrict -- String, constrained information on parameters
** to perform restricted estimation. The syntax
** of Restrict is as follows:
**
** Restrict="rest1, rest2,...., restN";
**
** More than one restriction is allowed provided
** each is separated by commas. Each restriction
** must be written as a linear equation with all
** variables in the left-hand side and the constant
** in the right-hand side (i.e., x1:1+x1:2=1).
** Variables shown in each restriction must be
** variables in the regression model. Note that
** the numeric value following the (:) signifies
** which equation the variable comes from (i.e.,
** X4:10 indicates the X4 variable comes from the
** 10th equation). Restrictions in the RESTRICT
** argument must be consistent and not redundant
** otherwise error messages will be given. Users
** should note that only the parameters associated
** with the variables are restricted, and not the
** variables in the model.
**
** Examples of some restrict arguments:
**
** 1) Restrict="x1:1 + x1:2 + x1:3 = 1";
** 2) Restrict="const:1 + const:2 + const:3 = 1,
** trend:1 = 0,
** trend:2 = 0,
** trend:3 = 0";

Below you will find a a complete example using lsur:

/*---------------------------------------------------------------------------
Program file: lr15
Data file: t11_3
Last changed: May 13, 1992
Written by: Gene Leung

Note........: This example is from Judge et. al. (1988, p.460). The use
of seemingly unrelated regression with restrictions imposed
is illustrated.
-----------------------------------------------------------------------------*/

library lr;
lrset;
output file = lr15.out reset;

dataset = "t11_3";
lhs = { q1,q2,q3 };
rhs = { const,p1,y,
const,p2,y,
const,p3,y };

// NO. OF RHS VARIABLES IN EACH EQN.
novars = { 3,3,3 };

//Set restrict
restrict = "p1:1-p2:2=0,
p1:1-p3:3=0";

//USING NORMAL DIVISOR
_lrdv = 0;

//LSUR ESTIMATION WITHOUT RESTRICTION IMPOSED
result1 = lsur(dataset,lhs,rhs,novars,0);

//LSUR ESTIMATION WITH RESTRICTION IMPOSED
result2 = lsur(dataset,lhs,rhs,novars,restrict);

///* RESULT1 AND RESULT2 ARE VECTORS THAT STORE
ALL STATISTICS AND ESTIMATED COEFFICIENTS. SEE VLIST AND VREAD TO LIST CONTENTS
OF THESE VECTORS AND EXTRACT INFORMATION FROM THEM. */

print;
print "-------------------------------------------";
print "Variables stored in result2 are as follows: ";
print "-------------------------------------------";
call vlist(result2); /* VLIST IS A FUNCTION TO LIST ALL
VARIABLES INSIDE THE VECTOR */

format /rd 8,4;
print;
print "-----------------------------------------------------";
print "The coeff. with restrictions imposed are as follows: ";
print "-----------------------------------------------------";
let mask[1,2] = 0 1;
let fmt[2,3] = "-*.*s " 10 8
"*.*lf " 14 8;
answer = rhs~vread(result2,"b"); /* VREAD GETS b FROM RESULT2 */
call printfm(answer,mask,fmt);

output off;

Eric

90

Your Answer

1 Answer

0

Hello,
I have looked over your code and have a few suggestions. I was unable to run your code because I do not have your data. However, I have noted a couple of things. First in defining your independent variables, veq1 and veq2, you use the variable const. However, it appears that you have not defined const prior to using it to define your independent variables.

The second issue, and more likely reason for your error code, is that you have four inputs into the lsur procedure. The lsur procedure requires 5 inputs. The proper usage is:

Q = LSUR(dataset,LHS_vars,RHS_vars,NUM_var,Restrict);

You are currently missing the Restrict input. The source code (or user manual) provides the following description of Restrict:


** Restrict -- String, constrained information on parameters
** to perform restricted estimation. The syntax
** of Restrict is as follows:
**
** Restrict="rest1, rest2,...., restN";
**
** More than one restriction is allowed provided
** each is separated by commas. Each restriction
** must be written as a linear equation with all
** variables in the left-hand side and the constant
** in the right-hand side (i.e., x1:1+x1:2=1).
** Variables shown in each restriction must be
** variables in the regression model. Note that
** the numeric value following the (:) signifies
** which equation the variable comes from (i.e.,
** X4:10 indicates the X4 variable comes from the
** 10th equation). Restrictions in the RESTRICT
** argument must be consistent and not redundant
** otherwise error messages will be given. Users
** should note that only the parameters associated
** with the variables are restricted, and not the
** variables in the model.
**
** Examples of some restrict arguments:
**
** 1) Restrict="x1:1 + x1:2 + x1:3 = 1";
** 2) Restrict="const:1 + const:2 + const:3 = 1,
** trend:1 = 0,
** trend:2 = 0,
** trend:3 = 0";

Below you will find a a complete example using lsur:

/*---------------------------------------------------------------------------
Program file: lr15
Data file: t11_3
Last changed: May 13, 1992
Written by: Gene Leung

Note........: This example is from Judge et. al. (1988, p.460). The use
of seemingly unrelated regression with restrictions imposed
is illustrated.
-----------------------------------------------------------------------------*/

library lr;
lrset;
output file = lr15.out reset;

dataset = "t11_3";
lhs = { q1,q2,q3 };
rhs = { const,p1,y,
const,p2,y,
const,p3,y };

// NO. OF RHS VARIABLES IN EACH EQN.
novars = { 3,3,3 };

//Set restrict
restrict = "p1:1-p2:2=0,
p1:1-p3:3=0";

//USING NORMAL DIVISOR
_lrdv = 0;

//LSUR ESTIMATION WITHOUT RESTRICTION IMPOSED
result1 = lsur(dataset,lhs,rhs,novars,0);

//LSUR ESTIMATION WITH RESTRICTION IMPOSED
result2 = lsur(dataset,lhs,rhs,novars,restrict);

///* RESULT1 AND RESULT2 ARE VECTORS THAT STORE
ALL STATISTICS AND ESTIMATED COEFFICIENTS. SEE VLIST AND VREAD TO LIST CONTENTS
OF THESE VECTORS AND EXTRACT INFORMATION FROM THEM. */

print;
print "-------------------------------------------";
print "Variables stored in result2 are as follows: ";
print "-------------------------------------------";
call vlist(result2); /* VLIST IS A FUNCTION TO LIST ALL
VARIABLES INSIDE THE VECTOR */

format /rd 8,4;
print;
print "-----------------------------------------------------";
print "The coeff. with restrictions imposed are as follows: ";
print "-----------------------------------------------------";
let mask[1,2] = 0 1;
let fmt[2,3] = "-*.*s " 10 8
"*.*lf " 14 8;
answer = rhs~vread(result2,"b"); /* VREAD GETS b FROM RESULT2 */
call printfm(answer,mask,fmt);

output off;


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy