Binary logit BinaryLogit

Hello,
Does anyone tell me why I get the following error message when I try to run a binary logit with one explanatory variable? How can I debug it? The same code works if there are more than one independent variable.
I really appreciate any suggestion!
Thanks,
--------------------------
Code
---------------------------------------------
//Step one: Declare dc control structure
struct dcControl dcCt;
//Initialize dc control structure
dcCt = dcControlCreate();
load y[100,2]= "base1.csv";
output file= base1.out reset;
//Name of dependent variable
dcSetYVar(&dcCt,y[.,1]);
dcSetYLabel(&dcCt,"A");

//Name of independent variable
dcSetXVars(&dcCt,y[.,2]);
dcSetXLabels(&dcCt,"dep");
struct dcout dcout1;

dcout1 = binaryLogit(dcCt);
call printDCOut(dcOut1);

-------------------------------------------------
G0520 : Arguments not conformable [dcoptprocs.src, line 209]

Currently active call:

File dcoptprocs.src, line 209, in _dc_binFillOut
dcout1.marginvc = putArray(dcout1.marginvc,1,jb*dcout1.vc*jb');
Traceback:

File dcbin.src, line 872, in _dc_binary
dcout1 = _dc_binFillOut(out1.fct,out1.par,d1,dcOut1,pars1,data1,c1.weights);
File dcbin.src, line 256, in binaryLogit
retp(_dc_binary(dc1.myData.dsname,dc1.myData.d1,dc1));

4 Answers



0



Change line 209 in dcoptprocs.src from:

dcout1.marginvc = putArray(dcout1.marginvc,1,jb*dcout1.vc*jb');
dcout1.marginvc[1,.,.] = jb*dcout1.vc*jb';

This is a known issue that has been resolved in DC revision 2.0.3, but not yet released. This revision should be available by June 26th.

aptech

1,773


0



Thank you. It works.
I have two more questions on the above code:
(1) How can I change the starting values?
(2)The Discrete Choice Manual mentions that "STEPBT" algorithm is used for optimation in binary logit. Can other algorithms like Newton Raphson, BFGS be used? If yes, can a user change the Optimization algorithm for binaryLogit?
Thanks again!



0



Taylor,

I am glad to hear the procedure is now working. To answer your questions:

1) The starting values for optimization are stored within the dcControl structure in the member cont.startvalues. This member is an instance of the PV structure containing starting values. If these values are not provided by the user, they are automatically computed internally. However, to set the starting values manually, the starting values needed to be "packed" into the PV structure. As an example, consider putting a starting intercept, b0, and starting coefficients, b, in cont.startvalues. This is done using the pvPackmi procedure. This procedure requires four inputs: the PV structure name (cont.startValues) , the vector of starting values, the name of the variable as a string (b0 or b), and an index number within the PV structure.

//Declare control structure
structdcControl cont;
cont = dcControlCreate();

//Set parameter start values
b0 = 1;
b = { .1 .2 };

//Pack parameter values
cont.startValues =  pvPacki(cont.startValues, b0 ,"b0", 1);
cont.startValues = pvPacki(cont.startValues , b ,"b", 2);

2) Currently there is no mechanism for implementing any optimization algorithms outside of the "STEPBT" method. The GAUSS base package does provide other optimization algorithms but they are not implemented in the current discrete choice procedures.

Eric

90


0



Hello Eclower,

I have to give starting values for constant (b0) and one parameter estimate (b).
I set the starting values as follows:
//Set parameter start values
b0 = 1.5;
b = 0;

//Pack parameter values
cont.startValues = pvPacki(cont.startValues, b0 ,"b0", 1);
cont.startValues = pvPacki(cont.startValues , b ,"b", 2);

If I do not give the starting values, the same program works, but with starting values, it does NOT? I am very new to GAUSS so I dont understand the problem.
--------------------
Error messages:
------------------
G0058 : Index out of range [dcoptprocs.src, line 85]
Currently active call:

