Forcing nls to fit a curve passing through a specified point
I'm trying to fit a Boltzmann sigmoid 1/(1+exp((x-p1)/p2)) to this small experimental dataset: xdata <- c(-60,-50,-40,-30,-20,-10,-0,10) ydata <- c(0.04, 0.09, 0.38, 0.63, 0.79, 1, 0.83, 0.56) I know that it is pretty simple to do it. For example, using nls : fit <-nls(ydata ~ 1/(1+exp((xdata-p1)/p2)),start=list(p1=mean(xdata),p2=-5)) I get the following results: Formula: ydata ~ 1/(1 + exp((xdata - p1)/p2)) Parameters: Estimate Std. Error t value Pr(>|t|) p1 -33.671 4.755 -7.081 0.000398 *** p2 -10.336 4.312 -2.397 0.053490 . --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1