我正在尝试使用ROI对ARCH(2)进程执行MLE估计。我尝试使用F_constraint函数通过将特征方程的根设为z ^ 2-alpha1 * z-alpha2置于单位圆内来施加协方差平稳性。我正在使用deoptimr求解器插件。我为所有三个参数指定了起始值-(omega {ARCH eqn中的constant term},alpha1,alpha2)。我收到一条错误消息,说缺少功能约束的参数。
library(ROI)
obj <- F_objective(F = log_lik, n =3, G = grad_lik, names = c('om','aph1','aph2'))
mod_func1 <- function(om,aph1,aph2){
delta = aph1^2 + 4*1*aph2
if(delta >= 0){
x_1 = (aph1+sqrt(delta))/(2*1)
return(x_1)
} else {
mod = (aph1^2 + (-(delta)))/((2*1)^2)
return(mod)
}
}
mod_func2 <- function(om,aph1,aph2){
delta = aph1^2 + 4*1*aph2
if(delta >= 0){
x_2 = (aph1-sqrt(delta))/(2*1)
return(x_2)
} else {
mod = (aph1^2 + (-(delta)))/((2*1)^2)
return(mod)
}
}
constr <- F_constraint(F = list(mod_func1,mod_func2), dir = c("<","<"), rhs = c(1,1), names = c('om','aph1','aph2'))
prob <- OP(objective = obj, constraints = constr, maximum = TRUE)
solvers <- ROI_applicable_solvers(prob)
soln <- ROI_solve(prob, solver = "deoptimr", start = c(0.01,0.5,0.5))
错误显示“ f(x0)中的错误:缺少参数“ aph1”,没有默认值”