Oleguer Plana Ripoll
2013-Mar-10 15:43 UTC
[R] Error with grad() for numerical differential of a function
Hello everyone, I have programmed a function and, among other things, it has to compute the differential of a function. I have been using the function grad() and I have programmed some simulated studies. I have testes with 72,576 different combinations of the initial values and now I got an error in only 4 situations. The error comes from the function grad() and I don't understand why. This is the output: Error in grad.default(Sstar, x = t, dist1 = T1pdist, dist2 = T2pdist, : function returns NA at 3.90625e-071.01927622979798e-087.7105723770202e-075.27096223871154e-087.28540377612885e-071.25230637383194e-076.56019362616806e-072.21329924168263e-075.59920075831737e-073.324709613353e-074.487790386647e-070.0001000016964206937.79553579306956e-072.72822299391765e-087.53967770060824e-078.56180755521809e-086.95631924447819e-071.70797994270076e-076.10452005729924e-072.75627788007242e-075.05622211992758e-07 distance from x. Anyone knows when returns a NA this function? Anyone knows other function to make numerical approximations of the differential? Thank you for your help, Oleguer [[alternative HTML version deleted]]
Berend Hasselman
2013-Mar-10 15:57 UTC
[R] Error with grad() for numerical differential of a function
On 10-03-2013, at 16:43, Oleguer Plana Ripoll <oleguerplana at gmail.com> wrote:> Hello everyone, > > I have programmed a function and, among other things, it has to compute the differential of a function. I have been using the function grad() and I have programmed some simulated studies. I have testes with 72,576 different combinations of the initial values and now I got an error in only 4 situations. > > The error comes from the function grad() and I don't understand why. This is the output: > Error in grad.default(Sstar, x = t, dist1 = T1pdist, dist2 = T2pdist, : > function returns NA at 3.90625e-071.01927622979798e-087.7105723770202e-075.27096223871154e-087.28540377612885e-071.25230637383194e-076.56019362616806e-072.21329924168263e-075.59920075831737e-073.324709613353e-074.487790386647e-070.0001000016964206937.79553579306956e-072.72822299391765e-087.53967770060824e-078.56180755521809e-086.95631924447819e-071.70797994270076e-076.10452005729924e-072.75627788007242e-075.05622211992758e-07 distance from x. > > Anyone knows when returns a NA this function? Anyone knows other function to make numerical approximations of the differential? > > Thank you for your help, > Oleguer > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.Not enough information to give a non flippant reply. Which package(s) are you using? What is your function? Provide a small reproducible example. Please read the posting guide (link at bottom of each posting to R-help). Berend