Displaying 20 results from an estimated 20000 matches similar to: "Parameter names in nls()"
2008 Jul 21
1
Parameter names in nls
Dear R-help,
Could you please examine the following code, and see if I have discovered a bug or not, or am just doing something silly.
I am trying to create a package to do fish stock assessment using the nls() function to fit the modelled stock size to the various pieces of information that we have. The main problem with this sort of task is that the number and type of parameters that go into
2006 May 21
2
nls & fitting
Dear All,
I may look ridiculous, but I am puzzled at the behavior of the nls with
a fitting I am currently dealing with.
My data are:
x N
1 346.4102 145.428256
2 447.2136 169.530634
3 570.0877 144.081627
4 721.1103 106.363316
5 894.4272 130.390552
6 1264.9111 36.727069
7 1788.8544 52.848587
8 2449.4897 25.128742
9 3464.1016 7.531766
10 4472.1360 8.827367
11
2009 Jul 09
1
nls, reach limit bounds
Hi,
I am trying to fit a 4p logistic to this data, using nls function. The function didn't freely converge; however, it converged if I put a lower and an upper bound (in algorithm port). Also, the b1.A parameter always takes value of the upper bound, which is very strange. Has anyone experienced about non-convergent of nls and how to deal with this kind of problem?
Thank you very much.
2007 Sep 05
3
'singular gradient matrix’ when using nls() and how to make the program skip nls( ) and run on
Dear friends.
I use nls() and encounter the following puzzling problem:
I have a function f(a,b,c,x), I have a data vector of x and a vectory y of
realized value of f.
Case1
I tried to estimate c with (a=0.3, b=0.5) fixed:
nls(y~f(a,b,c,x), control=list(maxiter = 100000, minFactor=0.5
^2048),start=list(c=0.5)).
The error message is: "number of iterations exceeded maximum of
2007 Apr 15
1
nls.control( ) has no influence on nls( ) !
Dear Friends.
I tried to use nls.control() to change the 'minFactor' in nls( ), but it
does not seem to work.
I used nls( ) function and encountered error message "step factor
0.000488281 reduced below 'minFactor' of 0.000976563". I then tried the
following:
1) Put "nls.control(minFactor = 1/(4096*128))" inside the brackets of nls,
but the same error message
2009 Mar 12
3
avoiding termination of nls given convergence failure
Hello. I have a script in which I repeatedly fit a nonlinear regression to
a series of data sets using nls and the port algorithm from within a loop.
The general structure of the loop is:
for(i in 1:n){
… extract relevant vectors of dependent and independent variables …
… estimate starting values for Amax and Q.LCP…
2008 Jan 27
2
Likelihood optimization numerically
Dear List,
I am not sure how should i optimize a log-likelihood numerically:
Here is a Text book example from Statistical Inference by George Casella, 2nd
Edition Casella and Berger, Roger L. Berger (2002, pp. 355, ex. 7.4 # 7.2.b):
data = x = c(20.0, 23.9, 20.9, 23.8, 25.0, 24.0, 21.7, 23.8, 22.8, 23.1, 23.1, 23.5, 23.0, 23.0)
n <- length(x)
# likelihood from a 2 parameter Gamma(alpha,
2006 Aug 15
2
nls convergence problem
I'm having problems getting nls to agree that convergence has occurred in a
toy problem.
nls.out never gets defined when there is an error in nls. Reaching the
maximum number of iterations is alway an error, so nls.out never gets
defined when the maximum number of iterations is reched.
>From ?nls.control:
tol: A positive numeric value specifying the tolerance level for
the
2005 Feb 22
3
problems with nonlinear fits using nls
Hello colleagues,
I am attempting to determine the nonlinear least-squares estimates of
the nonlinear model parameters using nls. I have come across a common
problem that R users have reported when I attempt to fit a particular
3-parameter nonlinear function to my dataset:
Error in nls(r ~ tlm(a, N.fix, k, theta), data = tlm.data, start =
list(a = a.st, :
step factor 0.000488281
2005 Dec 14
2
suggestions for nls error: false convergence
Hi,
I'm trying to fit some data using a logistic function defined as
y ~ a * (1+m*exp(-x/tau)) / (1+n*exp(-x/tau)
My data is below:
x <- 1:100
y <- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,1,1,2,2,2,2,2,3,4,4,4,5,
5,5,5,6,6,6,6,6,8,8,9,9,10,13,14,16,19,21,
24,28,33,40,42,44,50,54,69,70,93,96,110,127,127,141,157,169,
2010 Mar 30
6
Error "singular gradient matrix at initial parameter estimates" in nls
I am using nls to fit a non linear function to some data.
The non linear function is:
y= 1- exp(-(k0+k1*p1+ .... + kn*pn))
I have chosen algorithm "port", with lower boundary is 0 for all of the
ki parameters, and I have tried many start values for the parameters ki
(including generating them at random).
If I fit the non linear function to the same data using an external
2010 Apr 06
1
estimating the starting value within a ODE using nls and lsoda
All-
I am interested in estimating a parameter that is the starting value for an ODE model.
That is, in the typical combined fitting procedure using nls and lsoda (alternatively rk4), I first defined the ODE model:
minmod <- function(t, y, parms) {
G <- y[1]
X <- y[2]
with(as.list(parms),{
I_t <- approx(time, I.input, t)$y
dG <- -1*(p1 + X)*G +p1*G_b
dX <-
2003 Jul 18
3
question about formulating a nls optimization
Dear list,
I'm migrating a project from Matlab to R, and I'm
facing a relatively complicated problem for nls. My
objective function is below:
>> objFun <- function(yEx,xEx,tEx,gamma,theta,kappa){
yTh <- pdfDY(xEx,tEx,gamma,theta,kappa)
sum(log(yEx/yTh)^2)
}
The equation is yTh=P(xEx,tEx) + noise.
I collect my data in:
>> data <-
2010 May 11
1
nls() and nls2() behavior?
first, apologies for so many posts yesterday and today. I am
wrestling with nls() and nls2(). I have tried to whittle it down to a
simple example that still has my problem, yet can be cut-and-pasted
into R. here it is:
library(nls2)
options(digits=12);
y= c(0.4334,0.3200,0.5848,0.6214,0.3890,0.5233,0.4753,0.2104,0.3240,0.2827,0.3847,0.5571,0.5432,0.1326,0.3481)
x=
2012 Jun 28
1
add constraints to nls or use another function
Hello,
I'm trying to fit experimental data with a model and nls.
For some experiments, I have data with x from 0 to 1.2 and the fit is quite
good.
But it can happen that I have data only the [0,0.8] range (see the example
below) and, then, the fit is not correct.
I would like to add a constraint, for example : the second derivative must
be positive.
But I don't know how to add this to
2005 Jan 06
1
nls - convergence problem
Dear list,
I do have a problem with nls. I use the following data:
>test
time conc dose
0.50 5.40 1
0.75 11.10 1
1.00 8.40 1
1.25 13.80 1
1.50 15.50 1
1.75 18.00 1
2.00 17.00 1
2.50 13.90 1
3.00 11.20 1
3.50 9.90 1
4.00 4.70 1
5.00 5.00 1
6.00 1.90 1
7.00 1.90 1
9.00 1.10 1
12.00 0.95 1
14.00
2004 Jan 22
4
Fitting compartmental model with nls and lsoda?
Dear Colleagues,
Our group is also working on implementing the use of R for pharmacokinetic compartmental analysis. Perhaps I have missed something, but
> fit <- nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=0.5, k2=0.5)),
+ data=C1.lsoda,
+ start=list(K1=0.3, k2=0.7),
+ trace=T
+ )
Error in eval(as.name(varName), data) : Object
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
Dear R-help,
Here's a simple example of nonlinear curve fitting where nls seems to get
the answer wrong on a very simple exponential fit (my R version 2.7.2).
Look at this code below for a very basic curve fit using nls to fit to (a)
a logarithmic and (b) an exponential curve. I did the fits using
self-start functions and I compared the results with a more simple fit
using a straight lm()
2012 Apr 17
3
error using nls with logistic derivative
Hi
I?m trying to fit a nonlinear model to a derivative of the logistic function
y = a/(1+exp((b-x)/c)) (this is the parametrization for the SSlogis function with nls)
The derivative calculated with D function is:
> logis<- expression(a/(1+exp((b-x)/c)))
> D(logis, "x")
a * (exp((b - x)/c) * (1/c))/(1 + exp((b - x)/c))^2
So I enter this expression in the nls function:
2006 Aug 08
1
Fitting data with optim or nls--different time scales
Hi,
I have a system of ODE's I can solve with lsoda.
Model=function(t,x,parms)
{
#parameter definitions
lambda=parms[1]; beta=parms[2];
d = parms[3]; delta = parms[4];
p=parms[5]; c=parms[6]
xdot[1] = lambda - (d*x[1])- (beta*x[3]*x[1])
xdot[2] = (beta*x[3]*x[1]) - (delta*x[2])
xdot[3] = (p*x[2]) - (c*x[3])
return(list(xdot))
}
I want