简体   繁体   English

R中的S形建模

[英]Sigmoidal Modeling in R

I am currently trying to model and plot a sigmoidal curve with a low amount of points. 我目前正在尝试建模和绘制具有少量点的S形曲线。

>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. 我正在使用minpack.lm包中的nlsLM函数。

> 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. 我对统计资料的研究不够深入,不知道这是语法R错误还是统计信息失败。 What am I doing poorly? 我做得不好吗?

-Thanks -谢谢

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. 无论如何,我都会提出一个更简单的模型,如两个参数的对数逻辑模型,渐近线分别为0和1。在drc包中已经编码了许多S形模型。

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))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM