search for: nlm

Displaying 20 results from an estimated 482 matches for "nlm".

Did you mean: nl
2008 Sep 23
2
RELENG_7: buildworld failed with MODULES_WITH_WORLD=
...pt_inet6.h awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -p awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -q awk -f @/tools/vnode_if.awk @/kern/vnode_if.src -h rm -f .depend mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I. -I@ -I@/contrib/altq /usr/local/src/sys/modules/nfslockd/../../nlm/nlm_advlock.c /usr/local/src/sys/modules/nfslockd/../../nlm/nlm_prot_clnt.c /usr/local/src/sys/modules/nfslockd/../../nlm/nlm_prot_impl.c /usr/local/src/sys/modules/nfslockd/../../nlm/nlm_prot_server.c /usr/local/src/sys/modules/nfslockd/../../nlm/nlm_prot_svc.c /usr/local/src/sys/modules/nfslockd/...
1997 Jun 06
1
R-beta: nlm
I am trying to use the function "nlm" to find the mle. I want to use a generic function for the likelihood which would require me to use both the parameters and the data as arguments. But nlm requires the function to have only the parameters as arguments for this function (see example below). > testfun <- function(x,y)...
2003 Jul 08
2
specifying multiple parameter starting values in nlm
Hi there I am having trouble figuring out how to get an nlm function to report estimates for two parameter values in an estimation. The way I've got it goes something like this: f <- function (q, r) { here, I have a second loop which uses q, r to give me values for c, d below. a and b are already specified; this loop is a mass-balance function...
2010 Jun 15
1
Error in nlm : non-finite value supplied by 'nlm'
...n total I want to estimate two parameters: the AR(1) paramter (vector[1]) and the distribution parameter. My function is the negative loglikelihood derived from a mixing operator. f=function(vector) -sum(log((vector[1]*data$I)+((1-vector[1])*((exp(-2*vector[2]))*besselI(2*vector[2],data$PC))))) nlm(f,p=c(-0.2354,0.00003269)) Error in nlm(f, p = c(-0.2354, 3.269e-05)) : non-finite value supplied by 'nlm' In addition: There were 50 or more warnings (use warnings() to see the first 50) warnings() Warning messages: 1: In besselI(2 * vector[2], data$PC) : value out of range in '...
2003 Oct 24
1
first value from nlm (non-finite value supplied by nlm)
...blem. 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 <- nlm(fn.1, p = c(fo, GG, GL), hessian = TRUE, steptol = 1e-5, iterlim = 1000) foN <- out$estimate[1] GGN <- out$estimate[2] GLN <- out$estimate[3] This works fine but the my start value of S is to poor, so I like to fit S in a second run, with the initial values from the first run (two ru...
2009 Feb 19
2
Source code for nlm()
Hi, Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz file and looked at all the .c and .f files, but couldn't find either nlm.c or nlm.f There is an nlm.r file, but that is not useful. Thanks for any help, Ravi. ---------------------------------------------------------------------------- ------- Ravi Varad...
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 fu...
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 t...
2008 May 22
1
Computing Maximum Loglikelihood With "nlm" Problem
Hi, I tried to compute maximum likelihood under gamma distribution, using nlm function. The code is this: __BEGIN__ vsamples<- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4) mlogl <- function(alpha, x) { if (length(alpha) > 1) stop("alpha must be scalar") if (alpha <= 0) stop("alpha must be positive") return(- sum(dgamma(x, shape =...
2012 Oct 19
2
likelihood function involving integration, error in nlm
Dear R users, I am trying to find the mle that involves integration. I am using the following code and get an error when I use the nlm function d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2) h<-matrix(runif(20,0,1),10) integ<-matrix(c(0),nrow=10, ncol=2) ll<-function(p){ for (k in 1:2){ for(s in 1:10){ integrand<-function(x) x^d[s,k]*exp(-x*gamma(1+1/p))^p*p*x^(p-1)*exp(-x*h[s,k]) integ[s,k]...
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 hessian attributes to the returned fun...
2011 Aug 24
1
problema de selección de valores iniciales en nlm
Hola a todos, Necesito estimar dos parametros utilizando la función nlm; fit<-nlm(hood2par,c(x01[i],x02[j]),iterlim=300, catch=x[,c(3,4,5)],sp=.5) donde hood2par es una logística modificada. Pero en mi caso, la convergencia de nlm depende de los valores iniciales de dichos parámetros. Para buscar dichos valores iniciales de manera automática, genero dos vector...
2003 Sep 01
3
error message in nlm()
Hi all, I have been trying the nlm function but received an error message which reads: Error in nlm(intensities ~ f, c(epsilon.spec.start, epsilon.unspec.start, : invalid function value in 'nlm' optimizer The message is generated somewhere in the compiled part, apparently within the function static void fcn(int n, co...
2004 Oct 12
2
constrained optimization using nlm/optim?
I'm looking for an example of a simple R script that impliments a contrained nonlinear function using nlm or optim. I'm not exactly sure how to impliment the constraints within the objective function that is passed to nlm/optim. obj.func <- function( p ) { x(p) <- unconstrained obj function value if( constraint1 > something ) { obj.func <- x(p) } else { obj.func...
2008 Jun 03
1
nlm behaviour and error
Hi R-Gurus, I've been cutting along quite nicely with nlm, until I threw in the following condition in the function that nlm is minimising: if (((term*bexp) < 0.0001)) { #warning(term*bexp, "=term*bexp",psi,"=psi") theta<-2000 } Now when I run this function anywhere else, there is no problem, whether or...
2012 Nov 30
2
NA return to NLM routine
...a small quirk I came across in R. The following code results in an error: k <- c(2, 1, 1, 5, 5) f <- c(1, 1, 1, 3, 2) loglikelihood <- function(theta,k,f){ if( theta<1 && theta>0 ) return(-1*sum(log(choose(k,f))+f*log(theta)+(k-f)*log(1-theta))) return(NA) } nlm(loglikelihood ,0.5, k, f ) Running this code results in: Error in nlm(logliklihood, 0.5, k, f) : invalid function value in 'nlm' optimizer However if the line return(NA) is changed to return(-NA) or even return(1*NA) or return(1/0), the code works. Is this expected behavior? The nlm hel...
1999 Sep 29
1
nlm recursion problem
Hi I am trying to use nlm with an additional call to nlm within the function but after the first pass, the parameters to the outer call are being passed to the inner call. The inner call is a very trivial problem. ie: test.outer<-function(param.outer){ slope<-nlm(test.inner,param.inner) ... loglikelihood<-s...
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 ) ) { val &l...
2005 May 02
2
"Special" characters in URI
...o! I am crossposting this to R-help and BioC, since it is relevant to both groups. I wrote a wrapper for Entrez search utility (link for this is provided bellow), which can add some new search functionality to existing code in Bioconductor's package 'annotate'*. http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html Entrez search utuility returns a XML document but I have a problem to use URI to retrieve that file, since URI can also contain characters, which should not be there according to http://www.faqs.org/rfcs/rfc2396.html I encountered problems with &quo...
2004 Oct 11
1
Puzzled on nlm
Dear R People: Here is a function to minimized: >mfun1 function(x,a) { x[1] <- a[1]*x[2] + a[3] - a[2]*(a[1]-a[2])*a[3] x[2] <- a[1]*x[1] - a[2]*a[3] return(x) } Here is my first try: >nlm(mfun1,c(1,1)) Error in f(x, ...) : Argument "a" is missing, with no default > >nlm(mfun1,c(1,1),a=c(0.8,0.5,1)) Error in nlm(mfun1, c(1, 1), a = c(0.8, 0.5, 1)) : invalid function value in 'nlm' optimizer > I am stumped. I'm sure that it's something rea...