Displaying 20 results from an estimated 20000 matches similar to: "how to show iterations"
2007 Apr 23
4
Estimates at each iteration of optim()?
I am trying to maximise a complicated loglikelihood function with the "optim" command. Is there some way to get to know the estiamtes at each iteration? When I put "control=list(trace=TRUE)" as an option in "optim", I just got the initial and final values of the loglikelihood, number of iterations and whether the routine has converged or not. I need to know the
2004 Nov 30
1
lme in R-2.0.0: Problem with lmeControl
Hello!
One note/question hier about specification of control-parameters in the
lme(...,control=list(...)) function call:
i tried to specify tne number of iteration needed via
lme(....,control=list(maxIter=..., niterEM=...,msVerbose=TRUE))
but every time i change the defualt values maxIter (e.g. maxIter=1,
niterEM=0) on ones specified by me, the call returns all the iterations
needed until
2010 Aug 06
1
on the optim function
Dear useRs,
I have just discovered that the R optim function does not return the number of iterations.
I still wonder why line 632-634 of optim C, the iter variable is not returned (for the BFGS method for example) ?
Is there any trick to compute the iteration number with function call number?
Kind regards
Christophe
--
Christophe Dutang
Ph.D. student at ISFA, Lyon, France
website:
2017 Aug 24
1
Problem in optimization of Gaussian Mixture model
Hello,
I am facing a problem with optimization in R from 2-3 weeks.
I have some Gaussian mixtures parameters and I want to find the maximum in
that
*Parameters are in the form *
mean1 mean2 mean3 sigma1 sigma2 sigma3 c1 c2 c3
506.8644 672.8448 829.902 61.02859 9.149168 74.84682 0.1241933
0.6329082 0.2428986
I have used optima and optimx to find the
2009 Nov 18
1
bug in '...' of constrOptim (PR#14071)
Dear all,
There appears to be a bug in how constrOptim handles ... arguments that
are suppose to be passed to optim, according to the documentation. This
means you can't get the hessian to be returned, for example (so this is
a real problem, and not just a question of mistaken documentation).
Looking at the code, it appears that a call to the user-defined f
includes the ..., when the ...
2011 Dec 20
1
constrOptim and problem with derivative
Dear List,
I am using constrOptim to solve the following
fr1 <- function(x) {
b0 <- x[1]
b1 <- x[2]
((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3
}
As you can see, my objective function is
((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3 and I would
like to solve for both b0 and b1.
If I were to use optim then I would derive the gradient of the
2006 Feb 06
3
iteration history
Dear R Users
I would like to use optim function to optimize a function. I read help but I
couldn't find what I need: is it possible to get information after each
iteration, for example as there is in MATLAB:
Gradient's
Iteration Func-count f(x) Step-size infinity-norm
0 24 388.976
2002 Jun 28
1
Problem in optim(method="L-BFGS-B") (PR#1717)
Full_Name: Jörg Polzehl
Version: 1.5.1
OS: Windows 2000
Submission from: (NULL) (193.175.148.198)
When calculating MLE's in a variance component model using constrained
optimization, i.e. optim(...,method="L-BFGS-B",...) I observed an inproper
behaviour in cases where
the likelihood function was evalueted at the constraint. Parameters and value of
the
function at the constraint
2003 Oct 29
1
constrOptim doesn´t send arguments to optim!(?)
Hi,
I think that there something wrong with the 'constrOptim' max/minimization
function because she doesn?t send extra arguments to 'optim' call.
Fact: When I use optim in a f(x,theta)-like function, everything goes ok.
But using constrOptim with the same function leads to error...
Proof: Make a small change in the 'Rosenbrock Banana function' (taken from
the Examples
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
On 03/05/2019 10:31, Serguei Sokol wrote:
> On 02/05/2019 21:35, Florian Gerber wrote:
>> Dear all,
>>
>> when using optim() for a function that uses the parent environment, I
>> see the following unexpected behavior:
>>
>> makeFn <- function(){
>> ???? xx <- ret <- NA
>> ???? fn <- function(x){
>> ??????? if(!is.na(xx)
2011 Sep 02
5
Hessian Matrix Issue
Dear All,
I am running a simulation to obtain coverage probability of Wald type
confidence intervals for my parameter d in a function of two parameters
(mu,d).
I am optimizing it using "optim" method "L-BFGS-B" to obtain MLE. As, I
want to invert the Hessian matrix to get Standard errors of the two
parameter estimates. However, my Hessian matrix at times becomes
2019 May 02
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Dear all,
when using optim() for a function that uses the parent environment, I
see the following unexpected behavior:
makeFn <- function(){
??? xx <- ret <- NA
??? fn <- function(x){
?????? if(!is.na(xx) && x==xx){
?????????? cat("x=", xx, ", ret=", ret, " (memory)", fill=TRUE, sep="")
?????????? return(ret)
?????? }
?????? xx
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Yes, I think you are right. I was at first confused by the fact that after the optim() call,
> environment(fn)$xx
[1] 10
> environment(fn)$ret
[1] 100.02
so not 9.999, but this could come from x being assigned the final value without calling fn.
-pd
> On 3 May 2019, at 11:58 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> Your results below make it look like a
2011 Dec 21
1
constrOptim and further arguments
Dear List,
I have the code below, where I am using the constrained optimisation
package, 'constrOptim.nl' to find the values of two values, b0 and b1.
I have no problems when I enter further variable information DIRECTLY into
the functions, fn, and heq. In this instance I require fn to have -0.0075
appended to it, and in the case of heq, h[1] has -0.2.
library(alabama)
2007 Sep 10
2
Are the error messages of ConstrOptim() consisten with each other?
Dear Friends.
I found something very puzzling with constOptim(). When I change the
parameters for ConstrOptim, the error messages do not seem to be
consistent with each other:
> constrOptim(c(0.5,0.3,0.5), f=fit.error, gr=fit.error.grr, ui=ui,ci=ci)
Error in constrOptim(c(0.5, 0.3, 0.5), f = fit.error, gr = fit.error.grr, :
initial value not feasible
> constrOptim(c(0.5,0.9,0.5),
2019 May 06
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Optim's Nelder-Mead works correctly for this example.
> optim(par=10, fn=fn, method="Nelder-Mead")
x=10, ret=100.02 (memory)
x=11, ret=121 (calculate)
x=9, ret=81 (calculate)
x=8, ret=64 (calculate)
x=6, ret=36 (calculate)
x=4, ret=16 (calculate)
x=0, ret=0 (calculate)
x=-4, ret=16 (calculate)
x=-4, ret=16 (memory)
x=2, ret=4 (calculate)
x=-2, ret=4 (calculate)
x=1, ret=1
2007 Jan 03
1
optim
Hi!
I'm trying to figure out how to use optim... I get some really strange results, so I guess I got something wrong.
I defined the following function which should be minimized:
errorFunction <- function(localShifts,globalShift,fileName,experimentalPI,lambda)
{
lambda <- 1/sqrt(147)
# error <- abs(errHuber(localShifts,globalShift,
#
2009 Feb 24
2
Tracing gradient during optimization
Hi everyone,
I am currently using the function optim() to maximize/minimize functions and
I would like to see more output of the optimization procedure, in particular
the numerical gradient of the parameter vector during each iteration.
The documentation of optim() describes that the trace parameter should allow
one to trace the progress of the optimization.
I use the following command:
2018 Apr 06
3
Obtain gradient at multiple values for exponential decay model
> On Apr 6, 2018, at 8:03 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Apr 6, 2018, at 3:43 AM, g l <gnulinux at gmx.com> wrote:
>>
>>> Sent: Friday, April 06, 2018 at 5:55 AM
>>> From: "David Winsemius" <dwinsemius at comcast.net>
>>>
>>>
>>> Not correct. You already have
2018 Apr 07
0
Obtain gradient at multiple values for exponential decay model
I have never found the R symbolic differentiation helpful because my
functions are typically quite complicated, but was prompted by Steve
Ellison's suggestion to try it out in this case:
################# reprex (see reprex package)
graphdta <- read.csv( text =
"t,c
0,100
40,78
80,59
120,38
160,25
200,21
240,16
280,12
320,10
360,9
400,7
", header = TRUE )
nd <- c( 100, 250,