Hi,

I have a small dataset that I'm fitting a segmented regression using nls on.
I get a step below minimum factor error, which I presume is because residual
sum of square is still "not small enough" when steps in the parameter space
is already below specified/default value. However, when I look at the trace,
the convergence seems to have been reached. I initially thought I might have
reached the parameter space boundary, but these converging parameter values
are by no means near boundary, they are quite in the middle. Could someone
help me understand or throw out some possibilities?

##Here's a sample dataset and code.
y2<-c(2.404529, 1.625661, 1.013981, 3.810921, 10.023745, 10.990817,
10.740636, 11.246827,17.022761, 21.430386)
x2<-c(25.0, 29.3, 33.8, 38.3, 42.8, 47.2, 51.6, 55.8, 60.4, 64.9)
dat <- data.frame(x2,y2)
nlmod <- nls(y2 ~ ifelse(x2 < xint+(yint/slp), yint, yint +
(x2-(xint+(yint/slp)))*slp),
            data=dat, control=list(minFactor=1e-5,maxiter=500,warnOnly=T),
            start=list(xint=40.49782, yint=1.013981, slp=0.8547828),
            na.action=na.omit, trace=T)

##plotting the function
plot(dat$x2,dat$y2)
segments(x0=0, x1=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3],
            y0=coef(nlmod)[2], y1=coef(nlmod)[2])
    segments(x0=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3],x1=80,
            y0=coef(nlmod)[2], y1=80*coef(nlmod)[3]+coef(nlmod)[2])

Karen

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to