[R] Stuck using constrOptim

dre968 alyalko at gmail.com
Thu Apr 23 23:23:13 CEST 2009


if i run the same program with 
constrOptim(p0,minsquare,keys=keys,benKeys=benKeys,NULL,ui=A,ci=B,method="BFGS")

i get the following error:
Error in dR(theta, theta.old, ...) : could not find function "grad"

i'm not very mathematically inclined, i dont even know what a gradient is. 
any suggestions?


dre968 wrote:
> 
> Trying to use constrOptim to minimize the sum of squared deviations.  I
> put the objective function in as: sum((x %*% Y - Z)^2) so i'm trying to
> get values for x to minimize the sum of the squared deviations between the
> product of x and Y and Z.  
> 
> Anyways i have no problem using this when x is a 3x1 test variable.  it
> works great with the constraints and everything.  when i actually use it
> on my data x is 3x900 or so and it wont optimize it just gives me back my
> initial guess....this is the output i'm getting:
> 
> $value
> [1] 22.7438
> 
> $counts
> function gradient 
>      906       NA 
> 
> $convergence
> [1] 1
> 
> $message
> NULL
> 
> $outer.iterations
> [1] 1
> 
> $barrier.value
> [1] 1.381551e-06
> 
> this is definitely not the right answer and it is just spitting back my
> initial guess back.  
> 
> Any ideas?  are there limits as to how big the variables can be for this
> function?
> 

-- 
View this message in context: http://www.nabble.com/Stuck-using-constrOptim-tp23197912p23203595.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list