File dcoptprocs.src, line 85, in _dc_bin1
retp(-subvec(f,data[1].dataMatrix));
Traceback:

File sqpsolvemt.src, line 530, in sqpsolvemt
vv1 = fnct(par1,data1);
File dcbin.src, line 867, in _dc_binary
out1 = sqpsolvemt(&_dc_bin1, pars1, data1, c1);
File dcbin.src, line 256, in binaryLogit
retp(_dc_binary(dc1.myData.dsname,dc1.myData.d1,dc1));
File help_base.g, line 36, in
dcout1 = binaryLogit(cont);
----
If you don't mind I would be more than happy to provide my dataset and code.
Thanks,
Taylor

Your Answer

4 Answers

0

Change line 209 in dcoptprocs.src from:

dcout1.marginvc = putArray(dcout1.marginvc,1,jb*dcout1.vc*jb');
dcout1.marginvc[1,.,.] = jb*dcout1.vc*jb';

This is a known issue that has been resolved in DC revision 2.0.3, but not yet released. This revision should be available by June 26th.

0

Thank you. It works.
I have two more questions on the above code:
(1) How can I change the starting values?
(2)The Discrete Choice Manual mentions that "STEPBT" algorithm is used for optimation in binary logit. Can other algorithms like Newton Raphson, BFGS be used? If yes, can a user change the Optimization algorithm for binaryLogit?
Thanks again!

0

Taylor,

I am glad to hear the procedure is now working. To answer your questions:

1) The starting values for optimization are stored within the dcControl structure in the member cont.startvalues. This member is an instance of the PV structure containing starting values. If these values are not provided by the user, they are automatically computed internally. However, to set the starting values manually, the starting values needed to be "packed" into the PV structure. As an example, consider putting a starting intercept, b0, and starting coefficients, b, in cont.startvalues. This is done using the pvPackmi procedure. This procedure requires four inputs: the PV structure name (cont.startValues) , the vector of starting values, the name of the variable as a string (b0 or b), and an index number within the PV structure.

//Declare control structure
structdcControl cont;
cont = dcControlCreate();

//Set parameter start values
b0 = 1;
b = { .1 .2 };

//Pack parameter values
cont.startValues =  pvPacki(cont.startValues, b0 ,"b0", 1);
cont.startValues = pvPacki(cont.startValues , b ,"b", 2);

2) Currently there is no mechanism for implementing any optimization algorithms outside of the "STEPBT" method. The GAUSS base package does provide other optimization algorithms but they are not implemented in the current discrete choice procedures.

0

Hello Eclower,

I have to give starting values for constant (b0) and one parameter estimate (b).
I set the starting values as follows:
//Set parameter start values
b0 = 1.5;
b = 0;

//Pack parameter values
cont.startValues = pvPacki(cont.startValues, b0 ,"b0", 1);
cont.startValues = pvPacki(cont.startValues , b ,"b", 2);

If I do not give the starting values, the same program works, but with starting values, it does NOT? I am very new to GAUSS so I dont understand the problem.
--------------------
Error messages:
------------------
G0058 : Index out of range [dcoptprocs.src, line 85]
Currently active call:

File dcoptprocs.src, line 85, in _dc_bin1
retp(-subvec(f,data[1].dataMatrix));
Traceback:

File sqpsolvemt.src, line 530, in sqpsolvemt
vv1 = fnct(par1,data1);
File dcbin.src, line 867, in _dc_binary
out1 = sqpsolvemt(&_dc_bin1, pars1, data1, c1);
File dcbin.src, line 256, in binaryLogit
retp(_dc_binary(dc1.myData.dsname,dc1.myData.d1,dc1));
File help_base.g, line 36, in
dcout1 = binaryLogit(cont);
----
If you don't mind I would be more than happy to provide my dataset and code.
Thanks,
Taylor


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