Following are the sample raw data points (actual data) as shown in the points plot. Trying to validate if the given model can produce a reasonable fit for this data set.
R is complaining about the data, the model with and without initial values, with and without maxiter set; another error too.
Latest error: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
Excel solver did a decent preliminary job to derive initial values, and a fit than R without a single complaint. However Excel is not sufficient to complete the task and I would like to get some help here to get a better fit and to resolve this error. Open to both r and python codes (if python libraries can handle this better than r nls...).
model equation :
y.nls <- nls(y ~ a2 + ((a1 - a2)*(((Lc/K)^n*H)/((1 + (Lc/K) )^n*H))) ,
start = c(n = n.init, H = H.init, K = K.init, a2 = a2.init),
control = list(maxiter = 100), trace = TRUE)
#initial values for variables:
n.init <- 0.6
H.init <- 2.6
K.init <- 0.4
a1 <- 0.01
a2.init <- 0.75
sample data:
Lc <- c( 0.001 ,0.002 ,0.003 ,0.004 ,0.005 ,0.006 ,0.007 ,0.008 ,0.01 ,0.05 , 0.08 ,0.1 ,0.049554 ,0.099109 ,0.1486635 ,0.1783962 ,0.198218 ,0.24479923 ,0.29534482 ,0.3468815 ,0.396436 ,0.43409742 ,0.495545 ,0.5450995 ,0.594654 ,0.6442085 ,0.693763 ,0.7433175 ,0.792871 ,0.941534313 ,0.99108875 ,1.486634 ,1.982178667 ,2.477723333 ,2.477723333 ,2.973267327 ,4.45990099 ,5.946534653 ,7.928712871 ,9.415346535 ,12.88415842 ,16.3529703 ,19.32623762 ,19.32623762 ,22.7950495 ,22.7950495 ,27.33423762 ,27.33423762 ,27.33423762 ,27.33423762 ,29.23712871 ,29.23712871 ,32.70594059 ,35.67920792 ,35.67920792 ,37.66138614 ,37.66138614 ,39.1480198 ,39.1480198 ,39.1480198 ,59.46534653 ,59.46534653 ,79.26750804 ,79.26750804)
y <- c(0.7336301 ,0.7300885 ,0.7302002 ,0.7265662 ,0.7217741 ,0.7223443 ,0.7238027 ,0.71864 ,0.7094976 ,0.6989751 ,0.6764343 ,0.6598028 ,0.410136 ,0.3917024 ,0.3777954 ,0.3685038 ,0.3590556 ,0.3537131 ,0.3488757 ,0.343905 ,0.3402811 ,0.3378536 ,0.3371936 ,0.3337051 ,0.3308202 ,0.3284294 ,0.328673 ,0.3269062 ,0.3233758 ,0.3233758 ,0.3210403 ,0.3189582 ,0.3163805 ,0.3135109 ,0.3126578 ,0.3114899 ,0.3090119 ,0.3056575 ,0.3040519 ,0.301711 ,0.3005168 ,0.2975471 ,0.2903744 ,0.2960987 ,0.2874757 ,0.2914471 ,0.2900818 ,0.2900818 ,0.2841886 ,0.2841886 ,0.2807069 ,0.2861011 ,0.2829085 ,0.2770104 ,0.2824439 ,0.2748469 ,0.2797121 ,0.2669634 ,0.2723519 ,0.2768586 ,0.2676962 ,0.2730733 ,0.2656272 ,0.2706228)