similar to: Estimates at each iteration of optim()?

Displaying 20 results from an estimated 10000 matches similar to: "Estimates at each iteration of optim()?"

2007 May 24
3
Problem with numerical integration and optimization with BFGS
Hi R users, I have a couple of questions about some problems that I am facing with regard to numerical integration and optimization of likelihood functions. Let me provide a little background information: I am trying to do maximum likelihood estimation of an econometric model that I have developed recently. I estimate the parameters of the model using the monthly US unemployment rate series
2007 Apr 18
3
Problems in programming a simple likelihood
As part of carrying out a complicated maximum likelihood estimation, I am trying to learn to program likelihoods in R. I started with a simple probit model but am unable to get the code to work. Any help or suggestions are most welcome. I give my code below: ************************************ mlogl <- function(mu, y, X) { n <- nrow(X) zeta <- X%*%mu llik <- 0 for (i in 1:n) { if
2008 Mar 13
3
Use of ellipses ... in argument list of optim(), integrate(), etc.
Hi, I have noticed that there is a change in the use of ellipses or . in R versions 2.6.1 and later. In versions 2.5.1 and earlier, the . were always at the end of the argument list, but in 2.6.1 they are placed after the main arguments and before method control arguments. This results in the user having to specify the exact (complete) names of the control arguments, i.e. partial matching is
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:
2010 Sep 07
5
question on "optim"
Hey, R users I do not know how to describe my question. I am a new user for R and write the following?code for a dynamic labor economics?model and use OPTIM to get optimizations and parameter values. the following code does not work due to the?equation: ?? wden[,i]<-dnorm((1-regw[,i])/w[5])/w[5] where w[5]?is one of the parameters (together with vector a, b and other elements in vector
2007 Jun 20
4
finding roots of multivariate equation
Hello, I want to find the roots of an equation in two variables. I am aware of the uniroot function, which can do this for a function with a single variable (as I understand it...) but cannot find a function that does this for an equation with more than one variable. I am looking for something implementing similar to a Newton-Raphson algorithm. Thanks. -- Bill Shipley North American Editor for
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all, I have a function that predicts DV based on one predictor pred: pred<-c(0,3000000,7800000,15600000,23400000,131200000) DV<-c(0,500,1000,1400,1700,1900) ## I define Function 1 that computes the predicted value based on pred values and parameters a and b: calc_DV_pred <- function(a,b) { DV_pred <- rep(0,(length(pred))) for(i in 1:length(DV_pred)){ DV_pred[i] <- a *
2009 Nov 03
1
Passing Command to Optim in factanal
Hi, I am currently trying to execute the following command: f<-factanal(factors=k$Components$nparallel,covmat=m,n.obs=2287,rotation="varimax",control=list(opt=list(method=c("BFGS")))) but keep getting the error: L-BFGS-B needs finite values of 'fn' I can't figure out what I am doing wrong here, why isn't optim being told to use BFGS instead of L-BFGS-B...
2009 Oct 30
3
Fast optimizer
Hi, I'm using optim with box constraints to MLE on about 100 data points. It goes quite slow even on 4GB machine. I'm wondering if R has any faster implementation? Also, if I'd like to impose equality/nonequality constraints on parameters, which package I should use? Any help would be appreciated. Thank you. rc
2009 May 03
3
Optim function in the loop
Hi all, I wrote the following lines of codes try to do some iterations to find the global optimal values, but the function does not execute properly. Every time codes stop after one iteration right after executing the optim() function. Does anyone could have me to take a look? Thanks. if (count>0){ k=k+0.05; mu0=c(83+k,0,0) Sigma0= diag(0.4,3) initpar=c(.1+10*k,10*k,10*k,10*k) # initial
2009 Jul 02
2
constrained optimisation in R.
i want to estimate parameters with maximum likelihood method with contraints (contant numbers). for example sum(Ai)=0 and sum(Bi)=0 i have done it without the constraints but i realised that i have to use the contraints. Without constraints(just a part-not complete): skellamreg_LL=function(parameters,z,design) { n=length(z); mu=parameters[1]; H=parameters[2]; Apar=parameters[3:10];
2009 Apr 29
2
Optim and hessian
Hi, my name is Marcel R. Lopes. My problem is, I made a code to calculate the estimates of a Cox model with random effects. Used to optimize the R command for this. The estimates were calculated correctly, but the Hessian matrix does not have good values. The same thing was done in SAS and gave good results for the Hessian Matrix. Where is the problem in R? As the Hessian is calculated?. How
2007 Nov 06
4
C++ and R interface
Hi All, I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and calling it from within R when using *optim()*. I found that one can call C functions (once they have
2008 Oct 02
1
In the OPTIM message....
Dear all When I used the method, L-BFGS-B, in OPTIM, I've got the following message. --------------------------------------------------------------------- $par [1] 0.176166426835580 $value [1] 1322.17600079332 $counts function gradient 8 8 $convergence [1] 0 $message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" $hessian [,1] [1,]
2007 Jun 18
11
Optimization
Hi, I would like to minimize the value of x1-x2, x2 is a fixed value of 0.01, x1 is the quantile of normal distribution (0.0032,x) with probability of 0.7, and the changing value should be x. Initial value for x is 0.0207. I am using the following codes, but it does not work. fr <- function(x) { x1<-qnorm(0.7,0.0032,x) x2=0.01 x1-x2 } xsd <- optim(0.0207, fr,
2010 Jan 12
3
optim: abnormal termination in lnsrch (resend)
[sorry, forgot some details...] I'm using optim(param, fun, method='L-BFGS-B', lower=lo, upper=up) to minimize a certain function. Often the minimization ends with the message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH What is optim() trying to say? What have I to change in my function to make the minimization succeed? Do you think using BBoptim() instead of optim() changes anything?
2007 Apr 05
2
Likelihood returning inf values to optim(L-BFGS-B) other options?
Dear R-help list, I am working on an optimization with R by evaluating a likelihood function that contains lots of Gamma calculations (BGNBD: Hardie Fader Lee 2005 Management Science). Since I am forced to implement lower bounds for the four parameters included in the model, I chose the optim() function mith L-BFGS-B as method. But the likelihood often returns inf-values which L-BFGS-B
2011 Aug 13
3
optimization problems
Dear R users I am trying to use OPTIMX(OPTIM) for nonlinear optimization. There is no error in my code but the results are so weird (see below). When I ran via OPTIM, the results are that Initial values are that theta0 = 0.6 1.6 0.6 1.6 0.7. (In fact true vales are 0.5,1.0,0.8,1.2, 0.6.) -------------------------------------------------------------------------------------------- >
2009 Feb 12
1
Optim
Dear R user I follow the steps defined in Modern applied statistics page(453) to use optim. However, when I run the following code the parameters seems way off and the third parameter(p3) stayed as the initial value. below is the code: ## data da=c(418,401,416,360,411,425,537,379,484,388,486,380,394,363,405,383,392,363,398,526) ### initial values pars=c(392.25, 507.25, 0.80)
2009 May 06
2
NLMINB() produces NaN!
I am having the same problem as one Rebecca Sela(see bellow). On 21/12/2007 12:07 AM, Rebecca Sela wrote: >* I am trying to optimize a likelihood function using NLMINB. After running without a problem for quite a few iterations (enough that my intermediate output extends further than I can scroll back), it tries a vector of parameter values NaN. This has happened with multiple Monte Carlo