Re: [R] Stuck using constrOptim

2009-04-24 Thread dre968
I'm very interested. If you wouldn't mind I would love to see it. Thank you for the help. 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 s

Re: [R] Stuck using constrOptim

2009-04-23 Thread Ravi Varadhan
Sent: Thursday, April 23, 2009 5:23 PM To: r-help@r-project.org Subject: Re: [R] Stuck using constrOptim if i run the same program with constrOptim(p0,minsquare,keys=keys,benKeys=benKeys,NULL,ui=A,ci=B,method="BF GS") i get the following error: Error in dR(theta, theta.old, ...) : coul

Re: [R] Stuck using constrOptim

2009-04-23 Thread dre968
so i set gr=Null: > constrOptim(p0,minsquare,Y=Y,Z=Z,NULL,gr=NULL,ui=A,ci=B,method="BFGS") and i recieved the following error: Error in optim(theta.old, fun, gradient, control = control, method = method, : objective function in optim evaluates to length 0 not 1 -- View this message in context

Re: [R] Stuck using constrOptim

2009-04-23 Thread dre968
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 suggesti

Re: [R] Stuck using constrOptim

2009-04-23 Thread Ravi Varadhan
ent: Thursday, April 23, 2009 4:22 PM To: r-help@r-project.org Subject: Re: [R] Stuck using constrOptim Sorry for the not enough info. the code seems to work for 10 or so variables but stops optimizing if i give it anymore than that. #Load data Data <- read.table..csv',head=TRUE,sep=

Re: [R] Stuck using constrOptim

2009-04-23 Thread dre968
Sorry for the not enough info. the code seems to work for 10 or so variables but stops optimizing if i give it anymore than that. #Load data Data <- read.table..csv',head=TRUE,sep=",",stringsAsFactors = FALSE) #Load goal variables. this is what i'm trying to minimize to Z<-read.tablecsv

Re: [R] Stuck using constrOptim

2009-04-23 Thread Ravi Varadhan
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of dre968 Sent: Thursday, April 23, 2009 3:20 PM To: r-help@r-project.org Subject: [R] Stuck using constrOptim Trying to use constrOptim to minimize the

Re: [R] Stuck using constrOptim

2009-04-23 Thread dre968
Sorry i Mean 900x1 not 3x900 below 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

[R] Stuck using constrOptim

2009-04-23 Thread dre968
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 3