Reputation: 41
I am trying to fit a function in R to the following data:
y<-c(80.32000, 55.78819, 89.23141, 30.75780, 418.26000, 254.30000, 200,316.42667, 406.83435, 364.00304, 218.27867, 153.88019, 235.49971, 148.77052,
273.20171, 123.54065, 157.75650, 120.88961, 134.64092, 177.44000, 123.62948,87.03000, 63.22455, 132.62000, 120.95000, 129.60000, 116.32000, 60.49000, 66.59000)
x<-c(0, 0, 0, 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16)
I have tried several fits, but nothing really works... I guess a Weibull function would fit best. I have searched the internet to find a solution to this problem, and I have tried to adjust the code as suggested here: https://groups.google.com/g/r-help-archive/c/rym6b1K54-4?pli=1
nls(y~127*dweibull(x,shape,scale), start=c(shape=3,scale=100))
but I get the following error:
Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model. In dweibull(x, shape, scale) : NaNs were produced.
Upvotes: 0
Views: 284
Reputation: 1705
The data is highly scatered. Moreover they are few points in the range $0<x<1$ which makes quasi impossible to sketch the shape of the function in this range. On one hand a function of Weibull kind appears convenient for $x$ large. On the other hand the kind of function convenient for small $x$ is questionable.
For example I tried the function drawn below. But with such an high scatter of the points this choice is contestable.
Upvotes: 1