Displaying 20 results from an estimated 8000 matches similar to: "supplying the Hessian to "nlm""
1999 Nov 24
0
nlm gradient and hessian
Out of curiosity, I have tried, without success, to use the new
facility in nlm to specify the gradient and hessian. (It is many years
since I had a problem simple enough to make analytic derivation of
these worthwhile.) The help now says that the function must have
attributes with these names but gives no indication as to what should
be in the attributes. The online example and demo do not use
2003 Oct 17
2
nlm, hessian, and derivatives in obj function?
I've been working on a new package and I have a few questions regarding the
behaviour of the nlm function. I've been (for better or worse) using the nlm
function to fit a linear model without suppling the hessian or gradient
attributes in the objective function. I'm curious as to why the nlm requires
31 iterations (for the linear model), and then it doesn't work when I try to
add
2011 Sep 22
1
nlm's Hessian update method
Hi R-help!
I'm trying to understand how R's nlm function updates its estimate of the Hessian matrix. The Dennis/Schnabel book cited in the references presents a number of different ways to do this, and seems to conclude that the positive-definite secant method (BFGS) works best in practice (p201). However, when I run my code through the optim function with the method as "BFGS",
2003 Oct 24
1
first value from nlm (non-finite value supplied by nlm)
Dear expeRts,
first of all I'd like to thank you for the
quick help on my last which() problem.
Here is another one I could not tackle:
I have data on an absorption measurement which I want to fit
with an voigt profile:
fn.1 <- function(p){
for (i1 in ilong){
ff <- f[i1]
ex[i1] <- exp(S*n*L*voigt(u,v,ff,p[1],p[2],p[3])[[1]])
}
sum((t-ex)^2)
}
out <-
2007 Sep 16
1
Problem with nlm() function.
In the course of revising a paper I have had occasion to attempt to
maximize a rather
complicated log likelihood using the function nlm(). This is at the
demand of a referee
who claims that this will work better than my proposed use of a home-
grown implementation
of the Levenberg-Marquardt algorithm.
I have run into serious hiccups in attempting to apply nlm().
If I provide gradient and
2004 Apr 14
1
How does nlm work?
Dear R users,
I have looked in the reference
Schnabel, R. B., Koontz, J. E. and Weiss, B. E. (1985) A modular
system of algorithms for unconstrained minimization. _ACM Trans.
Math. Software_, *11*, 419-440.
cited in the nlm help.
This article says that the algorithm permits the use of step selection
(line search, dogleg and optimal step), analytic or finite diference
gradient
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
2006 Nov 10
1
Variable limit in nlm?
Admittedly I am using an old version 1.7.1, but can anyone tell if this
is or was a problem. I can only get nlm (nonlinear minimization) to
adjust the first three components of function variable. No gradient or
hessian is supplied. E.G.;
fnoise
function(y) { y[5]/(y[4]*sp2) * exp(-((x[,3]-y[1]-y[2]*x[,1]-y[3]
*x[,2])/y[4])^2/2) + (1-y[5])/(y[9]*sp2) * exp(-((x[,3]-y[6]-y[7]*x[,1]-y[8]
2007 Mar 02
2
nlm() problem : extra parameters
Hello:
Below is a toy logistic regression problem. When I wrote my own code,
Newton-Raphson converged in three iterations using both the gradient
and the Hessian and the starting values given below. But I can't
get nlm() to work! I would much appreciate any help.
> x
[1] 10.2 7.7 5.1 3.8 2.6
> y
[1] 9 8 3 2 1
> n
[1] 10 9 6 8 10
derfs4=function(b,x,y,n)
{
2004 Feb 19
1
Obtaining SE from the hessian matrix
Dear R experts,
In R-intro, under the 'Nonlinear least squares and maximum likelihood
models' there are ttwo examples considered how to use 'nlm' function.
In 'Least squares' the Standard Errors obtained as follows:
After the fitting, out$minimum is the SSE, and out$estimates are the
least squares estimates of the parameters. To obtain the approximate
standard
2005 Jul 07
1
look for help on nlm in R
Hi,
I had a hard time in learning nlm in R and appreciate any help.
I encounted the following error message from time to time when I tried different starting parameter values (three parameter values in this case) in nlm(f=SS.fun,p=c(0.1/40,0.1,2),hessian = FALSE,N.measure=object,h=20)
Error in f(x, ...) : only 0's may mix with negative subscripts
Basically I know the three parameter
2000 Feb 07
1
demo(nlm) error under R 0.99.0
I can't seem to get the demo(nlm) to run under R version 0.99.0
Anyone know a solution?
> fgh <- function(x) {
gr <- function(x1, x2) {
c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1), 200 * (x2 -
x1 * x1))
}
h <- function(x1, x2) {
a11 <- 2 - 400 * (x2 - x1 * x1) + 800 * x1 * x1
a21 <- -400 * .... [TRUNCATED]
> nlm(fgh,
2008 Oct 30
0
a nlm() question
Dear R listers,
I have a very annoying problem using nlm().
I want to find the minimizer of my target function, if written in
\LaTeX is
f(\mu1,\mu2,\sigma1,\sigma2) = \sum_i^n( w_ig_t(z_i) ), where
g_t(z) is a pdf of bivariate normal distribution and z_i is my samples.
I cannot get the estimation result generated by nlm(), and I got
the following errors
"
Error in
2003 Oct 06
1
getting names of p vector in nlm function...
Dear R programming folks:
I'm trying to finish off a package for non-linear simultaneous system
estimation and I've been trying to figure out how to get the names of the
parameter vector variables when inside the function that nlm calls to return
the objective function value:
knls <- function( theta, eqns, data, fitmethod="OLS", instr=NULL, S=NULL )
{
## print(
2007 May 26
1
bug from nlm function (PR#9711)
Full_Name: bernardo moises lagos alvarez
Version: 2.4.0
OS: Windows XP professional
Submission from: (NULL) (152.74.219.16)
I need obtained the MLE of weibull parameters using the nlm with exact gradient
an
hessian. I am doing. bug report :Erro en log(b) : el argumento "b" est? ausente,
sin default
1.Construction to objectiv functin with n=1 data
1999 Dec 09
1
nlm() problem or MLE problem?
I am trying to do a MLE fit of the weibull to some data, which I attach.
fitweibull<-function()
{
rt<-scan("r/rt/data2/triam1.dat")
rt<-sort(rt)
plot(rt,ppoints(rt))
a<-9
b<-.27
fn<-function(p) -sum( log(dweibull(rt,p[1],p[2])) )
cat("starting -log like=",fn(c(a,b)),"\n")
out<-nlm(fn,p=c(a,b), hessian=TRUE)
2003 Sep 30
1
can't get names from vector in nlm calls
I've been trying to figure out how to get the names of the parameter vector
variables when inside the function that nlm calls to return the objective
function value:
knls <- function( theta, eqns, data, fitmethod="OLS", instr=NULL, S=NULL )
{
## print( names( theta ) ) # returns NULL
## get the values of the parameters
for( i in 1:length( theta ) )
2009 Sep 14
1
Error: C stack usage is too close to the limit
R-help,
I 'm trying to optimize a model to data using log-likelihoods
but I encounter the following error message:
> l= c(49.4, 57.7,64.8,70.9,78.7,86.6,88.3,91.6,99,115)
> t=3:12
> fn <- function(params, l=l, t=t) {
Linf <- params[1]
k <- params[2]
t0 <- params[3]
sigma <- params[4]
2004 Jul 21
0
Interpreting negative diagonal values in a hessian
Hi R-community,
I've been trying to fit a model using maximum likelihood in nlm. Upon convergence I examine the hessian and it has a few (not all) positive values on its diagonal, as does its inverse. I am minimizing the negative log likelihood, so I would expect all the members of the diagonal to be negative (I think).
Can anyone shed light on how this might be interpreted?
Thanks much,
2009 Jul 01
2
Difficulty in calculating MLE through NLM
Hi R-friends,
Attached is the SAS XPORT file that I have imported into R using following code
library(foreign)
mydata<-read.xport("C:\\ctf.xpt")
print(mydata)
I am trying to maximize logL in order to find Maximum Likelihood Estimate (MLE) of 5 parameters (alpha1, beta1, alpha2, beta2, p) using NLM function in R as follows.
# Defining Log likelihood - In the function it is noted as