[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"J Page" <mdjhp@hotmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: THANKS SO MUCH! RE: Derivatives at different parameter values |

Date |
Wed, 24 Mar 2004 12:47:04 -0500 |

Dear Alan, Thanks very much. I will give it a try. John

From: "FEIVESON, ALAN H. (AL) (JSC-SK) (NASA)" <alan.h.feiveson@nasa.gov>_________________________________________________________________

Reply-To: statalist@hsphsun2.harvard.edu

To: "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>

Subject: st: RE: Derivatives at different parameter values

Date: Wed, 24 Mar 2004 09:00:49 -0600

John - Let's see if I understand your question. You have some function

f(th_1, th_2,...th_n) and you want Stata to calculate df/dth_k at particular

values of th_1, th_2,..,th_n.

If this is what you want, there is a way you can do it by setting up a fake

regression and using _testnl. Here's an example:

Suppose your function is (th_2)/(th_3) - exp(-th_1), and you want to

evaluate the partial derivatives of f at (th_1, th_2, th_3) = (2,3,6).

Set up a fake dataset and regression as follows:

.clear

.set obs 3

.gen temp=_n

.tab temp,gen(dum)

.gen y=2*dum1+3*dum2+6*dum3

.reg y dum1 dum2 dum3,noc

Then use -testnl- with the "g" option to save the matrix of partial

derivatives:

.testnl _b[dum2]/_b[dum3]-exp(-_b[dum1])=1,g(G)

The result of the test will be undefined (since the regression is a perfect

fit), but the matrix G will contain the partial derivatives you want.

In this example, df/dth_1 = exp(-th_1), df/dth_2 = 1/th_3 and df/dth_3 =

-th_2/(th_3)^2.

So the G matrix should contain exp(-2), 1/6 and -3/36.

If you want to implement this for ranges of parameter values, you would have

to incorporate this as part of a do-file.

Al Feiveson

-----Original Message-----

From: owner-statalist@hsphsun2.harvard.edu

[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of J Page

Sent: Tuesday, March 23, 2004 2:17 PM

To: statalist@hsphsun2.harvard.edu

Subject: st: Derivatives at different parameter values

Hi,

How can one implement the numerical derivatives currently implemented in

Stata's ml maximizer in a setting outside outside of ml? I would like to

calculate numerical derivatives at given parameter values. The dydx function

does not appear to do this.

Thanks much.

John

_________________________________________________________________

Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!

(Limited-time offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

Find a broadband plan that fits. Great local deals on high-speed Internet access. https://broadband.msn.com/?pgmarket=en-us/go/onm00200360ave/direct/01/

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: Comparison of multivariate outcome between two groups** - Next by Date:
**st: Stata 5 version of -somersd- on my website** - Previous by thread:
**st: Comparison of multivariate outcome between two groups** - Next by thread:
**st: Stata 5 version of -somersd- on my website** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |