Sigmoidal Modeling in R

徘徊边缘 提交于 2019-12-08 12:28:53

问题


I am currently trying to model and plot a sigmoidal curve with a low amount of points.

>myExperiment
 V1  N mean  
0.1  9 0.9 
  1  9 0.8 
 10  9 0.1 
  5  9 0.2 

I am using the nlsLM function from the minpack.lm package.

> nlsLM(mean2 ~ -a/(1 + exp(-b * (v1-o))))
Nonlinear regression model
  model: mean2 ~ -a/(1 + exp(-b * (v1 - o)))
   data: parent.frame()
     a      b      o 
-1.452 -0.451  1.292 
 residual sum-of-squares: 0.007017

Number of iterations to convergence: 27 
Achieved convergence tolerance: 1.49e-08
Warning message:
In nlsLM(mean2 ~ -a/(1 + exp(-b * (v1 - o)))) :
  No starting values specified for some parameters.
Initializing ‘a’, ‘b’, ‘o’ to '1.'.
Consider specifying 'start' or using a selfStart model

Using those starting values I receive this error.

> nls(mean~-a/(1 + exp(-b * (v1-o))), start=list(a=-1.452, b=-0.451, o=1.292))
Error in nls(mean ~ -a/(1 + exp(-b * (v1 - o))), start = list(a = -1.452,  : 
  step factor 0.000488281 reduced below 'minFactor' of 0.000976562

I am not well studied in stats to know if this is a syntax R error or a stats failure. What am I doing poorly?

-Thanks


回答1:


This looks like binomial dose-response data. In any case, I would propose a simpler model, like the two parameter log-logistic model, with asymptotes at 0 and 1. A lot of sigmoidal models have been coded up in the drc package.

myExperiment = read.table(header = TRUE, text = 
" V1  N mean  
0.1  9 0.9 
  1  9 0.8 
 10  9 0.1 
  5  9 0.2")

library(drc)

m.ll2 <- drm(mean ~ V1,
  data = myExperiment,
  type = "binomial", 
  fct = LL.2(),
  weights = N)

plot(m.ll2, ylim = c(0, 1))


来源:https://stackoverflow.com/questions/39515799/sigmoidal-modeling-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!