similar to: [Help] Error when using nls

Displaying 20 results from an estimated 1400 matches similar to: "[Help] Error when using nls"

2007 Oct 01
1
[nls] singular gradient
Hi, I am new to R. I don't have strong background of statistics. I am a student of Geotechnical Engineering. I tried to run a nonlinear regression for a three-variable function, that is N = f(CSR, ev) # N is a function of CSR and ev, and N = CSR/(A +B*CSR), wherer (A,B) are function of ev. N, CSR and ev are observed in the experiments. Following is my R script. rm(list=ls())
2009 Oct 17
1
custom selfStart model works with getInitial but not nls
Hello, I'm having problems creating and using a selfStart model with nlme. Briefly, I've defined the model, a selfStart object, and then combined them to make a selfStart.default model. If I apply getInitial to the selfStart model, I get results. However, if I try usint it with nls or nlsList, these routines complain about a lack of initial conditions. If someone could point out
2009 Sep 21
1
How to use nls when [selfStart] function returns NA or Inf??
Hi Everyone, I posted this a couple of weeks ago with no responses. My interface (via gmane) seemed a bit flakey at the time, so I'm venturing to repost with some additional information. I'm trying to write selfStart non-linear models for use with nls. In these models some combinations of parameter values are illegal; the function value is undefined. That's OK when calling the
2007 Feb 13
1
nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel
Hi, I am a non-expert user of R. I am essaying the fit of two different functions to my data, but I receive two different error messages. I suppose I have two different problems here... But, of which nature? In the first instance I did try with some different starting values for the parameters, but without success. If anyone could suggest a sensible way to proceed to solve these I would be
2001 Apr 29
1
Self-starting nls functions
Hello, I am doing several self-starting growth functions for using with nls(). When I list the self-starting functions included in nls library, for instance, SSlogis, there is: > SSlogis function (input, Asym, xmid, scal) ... <environment: 03476D20> attr(,"class") [1] "selfStart" What is this <environment: 03476D20> instruction? By using deriv() and then
2013 Apr 25
3
nls: example code throws error
Greets, I'm trying to learn to use nls and was running the example code for an exponential model: > x <- -(1:100)/10 > y <- 100 + 10 * exp(x / 2) + rnorm(x)/10 > nlmod <- nls(y ~ Const + A * exp(B * x)) Error in B * x : non-numeric argument to binary operator In addition: Warning message: In nls(y ~ Const + A * exp(B * x)) : No starting values specified for some
2008 Aug 18
1
"nested" getInitial calls; variable scoping problems
Hi All, Another nls related problem (for background, I'm migrating a complicated modelling package from S-plus to R). Below I've reduced this to the minimum necessary to demonstrate my problem (I think); the real situation is more complicated. Two similar selfStart functions, ssA and ssB. The 'initial' function for ssB modifies its arguments a little and then calls getInital
2010 Mar 13
1
testing parallelism of does-response curves using nls()
Hi, I am trying to use F test or Chi-square test to test if 2 5-parameter (A, B, xmid, scal and H) logistic curves are parallel based on residual sum of squares. What's usually done is to first fit the 2 curves using a constraint (or global) model where all parameters are kept the same except for "xmid"; then fit 2 independent curves using unconstraint models where all 5 parameters
2004 Jul 16
1
Does AIC() applied to a nls() object use the correct number of estimated parameters?
I'm wondering whether AIC scores extracted from nls() objects using AIC() are based on the correct number of estimated parameters. Using the example under nls() documentation: > data( DNase ) > DNase1 <- DNase[ DNase$Run == 1, ] > ## using a selfStart model > fm1DNase1 <- nls( density ~ SSlogis( log(conc), Asym, xmid, scal ), DNase1 ) Using AIC() function: >
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()
2005 Apr 23
1
start values for nls() that don't yield singular gradients?
I'm trying to fit a Gompertz sigmoid as follows: x <- c(15, 16, 17, 18, 19) # arbitrary example data here; y <- c(0.1, 1.8, 2.2, 2.6, 2.9) # actual data is similar gm <- nls(y ~ a+b*exp(-exp(-c*(x-d))), start=c(a=?, b=?, c=?, d=?)) I have been unable to properly set the starting value '?'s. All of my guesses yield either a "singular gradient" error if they
2008 Aug 04
0
Unexpected nls behaviour: Solved
Hi Everyone, I'd omitted the non-optional 'parameters' argument to selfStart. Making this change to SSbatch gives the same (successful) result from the two calls to nls. SSbatch<-selfStart( model=function(Batch, Coeffs) { Coeffs[Batch] } ,initial=function(mCall, data, LHS) { # Estimate coefficients as mean of each batch xy <- sortedXyData(mCall[["Batch"]],
2008 Sep 26
0
The 'data' argument and scoping in nls
Hi Everyone, I seek guidance to avoid wasting a lot of time and doing things badly. Several times I've solved my problems, only to find that my solutions were clumsy and not robust. (see "nested" getInitial calls; variable scoping problems: Solved?? http://finzi.psych.upenn.edu/R/Rhelp02a/archive/139943.html for one truly horrible approach). I'm sure that I'm not the
2008 Aug 05
1
Fix for nls bug???
Hi All, I've hit a problem using nls. I think it may be a restriction in the applicability of nls and I may have found a fix, but I've been wrong before. This example is simplified to the essentials. My real application is much more complicated. Take a function of matrix 'x' with additional arguments: matrix 'aMat' whose values are _not_ to be determined by nls vector
2008 Aug 01
0
Unexpected nls behaviour
Hi everyone, I thought that for a selfStart function, these two should be exactly equivalent > nls(Aform, DF) > nls(Aform, DF, start=getInitial(Aform, DF)) but in this example that is not the case in R (although it is in S-plus V6.2) ------------------------------ SSbatch<-selfStart( model=function(Batch, Coeffs) { Coeffs[Batch] } ,initial=function(mCall, data, LHS) { # Estimate
2006 Feb 12
1
lme, nlsList, nlsList.selfStart
Dear listers, I am trying to fit a model using nlsList() using alternately a SSfol() selfstart function or its developped equivalent formulae. This preliminary trial works well mydata<-groupedData(Conc~Tps|Organ,data=mydata) mymod1<-nls(Conc~SSfol(Dose,Tps,lKe,lKa,lCl),data=mydata) as well as a developped form: mymod2<-nls(Conc~Dose * exp(lKe+lKa-lCl) *
2009 Sep 04
1
How should a SelfStart function handle illegal parameter values?
Hi Everyone, I'm trying to write selfStart non-linear models for use with nls. In these models some combinations of parameter values are illegal; the function value is undefined. That's OK when calling the function directly [e.g. SSmodel(x, pars...)]; I return an appropriate non-value such as NA or Inf. However, when called from nls [e.g. nls(y~SSmodel(x, pars...), ...)] those
2003 Jul 24
0
nls.control in gnls
Hi, I've made a selfStart function for use with gnls and the following piece of code works nicely: check1 <- gnls(y ~ spot.shape.fct(xcord, ycord, background, spotintensity, rho, sigma, delta, mux, muy), start=getInitial(y ~ spot.shape.fct(xcord, ycord, background, spotintensity, rho,
2010 Jul 12
1
Custom nonlinear self starting function w/ 2 covariates
Hello, I'm trying to adjust a non linear model in which the biological response variable (ratio of germinated fungus spores) is dependent on 2 covariates (temperature and time). The response to temperature is modeled by a kind of beta function with 2 parameters (optimal and maximum temperatures) and the time function is a 2-parameter Weibull. Adjustments with nls or gnls work, but I need to
2006 May 24
1
problem-nlme
Hi, I have great problems with my work in R. I look for to model the growth of fish. I have "Longitudinal data", a serie of repeated measures for each individual. Using the corresponding packages "nlme" in R. I treat to fit to the data different growth functions, wich were entered by me. Unfortunately for no it was arrived at the convergence, several error messages appeared. I