Re: [R] Question about nlminb function

2020-04-07 Thread Lim, Hwanggyu
AM To: Ivan Krylov ; Lim, Hwanggyu Cc: r-help@r-project.org Subject: Re: [R] Question about nlminb function This thread points out the important and often overlooked difference between "convergence" of an algorithm and "termination" of a program. I've been pushing this butt

Re: [R] Question about nlminb function

2020-04-07 Thread Lim, Hwanggyu
Hello Ivan, Thank you so much for your valuable comments. I will definitely look at the R package of nloptr you introduced. Best, Hwanggyu -Original Message- From: Ivan Krylov Sent: Friday, April 3, 2020 5:25 AM To: Lim, Hwanggyu Cc: r-help@r-project.org Subject: Re: [R] Question

Re: [R] Question about nlminb function

2020-04-03 Thread J C Nash
This thread points out the important and often overlooked difference between "convergence" of an algorithm and "termination" of a program. I've been pushing this button for over 30 years, and I suspect that it will continue to come up from time to time. Sometimes it is helpful to put termination

Re: [R] Question about nlminb function

2020-04-03 Thread Ivan Krylov
On Thu, 2 Apr 2020 10:26:07 + "Lim, Hwanggyu" wrote: > when n-1th estimates and nth estimates have absolute differences > less than 0.001 for all three parameters, the iteration must stop > I am using nlminb optimization function nlminb function uses the PORT library. According to [1], the

[R] Question about nlminb function

2020-04-02 Thread Lim, Hwanggyu
Hello, My name is Hwanggyu Lim. I am working estimating parameters of non-negative function, which has local maximums. For example, the function has three parameters (e.g., f(a, b, c)) and I need to estimate them. For this, I am using nlminb optimization function and it works fine. Here is my

Re: [R] question about nlminb

2008-04-13 Thread John Pitchard
Hi Spencer, Thanks for your email. Do you have a reference for generating the variance-covariance matrix from the restricted variance-covariance? Is this a well known technique? Regards, John On 10/04/2008, Spencer Graves [EMAIL PROTECTED] wrote: Hi, John: I just got the following error

Re: [R] question about nlminb

2008-04-13 Thread Spencer Graves
It's very well known that if a random vector X has a finite mean mu and covariance Sig, and Y = A X, then (1) EY = A %*% mu and (2) cov(Y) = A %*% Sig %*% t(X) = tcrossprod(A %*% Sig, A) Expression (1) says that mathematical expectation is a linear operator.

Re: [R] question about nlminb

2008-04-09 Thread John Pitchard
Hi Spencer, Sorry for not producing code as a worked example. Here's an example: == # setting the seed number set.seed(0) # creating a correlation matrix corr - diag(5) corr[lower.tri(corr)] - 0.5 corr[upper.tri(corr)] - 0.5 # Data for the minimisation mat -

Re: [R] question about nlminb

2008-04-09 Thread Spencer Graves
Hi, John: I just got the following error right after the attempt to use 'rmvnorm'. Error: could not find function rmvnorm I tried 'library(mvtnorm)', but the 'rmvnorm' in that package gave me the following: Error in rmvnorm(1, mean = c(3, -20, -10, 3, 2), sd = c(0.1, 15,

[R] question about nlminb

2008-04-08 Thread John Pitchard
Dear All, I wanted to post some more details about the query I sent to s-news last week. I have a vector with a constraint. The constraint is that the sum of the vector must add up to 1 - but not necessarily positive, i.e. x[n] - 1 -(x[1] + ...+x[n-1]) I perform the optimisation on the vector

[R] question about nlminb

2008-04-08 Thread John Pitchard
Dear All, I wanted to post some more details about the query I sent to s-news last week. I have a vector with a constraint. The constraint is that the sum of the vector must add up to 1 - but not necessarily positive, i.e. x[n] - 1 -(x[1] + ...+x[n-1]) I perform the optimisation on the vector

Re: [R] question about nlminb

2008-04-08 Thread Spencer Graves
Have you considered optimizing over x1 = x[1:(length(x)-1]? You could feed a wrapper function 'f2(x1, ...)' that computes xFull = c(x1, 1-sum(x1)) and feeds that to your 'fn'. If this makes sense, great. Else, if my answer is not useful, be so kind as to PLEASE do read the