1
我正在嘗試適應一些劑量反應數據的乙狀結腸。當我在ggplot之外使用nls時,它工作正常。當我使用它裏面geom_smooth,它引發以下錯誤:爲什麼從ggplot中調用nls會給我一個錯誤?
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
的樣本數據是這樣的:
x=c(1e-12, 1e-08, 1e-07, 1e-06, 1e-05, 1e-04)
y=c(8.161304, 11.191990, 13.453300, 14.633020, 16.227570, 15.480510)
myData<-data.frame(x=x,y=y)
myEquation=y ~ min+((max-min)/(1+10^(ec50-log10(x))))
startingGuess<-list(ec50=-8, min=8, max=15)
電話是:
fitModel = nls(myEquation,myData, start = startingGuess,trace=TRUE)
和:
ggplot(data=myData,aes(x=x,y=y)) +
geom_point() +
scale_x_log10() +
geom_smooth(method="nls",formula = myEquation,start = startingGuess,trace=TRUE)
我在做些什麼不正確?