[R] Obtain gradient at multiple values for exponential decay model
David Winsemius
dw|n@em|u@ @end|ng |rom comc@@t@net
Fri Apr 6 17:03:26 CEST 2018
> On Apr 6, 2018, at 3:43 AM, g l <gnulinux using gmx.com> wrote:
>
>> Sent: Friday, April 06, 2018 at 5:55 AM
>> From: "David Winsemius" <dwinsemius using comcast.net>
>>
>>
>> Not correct. You already have `predict`. It is capale of using the `newdata` values to do interpolation with the values of the coefficients in the model. See:
>>
>> ?predict
>>
>
> The § details did not mention interpolation explicity; thanks.
>
>> The original question asked for a derivative (i.e. a "gradient"), but so far it's not clear that you understand the mathematical definiton of that term. We also remain unclear whether this is homework.
>>
>
> The motivation of this post was simple differentiation of a tangent point (dy/dx) manually, then wondering how to re-think in modern-day computing terms. Hence the original question about asking the appropriate functions/syntax to read further ("curiosity"), not the answer (indeed, "homework"). :)
>
> Personal curiosity should be considered "homework".
Besides symbolic differentiation, there is also the option of numeric differentiation. Here's an amateurish attempt:
myNumDeriv <- function(x){ (exp( predict (graphmodeld, newdata=data.frame(t=x+.0001))) -
exp( predict (graphmodeld, newdata=data.frame(t=x) )))/
.0001 }
myNumDeriv(c(100, 250, 350))
David Winsemius
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
More information about the R-help
mailing list