nls – Sigmoidal curve in R

I am novice at R studio. I’m trying to fit a sigmoidal curve for this data

x <- c(0, 0.19, 0.3, 0.4, 0.52, 0.65, 0.78, 0.9, 1, 1.5, 2, 3)
y <- c(0, 0.001131392946767, 0.001429213070191, 0.001695405556196, 0.008619063174144, 0.00970100252551, 0.014973553352495, 0.022978522580874, 0.038357458205673, 0.045039437163441, 0.052570608708667, 0.050651474312204)

Even after reading a lot online, I still can’t figure out how to set up the fitting.

fit <- nls(y~max(y)*x^n/k^n+x^n, start=list(n=4, k=1))

When I run the fit, it gives me a singular gradient error. Anybody can help? 🙁

Read more here: Source link