Thanks to all who responded,
I've found a very useful code here:
http://courses.washington.edu/fish507/notes.html
In particular the Lecture 3...
Héctor
2015-10-17 7:05 GMT+00:00 Berend Hasselman :
>
> Your model is producing -Inf entries in the vector Be (in function modl
>
Your model is producing -Inf entries in the vector Be (in function modl and LL)
at some stage during the optimization process.
You should first do something about that before anything else.
Berend
> On 17 Oct 2015, at 03:01, Bert Gunter wrote:
>
> I made no attempt
Dear R users,
I'im trying to find the parameters of a dynamic biomass model using maximum
likelihood estimation. I used two approaches, one by hand, with optim()
function and the other using mle2() function from package bbmle. My problem
is that the results change a lot depending on the initial
I made no attempt to examine your details for problems, but in general,
My problem
> is that the results change a lot depending on the initial values... I can't
> see what I am doing wrong...
>
> This is a symptom of an overparameterized model: The parameter estimates
> are unstable even though
Hello,
You cannot change the numerical accuracy, it's a built-in constant. To
see it use
?.Machine
.Machine$double.eps # smallest value different from zero
Actually, .Machine$double.eps is the the smallest positive
floating-point number x such that 1 + x != 1
You can try the following
As a simple example, I want to find minimum value for x^2, but it can't be
obtained by:
f-function(x)x^2
optimize(f,lower=-1,upper=1)
What are other methods to deal with this? I tried DEoptim, still doesn't
work. Any suggustions will be extremely helpful! THanks!
Shelly
--
View this message
On Apr 10, 2013, at 03:24 , nntx wrote:
As a simple example, I want to find minimum value for x^2, but it can't be
obtained by:
f-function(x)x^2
optimize(f,lower=-1,upper=1)
Works fine for me. What did you expect it to do?
f-function(x)x^2
optimize(f,lower=-1,upper=1)
$minimum
[1]
Thank you professor. I think the minimum value of x^2 between -1 and 1 should
be x=0, y=0. but the result is not that. I am thinking is any wrong with my
thought?
Thanks for helping me out!
--
View this message in context:
Hello,
Your thoght is mathematically right but numerically wrong. The result
given by optimize is so close to the real minimum that numerical
accuracy comes in and it becomes indistinguishable from the value you're
expecting.
You get the minimum up to a certain accuracy, not more.
Hope this
Rui, thanks for your reply. You meant that it is the issue of accuracy? So if
I change the numerical accuracy, my results can be output? Thanks a lot!
--
View this message in context:
http://r.789695.n4.nabble.com/Optimization-problem-tp4663821p4663928.html
Sent from the R help mailing list
Dear List,
I'm new in R. I'm trying to solve a simple constrained optimization
problem.
Essentially, let's say I have a matrix as in the object 'mm' inside the
function below. My objective function should have a matrix of parameters,
one parameter for each element 'mm' (4 in this case). The
On 09-02-2013, at 21:08, Axel Urbiz axel.ur...@gmail.com wrote:
Dear List,
I'm new in R. I'm trying to solve a simple constrained optimization
problem.
Essentially, let's say I have a matrix as in the object 'mm' inside the
function below. My objective function should have a matrix of
Hi Greg,
The problem is that I also have restrictions for each variable (they must be
higher than -.07 and smaller than .2) and I'm dealing with a lot of them.
I've already tried the second approach but, as far as it seems, the function
doesn't satisfy my objective.
That's what I'm doing:
Hi,
I'm dealing with an optimization problem. I'm using 'optim' to maximize the
output of a function, given some restrictions on the input. I would like to
know if there is a way to impose some restrictions on 'intermediate
variables' of the function. An example..
fx = function (x)
{
s - 0
for
There are a couple of options.
First if you want the mean to equal 7, then that means the sum must
equal 21 and therefore you can let optim only play with 2 of the
variables, then set the 3rd to be 21-s1-s2.
If you want the mean to be greater than 7 then just put in a test, if
the mean is less
] Optimization problem with nonlinear constraint
Dear all,
I'm looking for a way to solve a simple optimization problem with a
nonlinear constraint. An example would be
max x s.t. y = x * T ^(x-1)
where y and T are known values.
optim() and constrOptim() do only allow for box or linear constraints
Uli Kleinwechter u.kleinwechter at uni-hohenheim.de writes:
Dear Ravi,
As I've already written to you, the problem indeed is to find a solution
to the transcendental equation y = x * T^(x-1), given y and T and the
optimization problem below only a workaround.
I don't think
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Hans W Borchers
Sent: Wednesday, July 28, 2010 11:11 AM
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] Optimization problem with nonlinear constraint
Uli Kleinwechter u.kleinwechter at uni-hohenheim.de writes:
Dear Ravi
Sent: Wednesday, July 28, 2010 11:11 AM
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] Optimization problem with nonlinear constraint
Uli Kleinwechter u.kleinwechter at uni-hohenheim.de writes:
Dear Ravi,
As I've already written to you, the problem indeed is to find a solution
Dear all,
I'm looking for a way to solve a simple optimization problem with a
nonlinear constraint. An example would be
max x s.t. y = x * T ^(x-1)
where y and T are known values.
optim() and constrOptim() do only allow for box or linear constraints,
so I did not succedd here. I
into any problems using it.
Best,
Ravi.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Uli Kleinwechter
Sent: Monday, July 26, 2010 10:16 AM
To: r-help@r-project.org
Subject: [R] Optimization problem with nonlinear constraint
How about smoothing the percentages, and then take the second derrivative
to find the inflection point?
which.max(diff(diff((lowess(percentages)$y
This solution is what I've been using so far. The only difference is that I
am smoothing the 1st derivative, since its the one I want to be
Hello:
Here is a general approach using smoothing using the Gasser-Mueller
kernel,
which is implemented in the lokern package. The optimal bandwidth for
derivative estimation is automatically chosen using a plug-in
approximation.
The code and the results are attached here.
Maybe am I
How about smoothing the percentages, and then take the second
derrivative to find the inflection point?
which.max(diff(diff((lowess(percentages)$y
This solution is what I've been using so far. The only difference is that
I am smoothing the 1st derivative, since its
the one I want to
I don't see why one would want to pretend that the function is
continuous. It isn't.
The x variable devices is discrete.
Moreover, the whole solution space is small: the possible solutions
are integers in the range of maybe 20-30.
Bill
On Fri, Jun 18, 2010 at 9:00 AM, José E. Lozano
I don't see why one would want to pretend that the function is continuous.
It isn't.
The x variable devices is discrete.
Moreover, the whole solution space is small: the possible solutions are
integers in the range of maybe 20-30.
Yes, you are right, what I'd like to think is that the outcome
Hello,
I'm facing a problem of optimization, I've already solved but I'm trying to
find other answers to this problem to improve the solution.
Well, to make it short: I have to set/install a number of devices in a
building, and I have to give service to a number of customers, or better
say, to
How about smoothing the percentages, and then take the second derrivative to
find the inflection point?
which.max(diff(diff((lowess(percentages)$y
Bart
--
View this message in context:
http://r.789695.n4.nabble.com/Optimization-problem-tp2258654p2258828.html
Sent from the R help mailing
min(devices[percentages==max(percentages)])
Bill
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal,
questions.
Ravi.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of José E. Lozano
Sent: Thursday, June 17, 2010 7:48 AM
To: r-help@r-project.org
Subject: [R] Optimization problem
Hello,
I'm facing a problem of optimization, I've
Sorry, thought you wanted to find lowest value of x that produced
maximum value of y. I see now that is not the case.
I think you have to decide on what amount of improvement per device
you judge to be 'minimal'. Then the algorithm uses the value of y that
occurs at the point where this criterion
Dear R users,
I need some advises on how to use R to optimize this function with the
following constraints.
f(x1,x2,x3,y1,y2,y3,)
= gamma(x1+x2-1)/{gamma(x1)*gamma(x2)} * y1^(x2-1) * y2^(x1-1)
+ gamma(x1+x3-1)/{gamma(x1)*gamma(x3)} * y1^(x3-1) * y3^(x1-1)
+
Ravi Varadhan rvaradhan at jhmi.edu writes:
Interesting!
Now, if I change the cost matrix, D, in the LSAP formulation slightly
such that it is quadratic, it finds the best solution to your example:
Dear Ravi,
I thought your solution is ingenious, but after the discussion with
Erwin
?
Thank a lot again!
Klaus
Original-Nachricht
Datum: Sat, 16 Jan 2010 23:42:08 -0500
Von: Ravi Varadhan rvarad...@jhmi.edu
An: Erwin Kalvelagen erwin.kalvela...@gmail.com
CC: r-h...@stat.math.ethz.ch
Betreff: Re: [R] optimization problem
Interesting!
Now, if I change
of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Hans W. Borchers hwborch...@googlemail.com
Date: Sunday, January 17, 2010 3:54 am
Subject: Re: [R] optimization problem
To: r-h...@stat.math.ethz.ch
Ravi Varadhan rvaradhan
: Sunday, January 17, 2010 8:06 am
Subject: Re: [R] optimization problem
To: Ravi Varadhan rvarad...@jhmi.edu, erwin.kalvela...@gmail.com,
hwborch...@googlemail.com
Cc: r-h...@stat.math.ethz.ch
Dear Erwin, Ravi and Hans Werner,
thanks a lot for your replies. I don't think I have access
Message -
From: Erwin Kalvelagen erwin.kalvela...@gmail.com
Date: Saturday, January 16, 2010 5:26 pm
Subject: Re: [R] optimization problem
To: Ravi Varadhan rvarad...@jhmi.edu
Cc: r-h...@stat.math.ethz.ch
I believe this is a very good approximation but not a 100% correct
formulation
Ravi Varadhan rvaradhan at jhmi.edu writes:
Dear Hans,
I agree with your comments. My intuition was that the quadratic
form would be better behaved than the radical form (less
nonlinear!?). So, I was hoping to see a change in behavior when
the cost function was altered from a radical
: Saturday, January 16, 2010 2:35 am
Subject: Re: [R] optimization problem
To: r-h...@stat.math.ethz.ch
Ravi Varadhan rvaradhan at jhmi.edu writes:
dist - function(A, B) {
# Frobenius norm of A - B
n - nrow(A)
sum(abs(B - A))
}
See for a definition of the
Frobenius
) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Ravi Varadhan rvarad...@jhmi.edu
Date: Saturday, January 16, 2010 10:00 am
Subject: Re: [R] optimization problem
To: Erwin Kalvelagen erwin.kalvela...@gmail.com
Cc: r-h...@stat.math.ethz.ch
Thanks, Erwin, for pointing out
and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Erwin Kalvelagen erwin.kalvela...@gmail.com
Date: Saturday, January 16, 2010 2:35 am
Subject: Re: [R] optimization problem
To: r-h...@stat.math.ethz.ch
Ravi
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Erwin Kalvelagen erwin.kalvela...@gmail.com
Date: Saturday, January 16, 2010 1:36 pm
Subject: Re: [R] optimization problem
To: Ravi Varadhan rvarad...@jhmi.edu
Cc: r-h
-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Erwin Kalvelagen erwin.kalvela...@gmail.com
Date: Saturday, January 16, 2010 1:36 pm
Subject: Re: [R] optimization problem
To: Ravi Varadhan rvarad...@jhmi.edu
Cc: r-h...@stat.math.ethz.ch
I also have doubts this can
...@gmail.com
Date: Saturday, January 16, 2010 5:26 pm
Subject: Re: [R] optimization problem
To: Ravi Varadhan rvarad...@jhmi.edu
Cc: r-h...@stat.math.ethz.ch
I believe this is a very good approximation but not a 100% correct
formulation of the original problem.
E.g. for
A - matrix(c
Dear R-experts,
this is not a direct R-problem but I hope you can help me anyway.
I would like to minimize || PG-I || over P, where P is a p x p permutation
matrix (obtained by permuting the rows and/or columns of the identity matrix),
G is a given p x p matrix with full rank and I the
klausch at gmx.de writes:
Dear R-experts,
this is not a direct R-problem but I hope you can help me anyway.
I would like to minimize || PG-I || over P, where P is a p x p permutation
matrix (obtained by permuting the rows
and/or columns of the identity matrix), G is a given p x p
of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: klau...@gmx.de
Date: Friday, January 15, 2010 9:53 am
Subject: [R] optimization problem
To: r-help@r-project.org
Dear R-experts
Ravi Varadhan rvaradhan at jhmi.edu writes:
dist - function(A, B) {
# Frobenius norm of A - B
n - nrow(A)
sum(abs(B - A))
}
See http://mathworld.wolfram.com/FrobeniusNorm.html for a definition of the
Frobenius norm.
Erwin
Date: Sat, 17 Oct 2009 13:50:10 -0700 (PDT)
From: kathie kathryn.lord2...@gmail.com
Subject: [R] optimization problem with constraints...
To: r-help@r-project.org
Message-ID: 25941686.p...@talk.nabble.com
Content-Type: text/plain; charset=us-ascii
Dear R users,
I need some advises on how
Dear R users,
I need some advises on how to use R to optimize a nonlinear function with
the following constraints.
f(x1,x2,x3,x4,x5,x6)
s.t
0 x1 1
0 x2 1
0 x1+x2 1
-inf x3 inf
-inf x4 inf
0 x5 inf
0 x6 inf
Is there any built-in function or something for these constraint??
Hans W. Borchers [EMAIL PROTECTED] wrote:
Why not use one of the global optimizers in R, for instance 'DEoptim', and
then apply optim() to find the last six decimals? I am relatively sure that
the Differential Evolution operator has a better chance to come near a
global optimum than a loop
In case anyone is still reading this thread, I want to add this:
In a current problem (a data-shy five-parameter nonlinear
optimization), I found nlminb markedly more reliable than
optim with method L-BFGS-B. In reviewing the fit I made, I
found that optim only came close to its own minimum in
tedzzx [EMAIL PROTECTED] wrote:
If I want to find out the globle minia, how shoul I change my code?
I sometimes use optim() within a loop, with random starting
values for each iteration of the loop. You can save the
objective function value each time and pick the best solution.
Last time I
Why not use one of the global optimizers in R, for instance 'DEoptim', and
then apply optim() to find the last six decimals? I am relatively sure that
the Differential Evolution operator has a better chance to come near a
global optimum than a loop over optim(), though 'DEoptim' may be a bit slow
tedzzx zengzhenxing at gmail.com writes:
Hi, all
I am facing an optimization problem. I am using the function optim(par,fun),
but I find that every time I give different original guess parameter, I can
get different result. For example
I have a data frame named data:
head(data)
Hi, all
I am facing an optimization problem. I am using the function optim(par,fun),
but I find that every time I give different original guess parameter, I can
get different result. For example
I have a data frame named data:
head(data)
price s x t
1 1678.0 12817 11200
Hi,
I guess your function has several local minima and depending on where
you start, i.e. your initial variables, you get into another mimimum.
HTH
Armin
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
] optimization problem
To: r-help@r-project.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=UTF-8
I am facing an optimization problem. I am using the function optim(par,fun),
but I find that every time I give different original guess parameter, I can
get different result
If I want to find out the globle minia, how shoul I change my code?
Thanks a lot
Armin Meier wrote:
Hi,
I guess your function has several local minima and depending on where
you start, i.e. your initial variables, you get into another mimimum.
HTH
Armin
Dear list,
hi !
I am a R beginner and I have a function to optimize .
alpha = argmin{ f(x,alpha) }
I want alpha to be in [0,1]. Is there any function that can work?
I use nlm() but i can't fix the domain of alpha.
thanks in advance
___
Jiang Peng, Ph.D.
, 2008 5:28 AM
To: r-help@r-project.org
Subject: [R] optimization problem
Dear list,
hi !
I am a R beginner and I have a function to optimize .
alpha = argmin{ f(x,alpha) }
I want alpha to be in [0,1]. Is there any function that can work?
I use nlm() but i can't fix the domain
/Varadhan.html
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jiang Peng
Sent: Monday, November 24, 2008 6:28 AM
To: r-help@r-project.org
Subject: [R] optimization problem
I'm trying to da an optimization for the followig function
Zwischenwert - function (x)
{
lambda-x[1];
mu-x[2];
gammal-x[3];
mud-x[4];
gammad-x[5];
Mittelwert -0;
for(t in 0:(T-1))
{
for(i in 0:(n-1))
{
Hi,
how can I order the rows and columns of a matrix A to generate B, in order
to minimize the length(rle(B)$lengths) for all the rows and columns ?
set.seed(5)
a - matrix(rnorm(200), nrow=20)
a[a=0] - 0
a[a0] - 1
a
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]01
64 matches
Mail list logo