search for: parscal

Displaying 20 results from an estimated 57 matches for "parscal".

Did you mean: pascal
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 valu...
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 should be comparable in the sense that a unit change in any element produces about a unit change in the scaled va...
2005 Apr 26
2
"wild" function example in optim
Dear all, Firstly, I do apologize if my question is simple and posted in the wrong place but I had no reply from the R-help mailing list (maybe it is too simple!). I was wondering why parscale is set to 20 in the "wild" function example used in ?optim. This function has only one parameter and if we set parscale equal to 1 then the solution near the global minimum is not found. I would use parscale only in cases the object function has more than one parameter to be optimised,...
2008 Mar 23
2
scaling problems in "optim"
Dear R users, I am trying to figure out the control parameter in "optim," especially, "fnscale" and "parscale." In the R docu., ------------------------------------------------------ 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 ve...
2008 Feb 08
0
scaling and optim
...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. Optimization is performed on 'par/parscale' and these should be comparable in the sense that a unit change in any element produces about a unit change in the scaled value. 1. Does the final phrase 'produ...
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 parscale parameter so that it works right? I am very grateful for an answer - R leaves sometimes some of the parameters unchanged...
2009 Mar 02
0
Optim parscale?
I am not clear on what is happening with parscale in optim It seems that scaling the parameters will produce unpredictable results in a non-linear function (which is the purpose of optim right?) The documentation states: parscale A vector of scaling values for the parameters. Optimization is performed on par/parscale and these should be compara...
2011 May 25
1
L-BFGS-B and parscale in optim()
Hi, When using method L-BFGS-B along with a parscale argument, should the lower and upper bounds provided be on the scaled or unscaled values? Thanks. Cheers, -- Seb
2012 Aug 18
1
Parameter scaling problems with optim and Nelder-Mead method (bug?)
...(c(-2999,50001), f4) -2999.0, 50001.0 2001.1, 50001.0 -2999.0, 55001.1 -7999.1, 55001.1 However, the function to optimise is the same in all cases, only translated, not scaled, so the step size *should* be the same. From reading the documentation, it looks like changing the parscale should work, and *relative* changes have the intended effect. Example: optim(c(1,1), f1, control=list(parscale=c(1,5))) gives the function evaluations 1.0, 1.0 1.1, 1.0 1.0, 1.5 1.1, 0.5 But changing both values, e.g., optim(c(1,1), f1, control=list(parscale=c(500,500))...
2008 May 16
0
How to determine sensible values for 'fnscale' and 'parscale' in optim
Dear R-help, I'm using the 'optim' functions to minimise functions, and have read the documentation, but I'm still not sure how to determine sensible values to use for the 'fnscale' and 'parscale' options. If I have understood everything correctly, 'fnscale' should be used to scale the objective function, so that for example if the default is 'sensible' (or even 'optimal') for minimising 'f', one should use 'fnscale=1e-6' for minimizing the func...
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", lower=c(rep(-1,n),1e-5,1e-5,1e5) ,upper=c(rep(5,n),1.29,100,1.9),control=list(p...
2012 Apr 05
4
Appropriate method for sharing data across functions
...does not seem to be usable from source() i.e., cannot be interpreted but must be built first. JN Example using <<- rm(list=ls()) optstart<-function(npar){ # create structure for optimization computations # npar is number of parameters ?? test?? OPCON<<-list(MAXIMIZE=TRUE, PARSCALE=rep(1,npar), FNSCALE=1, KFN=0, KGR=0, KHESS=0) # may be other stuff ls(OPCON) } add1<-function(){ OPCON$KFN<<-1+OPCON$KFN test<-OPCON$KFN } OPCON<<-list(MAXIMIZE=TRUE, PARSCALE=rep(1,4), FNSCALE=1, KFN=0, KGR=0, KHESS=0) ls(OPCON) print(add1()) p...
2008 Jul 05
3
Editing the "..." argument
...n 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 = something" if the user has not specified it already. Do you know a way to deal with this point? In advance, thanks. Mathieu -- Institute of Mathematics Ecole Polytechnique F?d?rale de Lausanne STAT-IMA-FSB-EPFL, Station 8 CH-1015 Lausanne Switzerland http://stat.epfl.ch/ Tel: + 41 (0...
2009 Mar 06
0
modifying a built in function from the stats package (fixing arima) (CONCLUSIONS)
...ind <- arma[1] + arma[2] + seq_len(arma[3]) if (any(!mask[seq_len(arma[1])]) || any(!mask[ind])) { warning("some AR parameters were fixed: setting transform.pars = FALSE") transform.pars <- FALSE } } init0 <- rep(0, narma) parscale <- rep(1, narma) if (ncxreg) { cn <- colnames(xreg) orig.xreg <- (ncxreg == 1) || any(!mask[narma + 1:ncxreg]) if (!orig.xreg) { S <- svd(na.omit(xreg)) xreg <- xreg %*% S$v } fit <- lm(x ~ xreg - 1, na.action =...
2010 Jul 05
3
selection of optim parameters
...much experience using optimizatzion methods. That's why I am asking you. Do you have any hints for me what should be taken into account when doing such an optimization. Is there a good way to implement the boundaries into the code (instead of doing it while optimizing)? I've read about parscale in the help-section. Unfortunately I don't really know how to use it. And anyways, could this help? What other points/controls should be taken into account? I know that this might be a bit little information about my current code. But I don't know what you need to give me some advise....
2015 May 20
2
Fix for bug in arima function
...n.used <- sum(!is.na(resid(fit))) - length(Delta) + } else { + n.used <- sum(!is.na(resid(fit))) } - n.used <- sum(!is.na(resid(fit))) - length(Delta) init0 <- c(init0, coef(fit)) ses <- summary(fit)$coefficients[, 2L] parscale <- c(parscale, 10 * ses) The patch that introduced the bug ( https://github.com/wch/r-source/commit/32f633885a903bc422537dc426644f743cc645e0 ) was designed to change the initialization for the optimization routine. The proposed fix leaves the deliberate part of the patch unchanged (it preserv...
2006 May 01
1
Problem with optim()
...S-B" method. When I set the lower limit for the third parameter equal to zero I get an error message: > low.lim.3 <- 0 > phi_opt <- optim(phi_, model_lik, NULL, method = "L-BFGS-B", lower=c(0.2, -100, low.lim.3, 0), upper= c(10, 100, 10, 10), control = list(maxit = 1000, parscale = c(0.2, u1, 0.002, 0.002), trace = 0, REPORT = 3), hessian = FALSE) Error in chol(M) : the leading minor of order 1 is not positive definite However, setting that limit just above zero fixes things: > low.lim.3 <- 0.001 > phi_opt <- optim(phi_, model_lik, NULL, method = "L-BFGS...
2008 Apr 05
2
How to improve the "OPTIM" results
...3)) - (2/n)*(sum(w1*dnorm((x-mu1)/sqrt(exp(g1)))/sqrt(exp(g1)) + w2*dnorm((x-mu2)/sqrt(exp(g2)))/sqrt(exp(g2)) + w3*dnorm((x-mu3)/sqrt(exp(g3)))/sqrt(exp(g3)) ))) return(obj) } optim(theta0, fr2, method=BFGS", control = list (fnscale=10, parscale=c(.01,.01,.01,.01,.01,1,1,1), maxit=100000)) -- View this message in context: http://www.nabble.com/How-to-improve-the-%22OPTIM%22-results-tp16509144p16509144.html Sent from the R help mailing list archive at Nabble.com.
2008 Apr 05
2
How to improve the "OPTIM" results
...3)) - (2/n)*(sum(w1*dnorm((x-mu1)/sqrt(exp(g1)))/sqrt(exp(g1)) + w2*dnorm((x-mu2)/sqrt(exp(g2)))/sqrt(exp(g2)) + w3*dnorm((x-mu3)/sqrt(exp(g3)))/sqrt(exp(g3)) ))) return(obj) } optim(theta0, fr2, method=BFGS", control = list (fnscale=10, parscale=c(.01,.01,.01,.01,.01,1,1,1), maxit=100000)) -- View this message in context: http://www.nabble.com/How-to-improve-the-%22OPTIM%22-results-tp16509144p16509144.html Sent from the R help mailing list archive at Nabble.com.
2015 May 21
2
Fix for bug in arima function
...gt;> + } else { >> + n.used <- sum(!is.na(resid(fit))) >> } >> - n.used <- sum(!is.na(resid(fit))) - length(Delta) >> init0 <- c(init0, coef(fit)) >> ses <- summary(fit)$coefficients[, 2L] >> parscale <- c(parscale, 10 * ses) >> > > Yes, such a change *is* small in the source code. > But we have to be sure about its desirability. > > In another post about this you mention "REML", and I think we > really are discussing if variance estimates should use a &...