similar to: L-BFGS-B and parscale in optim()

Displaying 20 results from an estimated 6000 matches similar to: "L-BFGS-B and parscale in optim()"

2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All, I am trying to solve the optimization problem below, but I am always getting the following error: Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, : L-BFGS-B needs finite values of 'fn' Any ideas? Thanks in advance, Paul ----------------------------------------------- k <- 10000 b <- 0.3 f <- function(x) { n <- length(x)
2008 Jul 05
3
Editing the "..." argument
Dear all, I'd like tweaking the ... arguments that one user can pass in my function for fitting a model. More precisely, my objective function is (really) problematic to optimize using the "optim" function. Consequently, I'd like to add in the "control" argument of the latter function a "ndeps = rep(something, #par)" and/or "parscale =
2008 Jul 21
1
Control parameter of the optim( ): parscale
Hi everybody, I am using the L-BFGS-B method of the mle2() function to estimate the values of 6 parameters. mle2 uses the methods implemented in optim. As I got it from the descriptions available online, one can use the parscale parameter to tell R somehow what the values of the estimated parameters should be . . . Could somebody please help me understand what one has to do actually with the
2005 Apr 19
1
Optim(...parscale...)
Hi there, The optim(par, fn, ...parscale...) function in R requires 'parscale' which is defined as: "A vector of scaling values for the parameters. Optimisation is performed on 'par/parscale' and these should be comparable in the sense that a unit change in any element (??) produces a unit change in the scaled value". I am just not understanding the
2006 Aug 09
1
scaling constant in optim("L-BFGS-B")
Hi all, I am trying to find estimates for 7 parameters of a model which should fit real data. I have a function for the negative log likelihood (NLL) of the data. With optim(method="L-BFGS-B",lower=0) I am now minimizing the NLL to find the best fitting parameters. My problem is that the algorithm does not converge for certain data sets. I have read that one should scale the fn
2003 Jul 16
2
numerical differentiation in R? (for optim "SANN" parscale)
Dear R users, I am running a maximum likelihood model with optim. I chose the simulated annealing method (method="SANN"). SANN is not performing bad, but I guess it would be much more effecive if I could set the `parscale' parameter. The help sais: `parscale' A vector of scaling values for the parameters. Optimization is performed on `par/parscale' and these
2006 Dec 30
3
wrapping mle()
Hi, How can we set the environment for the minuslog function in mle()? The call in this code fails because the "ll" function cannot find the object 'y'. Modifying from the example in ?mle: library(stats4) ll <- function(ymax=15, xhalf=6) { -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE)) } fit.mle <- function(FUN, x, y) { loglik.fun <- match.fun(FUN)
2010 Mar 01
2
Advice wanted on using optim with both continuous and discrete par arguments...
Dear R users, I have a problem for which my objective function depends on both discrete and continuous arguments. The problem is that the number of combinations for the (multivariate) discrete arguments can become overwhelming (when it is univariate this is not an issue) hence search over the continuous arguments for each possible combination of the discrete arguments may not be feasible. Guided
2008 Aug 13
2
messing with ...
I'm looking for advice on manipulating parameters that are going to be passed through to another function. Specifically, I am working on my version of "mle", which is a wrapper for optim (among other optimizers). I would prefer not to replicate the entire argument list of optim(), so I'm using ... to pass extra arguments through. However: the starting values are
2006 Sep 17
2
histogram frequency weighing
Fellow R-helpers, Suppose we create a histogram as follows (although it could be any vector with zeroes in it): R> lenh <- hist(iris$Sepal.Length, br=seq(4, 8, 0.05)) R> lenh$counts [1] 0 0 0 0 0 1 0 3 0 1 0 4 0 2 0 5 0 6 0 10 0 9 0 4 0 [26] 1 0 6 0 7 0 6 0 8 0 7 0 3 0 6 0 6 0 4 0 9 0 7 0 5 [51] 0 2 0 8 0 3 0 4 0 1 0 1 0 3
2006 Jun 23
1
How to use mle or similar with integrate?
Hi I have the following formula (I hope it is clear - if no, I can try to do better the next time) h(x, a, b) = integral(0 to pi/2) ( ( integral(D/sin(alpha) to Inf) ( ( f(x, a, b) ) dx ) dalpha ) and I want to do an mle with it. I know how to use mle() and I also know about integrate(). My problem is to give the parameter values a and b to the
2010 Aug 18
2
'panel.smooth' error
Hi, The following call: xyplot(incidence ~ year, melanoma, panel=panel.smooth) produces a blank plot region with an error message: Error using packet 1 plot.new has not been called yet > sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8 LC_MONETARY=C
2008 Feb 08
0
scaling and optim
?optim says, in describing the control parameter, 'fnscale' An overall scaling to be applied to the value of 'fn' and 'gr' during optimization. If negative, turns the problem into a maximization problem. Optimization is performed on 'fn(par)/fnscale'. 'parscale' A vector of scaling values for the parameters.
2006 Jul 07
2
dotplot (lattice) with panel.segments and groups
Hi, The following produces almost exactly what I needed. The problems are that the 'panel.dotplot' call (commented) generates the error 'Error in NextMethod("[") : argument "subscripts" is missing, with no default'. The other problem is that the colors alternate between the levels of the 'site' variable, rather than 'year'. barley$yield2
2006 Sep 26
3
standardization of slot access
Hi, I'm usually confused about when to use 'slot' or '@'. I've frequently read that it's always preferable to use accessor functions, so I would think the '@' operator should be avoided. However, ?slot contains the following advise: "Generally, the only reason to use the functional form rather than the simpler operator is _because_ the slot name has to
2010 May 25
2
segplot (latticeExtra)
Hi, I'm having a bit of trouble with 'scales="free"' in the segplot() function of latticeExtra. Say we need panels for each year, showing only those counties that are represented in each one: ---<--------------------cut here---------------start------------------->--- library(latticeExtra) data(USCancerRates) uscr.w <- subset(USCancerRates, state ==
2011 Aug 14
2
Scaling problem in optim()
I am using the function optim and I get the error message ABNORMAL_TERMINATION_IN_LNSRCH. Reason for this could be a scaling problem. Thus, I used parscale in order to scale the parameters. But I still have the error message. For example, with parscale=c(rep(1,n), 0.01,1,0.01): return(optim(c(mu1,b,k,phi), neg2loglikelihood, method = "L-BFGS-B",
2003 Feb 28
2
optim
Dear all, I have a function MYFUN which depends on 3 positive parameters TETA[1], TETA[2], and TETA[3]; x belongs to [0,1]. I integrate the function over [0,0.1], [0.1,0.2] and [0.2,0.3] and want to choose the three parameters so that these three integrals are as close to, resp., 2300, 4600 and 5800 as possible. As I have three equations with three unknowns, I expect the exact fit, i.e., the SS
2007 Apr 23
2
summary and min max
Hi, I came across a case where there's a discrepancy between minimum and maximum values reported by 'summary' and the 'min' and 'max' functions: ---<---------------cut here---------------start-------------->--- R> str(tt) num [1:1397] 1952 1970 1976 1967 1946 ... R> summary(tt) Min. 1st Qu. Median Mean 3rd Qu. Max. 1920 1960 1970
2004 Jan 05
3
optim function : "BFGS" vs "L-BFGS-B"
Dear kind R-experts. Does anybody have an experience to use optim function? If yes, what is the main difference between two method "BFGS" vs "L-BFGS-B"? I used "BFGS" method and got what I wanted. But when I used "L-BFGS-B" the error message said that "L-BFGS-B needs finite values of fn". So that means "BFGS" method can handle even if fn