Munjal Patel
2013-Sep-26 20:47 UTC
[R] ConstrOptim Function (Related to Constraint Matrix/ui/ci error)
Hello All, I am stuck in the following problem. Cexpt=c(0,25,50,100,150,300,250,125,40) t=c(0,0.2,0.4,0.6,1,4,8,12,24) theta0= vector of 6 parms (My initial parameter) A=Constraint matrix (hopefully 6*6) B= Constraint vector of length 6) Cfit=function(t,theta){ J(t)=function(theta,t) Cfit=function(J(t),constant) return(Cfit) } loss=function(theta,t,Cexpt) { sum(Cexpt- Cfit(t,theta))^2} Final=constrOptim(theta0,loss,t,Cexpt,NULL,A,B) When i try to fit it gives me error ERROR IN UI%*% THETA : MATRIX/VECTOR/COMPLEX ARGUEMENTS REQUIRED OR SOMETHING... thank you all. M J [[alternative HTML version deleted]]