Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: could not calculate numerical derivatives
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: could not calculate numerical derivatives
Date
Tue, 20 Nov 2012 05:55:06 -0500
vesile kutlu <[email protected]>:
User-written mm_root(); see
http://www.stata.com/statalist/archive/2009-01/msg01140.html
On Tue, Nov 20, 2012 at 5:34 AM, vesile kutlu <[email protected]> wrote:
> Hi all,
> I am trying to solve the function “v” numerically in Mata but I get
> the error ” could not calculate numerical derivatives -- discontinuous
> region with missing values encountered”. I ask Mata to minimize this
> function with respect to a and b. I provide the initial values of
> these parameters. Is there something wrong with my code? I would
> appreciate if you could tell me why I got this error? Is there maybe
> another way to solve this problem? Thank you.
> Vesile
> void mysolver(todo, p, v, S, H)
> {
> a=p[1]
> b=p[2]
> v=(0.7-exp((a/b)*(exp(b*48)-exp(b*75))))^2+(0.4-exp((a/b)*(exp(b*48)-exp(b*80))))^2
> }
> S=optimize_init()
> optimize_init_evaluator(S, &mysolver())
> optimize_init_evaluatortype(S, "v0")
> optimize_init_params(S, (1,1))
> optimize_init_which(S, "min")
> p=optimize(S)
> p
> end
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/