mercredi 25 octobre 2017

R How to test points on line if they cross 0

Let's say I have the following code of this image enter image description here

I should test all points on the red curve for the condition 'cross 0, positive to the left, negative to the right

blueLine <- lines(fdata.deriv(mlearn, nderiv = 0, method = "bspline", class.out = 'fd', nbasis = 6), col = 'blue')

redLine <- lines(fdata.deriv(mlearn, nderiv = 1, method = "bspline", class.out = 'fd', nbasis = 6), col = 'red') 

legend('topright', col = c('blue', 'red'), lty = c(1, 1), legend = c('Smoothed curve', 'First derivative of smoothed curve'))

abline(h = 0)

Aucun commentaire:

Enregistrer un commentaire