Displaying 11 results from an estimated 11 matches for "graphmodeld".
2018 Apr 06
3
Obtain gradient at multiple values for exponential decay model
...eed, "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))
I realized that this would not work in the context of your constructio...
2018 Apr 07
0
Obtain gradient at multiple values for exponential decay model
...ated, but was prompted by Steve
Ellison's suggestion to try it out in this case:
################# reprex (see reprex package)
graphdta <- read.csv( text =
"t,c
0,100
40,78
80,59
120,38
160,25
200,21
240,16
280,12
320,10
360,9
400,7
", header = TRUE )
nd <- c( 100, 250, 300 )
graphmodeld <- lm( log(c) ~ t, data = graphdta )
graphmodelplin <- predict( graphmodeld
, newdata = data.frame( t = nd )
)
graphmodelp <- exp(graphmodelplin)
graphmodelp
#> 1 2 3
#> 46.13085 16.58317 11.79125
# derivative o...
2018 Apr 06
0
Obtain gradient at multiple values for exponential decay model
..."), 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...
2018 Apr 06
2
Obtain gradient at multiple values for exponential decay model
> Sent: Friday, April 06, 2018 at 5:55 AM
> From: "David Winsemius" <dwinsemius at 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
2018 Apr 05
2
Obtain gradient at multiple values for exponetial decay model
Readers,
Data set:
t,c
0,100
40,78
80,59
120,38
160,25
200,21
240,16
280,12
320,10
360,9
400,7
graphdata<-read.csv('~/tmp/data.csv')
graphmodeld<-lm(log(graphdata[,2])~graphdata[,1])
graphmodelp<-exp(predict(graphmodeld))
plot(graphdata[,2]~graphdata[,1])
lines(graphdata[,1],graphmodelp)
Please what is the function and syntax to obtain gradient values for the model curve at various requested values, e.g.:
when graphdata[,1] at value...
2018 Apr 06
2
Obtain gradient at multiple values for exponential decay model
> Sent: Friday, April 06, 2018 at 4:53 AM
> From: "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
> To: "g l" <gnulinux at gmx.com>
> coef( graphmodeld )
>
coef(graphmodelp)
Error: $ operator is invalid for atomic vectors
A quick search engine query revealed primarily references to the dollar sign ($) operator which does not seem relevant to this question.
2018 Apr 05
0
Obtain gradient at multiple values for exponetial decay model
...ty.
On April 5, 2018 3:44:03 AM PDT, g l <gnulinux at gmx.com> wrote:
>Readers,
>
>Data set:
>
>t,c
>0,100
>40,78
>80,59
>120,38
>160,25
>200,21
>240,16
>280,12
>320,10
>360,9
>400,7
>
>graphdata<-read.csv('~/tmp/data.csv')
>graphmodeld<-lm(log(graphdata[,2])~graphdata[,1])
>graphmodelp<-exp(predict(graphmodeld))
>plot(graphdata[,2]~graphdata[,1])
>lines(graphdata[,1],graphmodelp)
>
>Please what is the function and syntax to obtain gradient values for
>the model curve at various requested values, e.g.:
>...
2018 Apr 06
0
Obtain gradient at multiple values for exponetial decay model
Try
coef( graphmodeld )
And you don't need to approximate if you use the newdata argument to the predict function.
I think reading the "Introduction to R" that comes with R would help.
--
Sent from my phone. Please excuse my brevity.
On April 5, 2018 2:00:45 PM PDT, g l <gnulinux at gmx.com> wrot...
2018 Apr 06
0
Obtain gradient at multiple values for exponential decay model
.... Please excuse my brevity.
On April 6, 2018 3:30:10 AM PDT, g l <gnulinux at gmx.com> wrote:
>> Sent: Friday, April 06, 2018 at 4:53 AM
>> From: "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
>> To: "g l" <gnulinux at gmx.com>
>> coef( graphmodeld )
>>
>
>coef(graphmodelp)
>Error: $ operator is invalid for atomic vectors
>
>A quick search engine query revealed primarily references to the dollar
>sign ($) operator which does not seem relevant to this question.
2018 Apr 06
1
Obtain gradient at multiple values for exponential decay model
...t: Friday, April 06, 2018 at 1:44 PM
> From: "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
>
> You did not try my suggestion. You tried David's, which has a leftover mistake from your guesses about what the argument to coef should be.
Yes, sorry for the mistake.
coef(graphmodeld)
(Intercept) graphdata[, 1]
4.513544204 -0.006820623
This corresponds to the linear model but it is still not understood how this helps to determine gradients at specific points for the exponential model.
2018 Apr 05
4
Obtain gradient at multiple values for exponetial decay model
> Sent: Thursday, April 05, 2018 at 4:40 PM
> From: "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
>
> the coef function.
>
For the benefit of other novices, used the following command to read the documentation:
?coef
Then tried and obtained:
> cvalue100<-coef(graphmodelp~100)
> cvalue100
NULL
Then looked at the model values which of course correspond