我有这个功能最大化:
funcToOpt <- function (theta1,theta2,theta3)
{
inner <- rowSums((wb + (theta1*X1+theta2*X2+theta3*X3) / Nt) * r)
innerU <- u(inner, gamma) # u() is another function
return (sum(innerU) / T)
}
fbb <- function(x) funcToOpt(x[1],x[2],x[3])
max <- optim(c(0,0,0),fbb,control=list(fnscale=-1))
其中:wb,X1,X2,X3,r
为TxN
矩阵,Nt
为长度为N
我想要那个
(wb + (theta1*X1+theta2*X2+theta3*X3) / Nt)
...不能假定negative
值。