Displaying 20 results from an estimated 5000 matches similar to: "Problem with 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
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
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 <-
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
2004 Aug 25
3
Beginners Question: Make nlm work
Hello,
I'm new to this and am trying to teach myself some R by plotting
biological data. The growth curve in question is supposed to be fitted
to the Verhulst equation, which may be transcribed as follows:
f(x)=a/(1+((a-0.008)/0.008)*exp(-(b*x)))
- for a known population density (0.008) at t(0).
I am trying to rework the example from "An Introduction to R" (p. 72)
for my case and
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)
{
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]
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 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 ) )
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
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(
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)
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,
2003 Jan 06
1
On nlm
Dear all, I have to minimize a (real) function in a loop (say i in
(1:1000)) and store its ``$estimate'', via
l2estim<-nlm(f.minimo,c(-.01,0.1))$estimate
into a vector for further analisys.
Since the function's behaviour is quite peculiar (in the sense that in
the simulation study it may not have a minumum), sometimes I get the the
warning
Error in nlm(minimo, c(-0.01, 0.1),
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
2005 Dec 04
1
Understanding nonlinear optimization and Rosenbrock's banana valley function?
GENERAL REFERENCE ON NONLINEAR OPTIMIZATION?
What are your favorite references on nonlinear optimization? I like
Bates and Watts (1988) Nonlinear Regression Analysis and Its
Applications (Wiley), especially for its key insights regarding
parameter effects vs. intrinsic curvature. Before I spent time and
money on several of the refences cited on the help pages for "optim",
2010 Mar 25
1
*** caught segfault *** address 0x18, cause 'memory not mapped'
Hello R Community,
I've been run the following codes. However, I've been getting an
unusual segfault
that I'm unable to trace its origin. Please give me a light to
decipher the "caught segfault"
Thanks for you attention.
Bernardo.
> options(STERM='iESS', editor='emacsclient')
> rm(list = ls())
> > source("fgenIGLD.R") #RNG
1998 Mar 18
2
``nlm(.) with derivatives''
>>>>> "DougB" == Douglas Bates <bates@stat.wisc.edu> writes:
DougB> .......
DougB> ....... { time comparisons in testing lme(..) for R }
DougB> .......
DougB> This can be expected to run faster when a version of nlm that accepts
DougB> gradients and Hessians is available. ---
Doug, do I understand properly that it won't
2003 May 28
0
supplying the Hessian to "nlm"
Dear all,
I am trying to minimize a function with 3 parameters using nlm. I have worked out the 2nd derivatives (incl the cross-product terms) and would like to supply them to nlm for evaluation. What I am not sure about is how to set up the Hessian matrix for nlm. That is,
attr(lhat, "hessian") <- c(???)
Do I have to enter all 9 of the entries or just the lower triangle of the
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