> param_init=c(t(par$beta),par$sigma,t(par$sigmab),par$corr)
>
> if (indcor==1)
+ {
+ param_min=c(-100,-100,-100,-100,-100,-100,0.05,0.05,0.05,0.05,0.05,-1)
+ param_max=c(100, 100 ,100, 100, -1, 5 ,1000 ,1000 ,1000 ,1000 ,1000, 1)
+ }
> if (indcor==0)
+ {
+ param_min = c(-100, -100, -100, -100 ,-100 ,-100 ,0.05,0.05 ,0.05 ,0.05 ,0.05 ,par$corr)
+ param_max = c(100 ,100,100,100,-1,5,1000,1000,1000,1000,1000,par$corr)
+ }
>
> # the algorithm should satisfy A*X<=B
> R=optimize(Qinv,lower=param_min,upper=param_max,maximum=FALSE,tol=0.0001,D=D,ran=ran,freq=freq)
错误于solve.default(cov, ...) : 系统计算上是奇异的: 倒条件数=0
>
由于对R还不太熟悉,还请各位大侠指教
【请教】optimize在运行时出现系统计算是奇异的:倒条件数=0的错误
This has little to do with optimize, which is essentially a golden-section search that makes no use of hessian/gradient. That is, optimize should not involve any other matrix inversion calls. Thus, you need to check your own objective function, i.e., Qinv, for any constraints needed for it to be sensible.
回复 第2楼 的 RemembeR discoveR, invent:If I would like the objective remain the same ,what function or package can be applied to this kind of optimization problem? much thanks