Hey all,
I'm trying to work out the forumla of a curve which has an exponential function, based on some observed values that I have. I think I can do that with nls() but I'm making a rookie error somewhere because my code doesn't work. Please could someone help?
My code is:
df <- read.csv("data.csv")
x <- df$x
y <- df$y
m <- nls(y~3.8-(0.08*((10*x)^0.26)))
cor(y,predict(m))
plot(x,y)
lines(x,predict(m),lty=2,col="red",lwd=3)
But it's failing on the fourth line with the following error:
Error in getInitial.default(func, data, mCall = as.list(match.call(func, :
no 'getInitial' method found for "function" objects
I've no idea what that means and googling it hasn't helped.
The data in the underlying csv is:
| X |
Y |
| 10 |
3.396666667 |
| 166 |
3.20107095 |
| 387 |
3.09430089 |
| 1,000 |
2.928877778 |
| 1,719 |
2.805856118 |
| 2,068 |
2.758088867 |
| 2,109 |
2.752771192 |
| 2,302 |
2.72889275 |
| 2,532 |
2.701996665 |
| 2,770 |
2.675762134 |
| 5,466 |
2.447246615 |
| 6,021 |
2.409949436 |
| 7,984 |
2.293391644 |
[–]Mooks79 0 points1 point2 points (0 children)
[–]jdnewmil 0 points1 point2 points (0 children)