similar to: nls question

Displaying 20 results from an estimated 10000 matches similar to: "nls question"

2002 Apr 24
3
nonlinear least squares, multiresponse
I'm trying to fit a model to solve a biological problem. There are multiple independent variables, and also there are multiple responses. Each response is a function of all the independent variables, plus a set of parameters. All the responses depend on the same variables and parameters - just the form of the function changes to define each seperate response. Any ideas how I can fit
1998 Apr 14
1
R-beta: SEs for one-param MLE in R?
Simple-mindedly I tried getting MLE and SE for one-parameter model in the same way as for multi-param models. out<-nlm(fn,p=c(2),hessian=T) But sqrt(diag(solve(out$hessian))) gives the answer 1. The Hessian has only one entry, not really a matrix. diag(x) gives 1 if x is just a single number. Is this what I should be doing to get SE for MLE? sqrt(solve(out$hessian)) Thanks very much for
1998 Apr 14
1
R-beta: SEs for one-param MLE in R?
Simple-mindedly I tried getting MLE and SE for one-parameter model in the same way as for multi-param models. out<-nlm(fn,p=c(2),hessian=T) But sqrt(diag(solve(out$hessian))) gives the answer 1. The Hessian has only one entry, not really a matrix. diag(x) gives 1 if x is just a single number. Is this what I should be doing to get SE for MLE? sqrt(solve(out$hessian)) Thanks very much for
2005 Mar 08
4
Non-linear minimization
hello, I have got some trouble with R functions nlm(), nls() or optim() : I would like to fit 3 parameters which must stay in a precise interval. For exemple with nlm() : fn<-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2) out<-nlm(fn, p=c(4, 17, 5), hessian=TRUE,print.level=2) with estdata() a function which returns value to fit with dN (observed data vactor) My problem is that only
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 <-
2001 Jan 09
3
log(0) problem in max likelihood estimation
This practical problem in maximum likelihood estimation must be encountered quite a bit. What do you do when a data point has a probability that comes out in numerical evaluation to zero? In calculating the log likelihood you then have a log(0) problem. Here is a simple example (probit) which illustrates the problem: x<-c(1,2,3,4,100) ntrials<-100 yes<-round(ntrials*pnorm((x-3)/1))
2002 Mar 08
1
Matrix multiplication problem
Dear List, I am having trouble with some R code I have written to perform Redundancy Analysis (RDA) on a matrix of species abundance data (Y) and a matrix of environmental data (X). RDA is a constrained form of PCA and can be thought of as a PCA of the fitted values of a regression of each variable in Y on all variables in X. For info, the first use of RDA is in: Rao, C.R, 1964. The use and
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",
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",
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
2012 Mar 08
1
sas retain statement in R or fitting differene equations in NLS
I wish to fit a dynamical model in R and I am running in a problem that requires some of your wisdom to solve. For SAS users I am searching for the equivalent of the */retain/ *statement. For people that want to read complicated explanations to help me: I have a system of two equations written as difference equations here. To boil it down. I have a dataframe with three variables y, X1, X2
2011 Mar 19
2
problem running a function
Dear people, I'm trying to do some analysis of a data using the models by Royle & Donazio in their fantastic book, particular the following function: http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn that applied to my data and in the console is as follows: > `desman.y` <- structure(c(3L,4L,3L,2L,1L), .Names = c("1", "2", "3",
2016 Apr 06
1
Optimization max likelihood problem
hello all, I am getting wrong estimates from this code. do you know what could be the problem. thanks x<- c(1.6, 1.7, 1.7, 1.7, 1.8, 1.8, 1.8, 1.8) y <- c( 6, 13, 18, 28, 52, 53, 61, 60) n <- c(59, 60, 62, 56, 63, 59, 62, 60) DF <- data.frame(x, y, n) # note: there is no need to have the choose(n, y) term in the likelihood fn <- function(p, DF) { z <- p[1]+p[2]*DF$x
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) {
2009 Dec 06
5
optim with constraints
Hi, dear R users I am a newbie in R and I wantto use the method of meximum likelihood to fit a Weibull distribution to my survival data. I use "optim" as follows: optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian = TRUE) My question is: how do I setup the constraints so that the two parametrs of Weibull to be pisotive? Or should I use other function
2005 Dec 22
2
Testing a linear hypothesis after maximum likelihood
I'd like to be able to test linear hypotheses after setting up and running a model using optim or perhaps nlm. One hypothesis I need to test are that the average of several coefficients is less than zero, so I don't believe I can use the likelihood ratio test. I can't seem to find a provision anywhere for testing linear combinations of coefficients after max. likelihood. Cheers
2017 Mar 03
2
Bug in nlm()
Dear all, I have found a bug in nlm() and would like to submit a report on this. Since nlm() is in the stats-package, which is maintained by the R Core team, bug reports should be submitted to R's Bugzilla. However, I'm not a member of Bugzilla. Could anyone be so kind to add me to R's Bugzilla members or let me know to whom I should send the bug report? Thank you in advance. Kind
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 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