Re: [R] Parameters setting in functions optimization

2011-11-30 Thread Diane Bailleul
Dear Florent, I know that I'm asking to optim to minimize my values, and that the results with a lower fvalue are best supported than those with a higher fvalue. My comment was just from a data point of view. I'd like the lower ms (second parameter) as possible, as well as the fvalue. So a ms o

Re: [R] Parameters setting in functions optimization

2011-11-30 Thread John C Nash
v 2011 19:15:43 +0100 > From: Diane Bailleul > To: r-help@r-project.org > Subject: [R] Parameters setting in functions optimization > Message-ID: <4ed5214f.7030...@u-psud.fr> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Good afternoon everybody, &g

Re: [R] Parameters setting in functions optimization

2011-11-30 Thread Florent D.
With optimx(c(30,50),ms=c(0.4,0.5), fn=LogLiketot) where LogLiketot<- function(dist,ms) { res <- NULL for(i in 1:nrow(pop5)) { for(l in 1:nrow(freqvar)) { res <- c(res, pop5[i,l]*log(LikeGi(l,i,dist,ms))) } } return(-sum(res)) } I think it will do something l

Re: [R] Parameters setting in functions optimization

2011-11-30 Thread Diane Bailleul
Le 11/30/2011 2:09 AM, Florent D. a écrit : Thanks for your answer ! I also think your last write-up for LogLiketot (using a single argument "par") is the correct approach if you want to feed it to optim(). I'm not dedicated to optim() fonction. I just want to optimise my two parameters and the

Re: [R] Parameters setting in functions optimization

2011-11-29 Thread Florent D.
Oh, and your message: In log(LikeGi(l, i, par[1], par[2])) : NaNs produced means your LikeGi is returning something negative. Can't take the log of it... On Tue, Nov 29, 2011 at 8:09 PM, Florent D. wrote: > I also think your last write-up for LogLiketot (using a single > argument "par") is the

Re: [R] Parameters setting in functions optimization

2011-11-29 Thread Florent D.
I also think your last write-up for LogLiketot (using a single argument "par") is the correct approach if you want to feed it to optim(). So now you have a problem with log(LikeGi(l, i, par[1], par[2])) for some values of par[1] and par[2]. Where is LikeGi coming from? a package or is it your ow

[R] Parameters setting in functions optimization

2011-11-29 Thread Diane Bailleul
Good afternoon everybody, I'm quite new in functions optimization on R and, whereas I've read lot's of function descriptions, I'm not sure of the correct settings for function like "optimx" and "nlminb". I'd like to minimize my parameters and the loglikelihood result of the function. My paramet