R/calcular.optimo.criterio.R

Defines functions calcular.optimo.criterio

Documented in calcular.optimo.criterio

#' calculates optimum: fixed criteria for slope
#'
#' @keywords internal
calcular.optimo.criterio<-function(i.curva.map,i.criterio=2.8){
  y.100<-min((1:length(i.curva.map[,2]))[round(i.curva.map[,2],2)==100])
  if (y.100==1){
    resultados<-i.curva.map[1,]  
  }else{
    curva.map<-i.curva.map[1:y.100,]
    x<-curva.map[,1]
    y<-curva.map[,2]
    y.s<-suavizado(y,1)
    #y.s<-loess(y~x)$fitted
    d.y<-diff(y.s)
    if (any(d.y<i.criterio)){
      #optimo<-max((1:(length(x)-1))[d.y>i.criterio],na.rm=T)
      optimo<-min((1:(length(x)-1))[d.y<i.criterio],na.rm=T)
    }else{
      optimo<-length(d.y)+1
    }
    resultados<-curva.map[x==optimo,]    
  }
  return(resultados)
}

Try the mem package in your browser

Any scripts or data that you put into this service are public.

mem documentation built on Nov. 17, 2017, 5:26 a.m.