Re: [R] problem with optim()

2011-05-19 Thread Jonathan Daily
if this makes a difference or if you accounted for it, optim minimizes by default as outlined in the ?optim page. > >> Date: Thu, 19 May 2011 09:29:02 -0400 >> Subject: Re: [R] problem with optim() >> From: biomathjda...@gmail.com >> To: wolley.chir...@hotmail.com >>

Re: [R] problem with optim()

2011-05-19 Thread Jonathan Daily
What do you mean when you say "wrong results"? What do you expect for the output? Your code doesn't work for me because it references X in places and X is not defined. Have you tested your functions to make sure they return reasonable values? On Thu, May 19, 2011 at 9:17 AM, chirine wolley wrote

[R] problem with optim()

2011-05-19 Thread chirine wolley
Dear R-users, I would like to maximize the function g above which depends on 4 parameters (2 vectors, 1 real number, and 1 matrix) using optim() and BFGS method. Here is my code: # fonction to maximize g=function(x) { x1 = x[1:ncol(X)] x2 = x[(ncol(X)+1)] x3 = matrix(x[(ncol(X)+2):(ncol(

Re: [R] problem with optim and integrate

2008-03-21 Thread Uwe Ligges
kathie wrote: > Dear all, > > I want to min "integrate( (p1*dnorm+p2*dnorm+p3*dnorm)^(1.3))" for p, mu, > and sigma. > > So, I have to estimate 8 parameters(p3=1-p1-p2). > > I got this warning-"Error in integrate(numint, lower = -Inf, upper = Inf) : > non-finite function value." > > My questi

[R] problem with optim and integrate

2008-03-19 Thread kathie
Dear all, I want to min "integrate( (p1*dnorm+p2*dnorm+p3*dnorm)^(1.3))" for p, mu, and sigma. So, I have to estimate 8 parameters(p3=1-p1-p2). Sometimes I got some results, but it was bad, sometimes, I got this warning-"Error in integrate(numint, lower = -Inf, upper = Inf) : non-finite functio