I have an ideal curve dataset shown bleow. I made a nls model that describes the ideal dataset. I also have experimental data that I want to plot against the model to find a value for the fit. How do I do this?
Caq q Langmuir
0 0
0.002 0.001198975
0.004 0.00234561
0.006 0.00344326
0.008 0.004494998
0.01 0.005503645
0.02 0.009984597
0.03 0.013703679
0.05 0.01952051
0.1 0.028637319
0.2 0.037362059
0.3 0.041585223
0.4 0.04407627
0.5 0.04571949
0.6 0.046884773
0.7 0.047754159
0.8 0.048427657
1 0.049403112
2 0.051476858
3 0.052207344
4 0.052580417
5 0.052806831
10 0.05326556
25 0.053544642
50 0.053638321
75 0.05366962
100 0.053685283
125 0.053694686
150 0.053700956
Experimental Data:
Caq mean q mean
0.119776495 -9.59E-06
0.09367508 0.002213347
0.158928618 0.007557445
0.212581528 0.015132666
0.108175866 0.022821814
0.129927046 0.030301749
0.209681371 0.037970427
2.199189257 0.045278635
14.37839971 0.048293908
30.33941524 0.050573923
42.56357812 0.053796262
50.38530228 0.056462806
102.3793218 0.059950779
127.9587089 0.06566134
I plot this: (the first line is my fit, next experimental data. The third line is my fit of the experimental data. I get the error that x and y lengths differ.
I know there is something wrong with my basic understanding of the process of fitting, but I don't know what.
Langmuirfit<- nls(formula = q.Langmuir ~ Q*b*Caq/(1+b*Caq), data = PIsotherm, start = list(Q = 0.05, b = 1), algorith = "port")
plot(PIsotherm$Caq.mean,PIsotherm$q.mean, pch=16)
lines(PIsotherm$Caq.mean,predict(Langmuirfit))