[R] An issue regarding to gradient
David Winsemius
dwinsemius at comcast.net
Tue Oct 11 18:50:31 CEST 2011
On Oct 11, 2011, at 6:02 AM, luke1022 wrote:
> The following code will get me a curve plot:
> cutoff <- seq(1,7,0.25)
> Sensitivity <- 1 - pnorm(cutoff, 5, 0.8)
> Specificity <- pnorm(cutoff, 3, 1.2)
> plot(1-Specificity,Sensitivity,main = "ROC curve",type = "o")
>
> How do I get a gradient of a particular point on that curve?
First you need to define what you mean by "gradient at a point" when
the gradient is discontinuous at each point. Is this a numerical
example and you want to take the means of the slopes on either side,
(rather like the definition of the Dirac function at x=0) ...
in whiich case these are the slopes _between_not_at_ the points:
diff(Specificity)/diff(1-Sensitivity)
or ... is this a homework problem and you are being asked to use the
knowledge that those (Sensitivity, Specificity) points came from
particular pnorm functions?
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list