简体   繁体   English

在指数衰减中设置截距

[英]Set intercept in exponential decay

I am trying to fit my data to an exponential model 我正在尝试使我的数据适合指数模型

y=exp(a-b*x)

The value of y in x=0 must be exactly 13.75, so I want to set the intercept before I fit the data. x=0y的值必须正好是13.75,因此我想在拟合数据之前设置截距。

a=log(13.75)

I am using the function gnm . 我正在使用功能gnm I have read that I am supposed to use constrain or constrainTo to set the coefficients; 我已经读过我应该使用constrainconstrainTo来设置系数。 however, I can't understand how to do it. 但是,我不知道该怎么做。

x=seq(0,3120,120)

y= c(13.75, 13.74, 13.73, 13.71, 13.70, 13.69, 13.68,
     13.66, 13.65,13.64, 13.64, 13.63, 13.63, 13.62,
     13.62, 13.61, 13.61, 13.60,13.60, 13.60, 13.60,
     13.59, 13.59, 13.59, 13.59, 13.59, 13.59)

xl<-gnm(y ~ Exp(1 - x), verbose = FALSE,constrain=????)
#

Hi, everybody. 大家好。 Thank you very much. 非常感谢你。 I've been working following your advice and I finally got a quite good fitting. 我一直在按照您的建议进行工作,终于找到了一个不错的选择。 Now I'll work on the weights to polish it. 现在,我将研究砝码以对其进行抛光。 I did this: 我这样做:

 xl<-gnm(y ~ Exp(1 + x) -1, verbose = FALSE, constrain="Exp(.+x).Intercept",constrainTo=a,start=c(a,-0.05), prior.weights=W,weights=W) 

There was a big problem too. 还有一个大问题。 I needed to substract a number from y, in order to place the horizontal asymptote of my data at zero. 为了将数据的水平渐近线设置为零,我需要从y中减去一个数字。

Using -1 in the Exp tells the mode not to set an intercept term in the exponential. Exp使用-1该模式不要在指数中设置截距项。 Try using this model: Exp(1 + x) -1 , to remove the actual y intercept. 尝试使用以下模型: Exp(1 + x) -1 ,删除实际的y截距。

To set the intercept in the exponential, you can try: 要将截距设置为指数,可以尝试:

xl<-gnm(y ~ Exp(1 + x) -1, verbose = FALSE,constrain="Exp(.+x).Intercept",constrainTo=a,start=c(a,-0.05))
xl

Had to input start parameters for the model to be estimated To choose the constrained parameter interactively, you can also do: 必须输入要估计的模型的开始参数要以交互方式选择约束参数,您还可以执行以下操作:

xl<-gnm(y ~ Exp(1 + x) -1, verbose = FALSE,constrain="[?]",constrainTo=a,start=c(a,-0.05))

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

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