【发布时间】:2021-11-20 19:02:30
【问题描述】:
我在实现 MLE 和 NLS 模型以进行我正在尝试执行的某些估计时遇到了一些问题。模型如下
Y=A*(K^b_1)*(L^b_2)+e
其中 e 只是误差项,B 和 D 是输入变量。目标是尝试估计 b_1 和 b_2。我的第一个等式是,我如何将它放入 nls 函数中,因为当我尝试这样做时,我得到以下错误
prod.nls<-nls(Y~A*(K^Beta_1)*(L^Beta_2), start =list(A = 2, Beta_1= 2, Beta_2=2))
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
我的另一个问题是上面的模型可以用日志重写, log(Y)= log(A)+b_1log(K)+b_2log(L)
我省略了错误项,因为它变得不敬而 A 只是一个标量,所以我也将其省略了。但是,当我使用 mle 函数将该模型放入 R 时,会出现如下错误,
prod.mle<-mle(log(Y)~log(K)+log(L))
Error in minuslogl() : could not find function "minuslogl"
In addition: Warning messages:
1: In formals(fun) : argument is not a function
2: In formals(fun) : argument is not a function
下面提供了一个来自数据集的值的小表,以便能够重现这些错误。 提前感谢您的帮助。
| Y | K | L |
|---|---|---|
| 26971.71 | 32.46371 | 3013256.014 |
| 330252.5 | 28.42238 | 135261574.9 |
| 127345.3 | 5.199048 | 39168414.92 |
| 3626843 | 327.807 | 1118363069 |
| 37192.73 | 16.01538 | 9621912.503 |
【问题讨论】:
标签: r non-linear-regression mle