[R] How to get slope estimates from a four parameter logistic with SSfpl?

Weber, Sam Sam.Weber at exeter.ac.uk
Tue Oct 20 11:40:54 CEST 2009


Yes that worked perfectly. Many thanks. 

________________________________________
From: Peter Ehlers [ehlers at ucalgary.ca]
Sent: 19 October 2009 19:17
To: Weber, Sam
Cc: r-help at R-project.org
Subject: Re: [R] How to get slope estimates from a four parameter logistic with SSfpl?

Weber, Sam wrote:
> Hi,
>
> I was hoping to get some advice on how to derive estimates of slopes from four parameter logistic models fit with SSfpl.
>
> I fit the model using:
>
> model<-nls(temp~SSfpl(time,a,b,c,d))
> summary(model)
>
> I am interested in the values of the lower and upper asymptotes (parameters a and b), but also in the gradient of the line at the inflection point (c) which I assume tells me my rate of increase when it is steepest (?).
>
> However, I cannot work out how to derive a slope estimate. I'm guessing it has something to do with the scaling parameter d but having searched the internet for hours I have not made any progress, and it is probably quite simple. Any help would be hugely appreciated!
>

Sam,

If I understand you correctly, all you want is the derivative
of the fpl wrt the input. You can differentiate the fpl function
or you can use the result provided by predict.nls() in the
"gradient" attribute. The gradient wrt 'c' is the negative
of the slope you want. The maximum slope will occur at time = c.

So this should give you the slope:

  ypred <- predict(model,newdata=data.frame(Time=coef(model)[3]))
  myslope <- -attr(ypred, "gradient")[,3]

  -Peter Ehlers

> All the best
>
> Sam
>
>       [[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.
>
>



More information about the R-help mailing list