Re: [R] Excel can do what R can't?????

2003-08-04 Thread Prof Brian Ripley
On Sun, 3 Aug 2003, Fan wrote: I've found that the discussions are interesting, generally speaking, peoples seem equally confident on R's optim/nlm and Excel's solver. The authors of the algorithm GRG2 (Generalized Reduced Gradient) are not cited in the documentation of optim(), so I'm

Re: [R] Excel can do what R can't?????

2003-08-04 Thread Jean Fan
Dear Professor Ripley, I'm little confused of your reply: do you mean that GRG would not be a standard optimization algorithm, so it couldn't be better than what exist in R ? I'm not a specialist of numerical optimization algorithms, but it seems that GRG is actually implemented in several

Re: [R] Excel can do what R can't?????

2003-08-04 Thread Prof Brian Ripley
On Mon, 4 Aug 2003, Jean Fan wrote: Dear Professor Ripley, I'm little confused of your reply: do you mean that GRG would not be a standard optimization algorithm, so it couldn't be better than what exist in R ? Not at all. I meant what I actually said (and I said nothing about which was

Re: Re: [R] Excel can do what R can't?????

2003-08-04 Thread Thomas Lumley
On Mon, 4 Aug 2003, [iso-8859-1] Jean Fan wrote: I'm not a specialist of numerical optimization algorithms, but it seems that GRG is actually implemented in several specialized optimisation toolbox (sure generally commercial), not only the limited one in Excel. And with google, search GRG

Re: [R] Excel can do what R can't?????

2003-08-03 Thread Fan
I've found that the discussions are interesting, generally speaking, peoples seem equally confident on R's optim/nlm and Excel's solver. The authors of the algorithm GRG2 (Generalized Reduced Gradient) are not cited in the documentation of optim(), so I'm wondering if the optimization algorithm

Re: [R] Excel can do what R can't?????

2003-07-17 Thread Michael Rennie
Quoting Roger D. Peng [EMAIL PROTECTED]: I'm having a little difficulty understanding this thread. If Excel can do the job correctly and suits your needs, why not just use Excel? Primarily because I don't know how to automate this in excel. The reason for me doing this is I eventually

Re: [R] Excel can do what R can't?????

2003-07-17 Thread Spencer Graves
For lexical scoping, read some of the better documentation on R. At minimum, check www.r-project.org - search - R site search. spencer graves Michael Rennie wrote: Quoting Roger D. Peng [EMAIL PROTECTED]: I'm having a little difficulty understanding this thread. If Excel can do the job

Re: [R] Excel can do what R can't?????

2003-07-17 Thread Damon Wischik
Michael Rennie wrote: Last, it's not even that I'm getting error messages anymore- I just can't get the solution that I get from Excel. If I try to let R find the solution, and give it starting values of c(1,2), it gives me an optimization solution, but an extremely poor one. However, if I

Re: [R] Excel can do what R can't?????

2003-07-16 Thread M.Kondrin
?optim optim(par, fn, gr = NULL, method = c(Nelder-Mead, BFGS, CG, L-BFGS-B, SANN), lower = -Inf, upper = Inf, control = list(), hessian = FALSE, ...) . fn: A function to be minimized (or maximized), with first argument the vector of parameters

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Spencer Graves
The phrase: f - 10*(Wt-Wtmod)^2)/Wt) + (((Hgt-Hgtmod)^2)/Hgt))2) ; f is an immediate computation, not a function. If you want a function, try something like the following: f - function(x){ Wt - x[1] Wtmod - x[2] Hgt - x[3] Hgtmod -

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Michael Rennie
Hi, Spencer I know I submitted a beastly ammount of code, but I'm not sure how to simplify it much further, and still sucessfully address the problem that i am having. The reason being is that the funciton begins f- function (q) At the top of the iterative loop. This is what takes q and

RE: [R] Excel can do what R can't?????

2003-07-16 Thread Michael Rennie
: Wednesday, July 16, 2003 2:47 PM To: Huntsinger, Reid Subject: RE: [R] Excel can do what R can't? Hi, Reid At 02:09 PM 7/16/03 -0400, you wrote: R is good at automating specific kinds of complex loops, namely those that can be vectorized, or that can be written to draw on otherwise built

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Spencer Graves
-Original Message- From: Michael Rennie [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 11:18 AM To: Spencer Graves Cc: R-Help; M.Kondrin Subject: Re: [R] Excel can do what R can't? Hi, Spencer I know I submitted a beastly ammount of code, but I'm not sure how to simplify it much

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Spencer Graves
Subject: RE: [R] Excel can do what R can't? Hi, Reid At 02:09 PM 7/16/03 -0400, you wrote: R is good at automating specific kinds of complex loops, namely those that can be vectorized, or that can be written to draw on otherwise built-in facilities. It's usually reasonable for other kinds

RE: [R] Excel can do what R can't?????

2003-07-16 Thread Michael Rennie
Huntsinger -Original Message- From: Spencer Graves [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 5:20 PM To: Michael Rennie Cc: Huntsinger, Reid; R-Help Subject: Re: [R] Excel can do what R can't? I'm confused: I've done this type of thing by programming

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Spencer Graves
I don't expect you to have a complete solution from the simplifications. I expect you to learn something from the toy problems that can help you solve the real problems. Michael Rennie wrote: Hmmm. I tried entering 'Hgtmod = Hgt' at the end of my 'optim' function, but that didn't help me

Re: [R] Excel can do what R can't?????

2003-07-16 Thread Roger D. Peng
I'm having a little difficulty understanding this thread. If Excel can do the job correctly and suits your needs, why not just use Excel? As far as I know, 'optim' cannot optimize a function subject to arbitrary equality constraints. The 'constrOptim' function allows for linear inequality

Re: [R] Excel can do what R can't?????

2003-07-15 Thread Spencer Graves
I've programmed many things like this in both Excel and R. When I did not get the same answer from both, it was because I had an error in one (or both). I do this routinely as part of debugging: I catch many mistakes this way, and I often feel I can not trust my answers without this

Re: [R] Excel can do what R can't?????

2003-07-15 Thread Jerome Asselin
Mike, The definition of your function f() seems quite inefficient. You could vectorize it, which would shorten and speed up your code, especially if M is large. See the R introduction file available online to learn how to do it if you don't already know how. Also, you have to return only one

Re: [R] Excel can do what R can't?????

2003-07-15 Thread Michael Rennie
At 11:47 AM 7/15/03 -0700, Jerome Asselin wrote: Mike, The definition of your function f() seems quite inefficient. You could vectorize it, which would shorten and speed up your code, especially if M is large. Hi, Jerome I don;t think I can vectorize it, since in the iteration loop, the value

Re: [R] Excel can do what R can't?????

2003-07-15 Thread Jerome Asselin
I thought that you could simplify your code by using something like c(0,W[-length(W)]) as opposed to W[i-1] in a loop, but now I understand it's not that easy. Unless you can analytically simplify the calculation of W in order to vectorize it, it's going to be slow. However, many of the lines