# Re: st: vector of independent variables in ML program

 From Jonathan Hanson <[email protected]> To [email protected] Subject Re: st: vector of independent variables in ML program Date Tue, 12 Aug 2008 09:59:16 -0400

```Dear Stas,

Thanks for the reply.  I have an earlier edition of the Gould et. al.
book and agree that it is helpful.  Nothing in there, however,
pertaining to my question, at least in the edition I have.

I would definitely rather not write the gradient vector, but my model
is complex and the lf method of estimation is not working for me.  As
I work through the derivatives, it seems that I have vectors of
independent variables that need to be called directly, hence my
question.

Thanks again,

Jon

On Aug 12, 2008, at 9:47 AM, Stas Kolenikov wrote:

> A big idea of -ml- is that you don't have to do that, as the
> derivatives with respect to beta's necessary for likelihood
> maximization and variance estimation will be computed by the chain
> rule. If all that your equations depend on is theta, then you don't
> really need to go into x's. The book on [ML] will explain all the
> details (http://www.stata.com/bookstore/mle.html), and if you write
> your own -ml- code, that book is a must.
>
> On Tue, Aug 12, 2008 at 8:29 AM, Jonathan Hanson
> <[email protected]> wrote:
>> Greetings,
>>
>> How does one refer to a vector of independent variables from within
>> an ML
>> program?  For example, suppose I need to write a gradient vector, the
>> formula for which looks something like this:
>>
>> ∂ ln L/ ∂ Β =  (1/sigma^2) x'(y - xΒ)
>>
>> where x' is a k by 1 vector of the independent variables for an
>> observation.
>> I know that I can refer to y as \$ML_y1 and xB as one of the arguments
>> (theta, for instance), but how can I call x' in the formula?
>> Ultimately, I
>> will have multiple equations in this formula, so I need to be able to
>> specify equation from which the x's are coming.
>>
>> Many thanks,
>>
>>
>>
>> Jonathan Hanson
>> Assistant Professor of Political Science
>> Maxwell School of Citizenship and Public Affairs
>> 100 Eggers Hall
>> Syracuse University
>> Syracuse, NY 13244
>>
>>
>>
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
>
>
> --
> Stas Kolenikov, also found at http://stas.kolenikov.name
> Small print: I use this email account for mailing lists only.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

_______________________________________
Jonathan Hanson
Assistant Professor of Political Science
Maxwell School of Citizenship and Public Affairs
100 Eggers Hall
Syracuse University
Syracuse, NY 13244
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```