Displaying 20 results from an estimated 3000 matches similar to: "Tuning the nlm function"
2000 Mar 06
1
nlm and optional arguments
It would be really nice if nlm took a set of "..." optional arguments
that were passed through to the objective function. This level of hacking
is probably slightly beyond me: is there a reason it would be technically
difficult/inefficient? (I have a vague memory that it used to work this
way either in S-PLUS or in some previous version of R, but I could easily
be wrong.)
Here's
2008 Jan 15
1
Viewing source code for .Internal functions
I am trying to view the source code of the function nlm in the stats
package of R 2.4.1.
I downloaded the source from CRAN and opened nlm.R, and it calls a
.Internal function:
.Internal(nlm(function(x) f(x, ...), p, hessian, typsize, fscale,
msg, ndigit, gradtol, stepmax, steptol, iterlim))
This is the same thing I saw when entering the function name at the R
command
2005 Oct 11
2
Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
Hi everyone.
I have a problem that I have been unable to determine either the best
way to proceed and why the methods I'm trying to use sometimes fail. I'm
using the pf() function in an optimization function to find a
noncentrality parameter that leads to a specific value at a specified
quantile. My goal is to have a general function that returns the
noncentrality parameter that
2002 Jul 22
2
typsize and fscale arguments to nlm
Dear R list members,
I have a question about the proper use of the typsize and fscale arguments
to nlm.
I use nlm in my sem package to fit general structural-equation models,
which entails maximizing a multinormal likelihood with respect to
parameters that represent regression coefficients and covariances of
variables. The magnitudes of these parameters can be very different.
The
2001 Apr 11
0
replicating lists (fwd) (PR#907)
Filed as a bug, as suggested by Brian R., Jonathan.
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
---------- Forwarded message ----------
Date: Wed, 11 Apr 2001 09:15:26 +0100
2010 Oct 13
1
Wierd nlm behaviour in 2.10.1 and 2.12.0 [Sec=Unclassified]
Hi all,
When upgrading to 2.11.1 recently I noticed different results being produced by my code.
After much digging I have finally narrowed it to a call to nlm().
This can be replicated by:
FixedRemovals<-1836180125888
AbStageInitial<-2223033830403
Rates<- 0.3102445
nlm(function(rootM,Abund,Loss,OtherM)
{(Loss-(rootM/(rootM+OtherM)*
(1-exp(-(rootM+OtherM)))*
2004 Aug 21
0
Convergence code in nlm function
Dear R users,
I am using the nlm function for minimization of the very non-linear function of four parameters. I am running 100 simulations and almost always I get the convergence code =2 (Successive iterates within tolerance. Current iterate is probably solution.) [about 75 times of 100].
Frequently, 3 of 4 relative gradients are close to zero and the fourth is huge but there are also cases
2002 Feb 20
1
Pivoting in chol
Hi Everyone,
I have modified my version of R-1.4.1 to include choleski with pivoting
(like in Splus). I thought R-core might consider including this in the
next version of R, so I give below the steps required to facilitate
this.
1. Copied Linpack routine "dchdc.f" into src/appl
2. Inserted line F77_SUBROUTINE(dchdc) in src/appl/ROUTINES
3. Inserted "dchdc.f" into
2000 Nov 10
1
Modification to cov and cor
Can I suggest that in cov and cor the lines
if (is.data.frame(x))
x <- as.matrix(x)
if (is.data.frame(y))
y <- as.matrix(y)
be replaced by
if (is.data.frame(x))
x <- data.matrix(x) # coerce logical and factors
if (is.data.frame(y))
y <- data.matrix(y) # likewise
This would allow things like
> data(iris)
> cor(iris)
which
2001 Mar 21
0
Suggest new outer for R-1.3
Hi everyone,
Can I suggest the following modification of outer for R-1.3, in the
interests of speed and size of calculation:
*******************************************************************
"outer" <-
function (X, Y, FUN = "*", ...)
{
no.nx <- is.null(nx <- dimnames(X <- as.array(X)))
dX <- dim(X)
no.ny <- is.null(ny <- dimnames(Y <-
2002 Mar 15
1
Thought on crossprod
Hi everyone,
I do a lot of work with large variance matrices, and I like to use
"crossprod" for speed and to keep everything symmetric, i.e. I often
compute "crossprod(Q %*% t(A))" for "A %*% Sigma %*% t(A)", where
"Sigma" decomposes as "t(Q) %*% Q". I notice in the code that
"crossprod", current definition
> crossprod
function (x,
2002 May 16
0
Re: [R] NaN/NA and sprintf double format (PR#1561)
ripley@stats.ox.ac.uk wrote:
>
> On Tue, 14 May 2002, Dirk Eddelbuettel wrote:
>
> > With a (late prerelease of) 1.5.0 on Windows, using sprintf on NaN
> > yields garbage when the number of decimal is specified while it
> > works fine for NA:
> >
> > > sprintf("%.2f", NA)
> > [1] "0.00"
>
> I get that on Linux too, but
2002 Oct 22
0
methods function
Hi everyone,
I've noticed that the methods function is incomplete. The obvious
example is if I write a function "$.foo", it is not picked up by
methods:
> "$.foo" <- function(object, name) get(name, envir=object[[1]])
> "$<-.foo" <- function(object, name, value) {assign(name, value, envir=object[[1]]); object}
> happy <-
2000 Feb 11
1
Something strange in "?assign"? (PR#433)
According to the assign helpfile (0.90.1) the "assign" function is
function (x, value, pos = -1, envir = sys.frame(sys.parent()),
inherits = FALSE, immediate = TRUE)
which is not quite the implementation, which is
function (x, value, pos = -1, envir = pos.to.env(pos), inherits = FALSE,
immediate = TRUE)
This seems to have the following interesting effect.
"short.fun"
2002 Aug 20
1
NA and help page for "&" and "|"
Hi everyone,
Can I suggest an addition to the help page for logical AND and OR,
indicating the behaviour of NA (which is currently not mentioned at
all). I think something simple like an extra paragraph in Details, eg
\code{NA} is a valid logical object. Where a component of \code{x} or
\code{y} is \code{NA}, the result will be \code{NA} if the outcome is
ambiguous. In other words \code{NA
2000 Sep 07
1
.C and DUP=TRUE versus .Call
Hi Everyone,
I have a piece of C code that uses R_alloc, and so I set DUP=TRUE in the
call using ".C". As I understand it this takes a copy of each object
passed to my function. If these objects are large then this could be
expensive. My question is, if I rewrote the code to use .Call, would I
avoid this duplication by using the objects themselves (they are not
modified in the code)
2000 Feb 01
2
Segmentation fault in recursion, 0.90.1 (PR#409)
The following gives an immediate segmentation fault, v 0.90.1
"fred" <- function(x) { print(x); Recall(x-1)}
fred(0) # segmentation fault at recursion 831
Obviously this recursion is non-terminating, but shouldn't it be caught
and reported at some limit? In 0.64.1 we had
Error: protect(): stack overflow
at recursion 831. Cheers, Jonathan.
Jonathan Rougier
2000 Mar 01
1
"is.qr" definition (PR#465)
Might it be possible to tighten the definition of "is.qr". I
noticed that after I mistakenly typed
example(lm) # make lm object named lm.D9
qr.Q(lm.D9)
which exhausted the heap memory and produced two warning
messages. As an object of class "lm" has a "qr" component,
"is.qr" failed to detect that "lm.D9" was not a "qr" object. The
2001 Nov 13
1
Small change to "cut.default"
Hi everyone,
Can I suggest the following cosmetic change to cut.default (R-1.3.1), to
adjust the labels in the case that include.lowest = TRUE:
arrow:dma0jcr% diff -u cut.R my.cut.R
--- cut.R Tue Nov 13 12:28:35 2001
+++ my.cut.R Tue Nov 13 12:35:16 2001
@@ -25,6 +25,11 @@
ch.br[-nb], ",", ch.br[-1],
if(right)"]"
2002 Oct 08
3
hash argument of new.env()
Hi everyone,
There is no mention in ?new.env (R-1.6.0) of what the effect of setting
the hash argument of new.env() actually does. What does it mean in
performance terms to say that "the environment will be hashed"?
Thanks, Jonathan.
--
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham