Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

2010-10-13 Thread Ravi Varadhan
Hi Troy, I think that your problem is poorly scaled. You have variables that vary over several orders of magnitude. This means that any small changes (due to subtle differences between R versions) could cause a big difference in the convergence behavior of the algorithms. So, you are asking for

Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

2010-10-13 Thread Ravi Varadhan
Try this: Myfunc2 <- function(rootM,Abund,Loss,OtherM) { # I have scaled the function (Loss/Abund - (rootM/(rootM+OtherM)* (1-exp(-(rootM+OtherM)^2 } nlm(myfunc2 ,0.001,print.level=0,fscale=0, gradtol=1E-10, stepmax = 100.0 ,Loss=FixedRemovals ,Abund=AbStageInitial ,OtherM=

[Rd] list comprehension to create an arbitrary-sized list with arbitrary names/values

2010-10-13 Thread Steve Kim
In python, one can do this mydict = dict([(keyfun(x), valfun(x)) for x in mylist]) to create a dictionary with whatever keys and values we want from an input list of arbitrary size. In R, I want to similarly create a list with names/values that are generated by some keyfun and valfun (assuming th

Re: [Rd] list comprehension to create an arbitrary-sized list with arbitrary names/values

2010-10-13 Thread Olaf Mersmann
Hi, On 13.10.2010, at 21:26, Steve Kim wrote: > mydict = dict([(keyfun(x), valfun(x)) for x in mylist]) > > to create a dictionary with whatever keys and values we want from an > input list of arbitrary size. In R, I want to similarly create a list > with names/values that are generated by some k

Re: [Rd] list comprehension to create an arbitrary-sized list with arbitrary names/values

2010-10-13 Thread Erik Iverson
This question probably belongs on R-help instead of R-devel. What works best for you will depend on how big 'mylist' is. An article discussing some possibilities can be found at: http://opendatagroup.com/2009/07/26/hash-package-for-r/ Hope this helps, --Erik Steve Kim wrote: In python, one ca

Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

2010-10-13 Thread Troy Robertson
Thanks heaps Ravi, I will have to take the modified function to my modeller/statistician and get him to check it out as I am only a general programmer and do not understand the significance of your suggested changes. Your changes do look to produce consistent results though and as John Nash po

[Rd] Scripting SVG with R

2010-10-13 Thread Wolfgang Huber
Since now many browsers support (ECMA/Java-)scripted SVG, I am wondering whether there are already any examples of inserting R code into SVG documents (or a Javascript canvas?) either directly, or perhaps more likely through a JavaScript layer, to dynamically generate graphics or make them in

Re: [Rd] Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]

2010-10-13 Thread Ravi Varadhan
The scaling change that I did is extremely simple. I just divided the objective function by `Abund' (actually, Abund^2). Dividing a function by a constant (positive) factor does not change the optimum (minimum), so this is perfectly legal. Ravi. _