Hi,

(1) How can a user change the starting values for binaryLogit?

(2)The Discrete Choice Manual mentions that "STEPBT" algorithm is used for optimization. Do other algorithms like Newton Raphson, BFGS work for binary logit? If yes, can a user change the Optimization algorithm for binaryLogit?

//Step one: Declare dc control structure struct dcControl dcCt; //Initialize dc control structure dcCt = dcControlCreate(); dcCt.dirTol=1e-5; 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);

Thanks!

## 1 Answer

0

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, *b*_{0}, and starting coefficients, *b*, in *cont.startvalues*. This is done using the **pvPackmi** procedure. This procedure requires five inputs: the PV structure name (*cont.startValues*) , the vector of starting values, the name of the variable as a string (*b _{0}* or

*b*), a

*mask*vector indicating which variables to include in the estimated parameter vector, and an index number within the PV structure.

There are a few tips to remember when setting up user defined start values for the **DC** procedures:

- Intercepts are stored in the b
_{0}matrix of the*cont.startValues*PV structure. This is the first element in the*cont.startValues*structure and should have dimensions equal to 1 x L, where L equals the number of dependent variable categories. - Coefficients are stored in the b matrix of the
*cont.startValues*PV structure. This is the second element in the*cont.startValues*structure and should have dimensions equal to K x L, where K equals the number of independent regressors. - In each of the above matrices, all members in the column corresponding to the reference category should be set equal to zero.
- GAUSS must be told to exclude the reference category start values from the parameter vector it estimates. This is done using the
*mask*matrix. The*mask*is a matrix that should include only zeros or ones. Elements with zeros will NOT be included in the estimated parameter vector while elements with one will be.For example if I have the matrix:b = { 0 1 1, 2 .3 4}; mask = {0 1 1, 1 0 1}

and use

struct PV startValues; startValues = pvPackmi(startValues, b ,"b", mask , 2);

GAUSS will pack the elements in b into the PV structure startValues and will assume that the elements {1,1} and {2,2} will be held constant through any estimation at 0 and .3, respectively.

As a full example, to set the start values for your code://Declare control structure struct dcControl cont; cont =

**dcControlCreate**(); //Set parameter start values //Set b0, dimensions must be equal to one by the number of Y categories b0 = {0 1}; //Set b, dimensions must be equal to K by the number of Y categories b = {0 .1}; //Set mask which controls which variables go into the parameter vector //This must be used to remove reference category start values from parameter vector mask = {0 1}; //Pack parameter values cont.startValues =**pvPackmi**(cont.startValues, b0 ,"b0", mask[1,.], 1); cont.startValues =**pvPackmi**(cont.startValues , b ,"b", mask, 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.

## Your Answer

## 1 Answer

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, *b*_{0}, and starting coefficients, *b*, in *cont.startvalues*. This is done using the **pvPackmi** procedure. This procedure requires five inputs: the PV structure name (*cont.startValues*) , the vector of starting values, the name of the variable as a string (*b _{0}* or

*b*), a

*mask*vector indicating which variables to include in the estimated parameter vector, and an index number within the PV structure.

There are a few tips to remember when setting up user defined start values for the **DC** procedures:

- Intercepts are stored in the b
_{0}matrix of the*cont.startValues*PV structure. This is the first element in the*cont.startValues*structure and should have dimensions equal to 1 x L, where L equals the number of dependent variable categories. - Coefficients are stored in the b matrix of the
*cont.startValues*PV structure. This is the second element in the*cont.startValues*structure and should have dimensions equal to K x L, where K equals the number of independent regressors. - In each of the above matrices, all members in the column corresponding to the reference category should be set equal to zero.
- GAUSS must be told to exclude the reference category start values from the parameter vector it estimates. This is done using the
*mask*matrix. The*mask*is a matrix that should include only zeros or ones. Elements with zeros will NOT be included in the estimated parameter vector while elements with one will be.For example if I have the matrix:b = { 0 1 1, 2 .3 4}; mask = {0 1 1, 1 0 1}

and use

struct PV startValues; startValues = pvPackmi(startValues, b ,"b", mask , 2);

GAUSS will pack the elements in b into the PV structure startValues and will assume that the elements {1,1} and {2,2} will be held constant through any estimation at 0 and .3, respectively.

As a full example, to set the start values for your code://Declare control structure struct dcControl cont; cont =

**dcControlCreate**(); //Set parameter start values //Set b0, dimensions must be equal to one by the number of Y categories b0 = {0 1}; //Set b, dimensions must be equal to K by the number of Y categories b = {0 .1}; //Set mask which controls which variables go into the parameter vector //This must be used to remove reference category start values from parameter vector mask = {0 1}; //Pack parameter values cont.startValues =**pvPackmi**(cont.startValues, b0 ,"b0", mask[1,.], 1); cont.startValues =**pvPackmi**(cont.startValues , b ,"b", mask, 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.