You've identified a problem with the ismev package and it really is the package maintainers who are in the best position to fix it. As noted, box constraints (lower and upper) go OUTSIDE the control=list(). (Only L-BFGS-B has bounds in optim().)
This is also the case for many routines called by the optimx package (nlm, nlminb, bobyqa, Rvmmin, Rcgmin, etc.) Soon there'll be a Nelder-Mead variant and a Hooke & Jeeves with bounds/box constraints. A couple of routines also have masks, which are parameters that can be temporarily fixed for a run. These can be very useful for problems where one or two parameters are "usually" fixed or set to one of only a few values. This information may be of use for other package maintainers. For those wanting to use optimx, get in touch with me off-list. Which reminds me that I have to get in touch with someone who already mentioned they wanted some advice on just this matter. JN On 10/22/2011 06:00 AM, r-help-requ...@r-project.org wrote: > Message: 61 > Date: Fri, 21 Oct 2011 17:08:25 +0200 (CEST) > From: "NoSkill ButStyle" <noskillbutst...@web.de> > To: r-help@r-project.org > Subject: Re: [R] How to use gev.fit (package ismev) under box > constraints? > Message-ID: <594607686.882100.1319209705292.JavaMail.fmail@mwmweb023> > Content-Type: text/plain; charset="UTF-8" > > Hallo, > > it seems as if something did not work with my first email > > I would like to estimate parameters of a general extreme value (GEV) > distribution using maximum likelihood as implemented in the gev.fit function > of package ismev. If I do the follwing: > > y.training<- c(22, 22, 18, 19, 18, 18, 22, 27, 25, 19, 18, 21, 18, 20, 18, > 19, 18, 21, 29, 18, 22, 19, 19, 24, 18, 21, 22, 20, 20, 27, 18, 20, 20, 18, > 18, 18, 21, 18, 18, 21, 26, 19, 18, 19, 19, 18, 19, 18, 20, 20, 25, 21, 26, > 22, 20, 19, 22, 21, 21, 20, 20, 19, 18, 22, 22, 27, 19, 20, 26, 29, 18, 20, > 19, 22, 23, 18, 20, 20, 22, 18, 23, 18, 20, 19, 27, 21, 22, 18, 18, 19, 18, > 21, 18, 23, 18, 18, 20, 20, 24, 19, 18, 19, 19, 23, 19, 18, 25, 18, 24, 19) > fit<-gev.fit(xdat=y.training,show=F) > round(fit$mle,2) # 18.00 , 0.00 , 3.96 > > # The estimated shape parameter is 3.96. I would like to perform the > estimation under the constraint that the shape parameter is smaller than 1, > but the following does not work: > > fit<-gev.fit(xdat=y.training,show=F,method="L-BFGS-B",lower=c(0,0,-2),upper=c(50,10,1)) > round(fit$mle,2) # 18.09 , 0.27 , 3.05 > > It seems as is the "lower" and "upper" values are not passed to the optim > function in the way they should be. A warning says that they are only passed > to the "control" part of optim. Therefore my question: (How) is it possible > to use the gev.fit-function to perform the ML estimation under the constraint > that the shape parameter is smaller than 1? Or more general: Is it possible > to use the gev.fit function under box constraints as it should be possible > for optim? > > Thanks in advance. > > > > ------------------------------ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.