4个参数NLS的起始值-Chapman Richards函数 [英] Starting values for 4 parameter NLS - Chapman Richards function

查看:93
本文介绍了4个参数NLS的起始值-Chapman Richards函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

*注意-我已经阅读了几篇有关如何查找NLS起始值的文章-但是,我还没有找到一种具有这种形式的方程式(即4个参数,指数被乘幂)的

*Note - I have read several of the posts on how to find starting values for NLS - however, I have not found one with an equation of this form (i.e. 4 parameters, exponent raised to a power)

我正竭尽全力为查普曼·理查兹(Chapman Richards)方程寻找合适的起始值,该方程通常在林业中用于树的生长建模.

I am struggling tremendously to find suitable starting values for the Chapman Richards equation, which is commonly used in forestry to model tree growth.

y(t) = α * (1 - β * exp(-k * t)^{1/(1-m)})

我通常尝试通过绘制一条带有设置参数的线来找到初始值,然后对其进行调整以使其更紧密地适合数据(图1).之后,我将使用函数中的参数:

I typically try to find initial values by plotting a line with set parameters, and then tweaking it to fit the data more closely (Image 1). After this I would use the parameters in the function:

initial.test <- chapmanRichards(seq(0:15),42,0.95,0.28, 0.67)
plot(age,topHeight,type="p",xlab="year since planting",ylab="Dom height (m)", xlim = c(0,20), ylim = c(0, 50))
lines(seq(0:15),initial.test,col="red")

nls(topHeight ~ chapmanRichards(age,a,b,k,m),start=list(a=42,b=0.95,k=0.28,m=0.67))

在这种情况下,程序可以使用提供的起始值来拟合曲线.但是,问题是,当数据有点嘈杂,并且在对初始测试值进行2小时的摆弄后,我仍然找不到足够好的起始值(图2显示了对另一个数据集的几次尝试.

In this case, the program is able to fit the curve with the starting values provided. The problem, however, is when the data is a bit noisy, and after 2 hours of fiddling with the initial test values, I still can't find good enough starting values (Image 2 shows a few attempts on another dataset.

任何人都可以建议找到合适的起始值的好方法吗?我曾考虑过创建一个矩阵,该矩阵基本上为每个参数运行一个序列,并使用这些起始值循环nls,但不确定代码的外观.任何其他建议将不胜感激!

Can anyone advise on what a good way would be to find suitable starting values? I have thought of creating a matrix that basically runs a sequence for each of the parameters and looping the nls with those starting values, but not sure how the code would look. Any other advice would be greatly appreciated!

PS-这会更适合Excel-求解器吗?

PS - would this be something more suited to Excel - solver?

推荐答案

正如@Roland在评论中指出的那样,问题中显示的方程式中的参数无法识别,因此假设方程式如他所示:

As @Roland pointed out in the comments the parameters in the equation shown in the question are not identifiable so assuming the equation is as he showed:

y = a * (1 - b * exp(-k * t))^{1/(1-m)}

取双方的日志:

log(y) ~ log(a) + (1/(1-m)) * log(1 - b * exp(-k*t))

并令log(a)= A,1/(1-m)= M且b = exp(k * B)给出:

and let log(a) = A, 1/(1-m) = M and b = exp(k*B) giving:

log(y) ~ A + M * log(1 - exp(k*(B-t))

由于B是一个偏移量,而k是一个缩放比例,我们可以将它们估计为B = mean(t)和k = 1/sd(t).使用 algorithm ="plinear" ,我们可以避免线性参数(A和M)的起始值,前提是我们将右侧指定为矩阵,使得A乘以第一列,M乘以第二列.将给出预测值.因此,我们有:

Since B is an offset and k is a scaling we can estimate them as B = mean(t) and k = 1/sd(t). Using algorithm = "plinear" we can avoid starting values for the linear parameters (A and M) provided we specify the right hand side as a matrix such that A times the first column plus M times the second column would give the predicted value. Thus we have:

st <- list(B = mean(t), k = 1/sd(t))
fm0 <- nls(log(y) ~ cbind(1, log(1 - exp(k*(B - t)))), start = st,
  algorithm = "plinear")

,然后对获得的系数进行反变换,以获取运行最终的 nls 的起始值.

and then back transform the coefficients so obtained to get the starting values for running the final nls.

还要注意,nls2软件包中的 nls2 可以在网格上或在随机的一组点上评估模型以获得初始值.

Also note that nls2 in the nls2 package can evaluate the model on a grid or at a random set of points to get starting values.

这篇关于4个参数NLS的起始值-Chapman Richards函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