search for: nlsmodel

Displaying 20 results from an estimated 73 matches for "nlsmodel".

2013 Jan 02
1
Need help with self-defined function to perform nonlinear regression and get prediction interval
Dear All, I was trying to call a self-defined function that performs nonlinear regression and gets the corresponding prediction upper limit using nls2 package. However, weird thing happened. When I called the function in the main program, an error message "fitted(nlsmodel): object 'nlsmodel' not found" came up. But when I directly ran the codes inside the function, no error came up and the codes worked well. I have never encountered this problem with all the other self-defined functions, only this one, so I doubt it is caused by something in the nls2 pa...
2007 Feb 13
1
nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel
...es specified for some parameters. Intializing 'b', 'a' to '1.'. Consider specifying 'start' or using a selfStart model in: nls(fath ~ ((b^2)/(a^2)) * exp((-dist/a)^b), polcurve) #Geometric function >s=nls(fath~((b-1)*(b-2)/a)*((1+dist/a)^-b),polcurve) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates In addition: Warning message: No starting values specified for some parameters. Intializing 'b', 'a' to '1.'. Consider specifying 'start' or using a selfStart model in: nls(fa...
2004 Jun 10
2
nls and R scoping rules
...start=list(w=1)) res } #======== cut here========== if called as "wrapper(1)" this runs fine because the fitting function "fifu" is assigned in the GlobalEnv. if called as "wrapper(0)", "fifu" is defined only locally and "nls" (actually, "nlsModel", I think) does not know what I'm talking about. I understand, the problem is that the scoping rules are such that "nls" does not resolve 'fifu' in the parent environment, but rather in the GlobalEnv. (this is different for the data, which *are* taken from the parent en...
2009 Dec 18
2
NLS-Weibull-ERROR
Hello I was trying to estimate the weibull model using nls after putting OLS values as the initial inputs to NLS. I tried multiple times but still i m getting the same error of Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates. The Program is as below > vel <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14) > df <- data.frame(conc, vel) > df conc vel 1 0.077 1 2 0.328 2 3 0.882 3 4 1.195 4 5 1.884 5 6...
2005 Jun 01
1
nls(() and trace
hi everybody, is there a canonical way to get hold of the "trace=TRUE" output from nls, i.e. to copy it to a R variable (or at least to an external log file)? I have only found the possibility to "fix(nlsModel)" (and than the correct copy of that: namespace function ...) within the R-session by modifying the trace() definition within nlsModel. not really good for everyday use ... regards, joerg ps: if this comes to douglas bates' attention: would'nt it be helpful to add the trace out...
2006 Sep 15
1
Formula aruguments with NLS and model.frame()
...alq(mf,data); n<-nrow(mf) mf<-as.list(mf); wts <- if (!mWeights) model.weights(mf) else rep(1, n) if (any(wts < 0 | is.na(wts))) stop("missing or negative weights not allowed") m <- switch(algorithm, plinear = nlsModel.plinear(formula, mf, start, wts), port = nlsModel(formula, mf, start, wts, upper), nlsModel(formula, mf, start, wts)); I am struggling with the environment issues associated with performing these operations. I did not include the data because it is 9000 observations of temperatur...
2011 Jun 30
1
Error "singular gradient matrix at initial parameter estimates" in nls
Greetings, I am struggling a bit with a non-linear regression. The problem is described below with the known values r and D inidcated. I tried to alter the start values but get always following error message: Error in nlsModel(formula, mf, start, wts): singular gradient matrix at initial parameter estimates Calls: nls -> switch -> nlsModel I might be missing something with regard to the different algorithms or I just have to try again with some different start values. If anyone finds some time to have a look at...
2009 Jul 23
1
Network from package functions
..., i.e. visualize the cross-references from one function to another in the same or some dependent package? An example would be a function like 'nls' on top of the hierarchy and then a network of nodes from the functions that are called within 'nls' such as 'getInitial', 'nlsModel', 'nls_port_fit' etc. Important maybe also some way to tweak such as not to include < trivial > functions such as 'as.formula'. Many thanks in advance, Andrej _____________________________________ Dr. rer. nat. Andrej-Nikolai Spiess (Dipl. Biol.) Department of Androlog...
1999 Mar 30
0
Prototype nls library for R using closures
...lled on Unix/Linux systems by expanding the tar file and running R INSTALL nls This version does not use any C code so it should be installable on Windows if you can expand the tar file. The nls function takes the model formula, the data, and the starting values for the parameters and creates an nlsModel object, which is a list of functions _and_ the environment in which they were created. That is, it is a list of function closures that share the same environment. This is similar in flavor to the example in the demos/language/scoping.R file. All of the functions in an nlsModel object behave like...
2006 Sep 07
0
Help understanding how nls parses the formula argument to estimate the model
...mf<-evalq(mf,data); n<-nrow(mf) mf<-as.list(mf); wts <- if (!mWeights) model.weights(mf) else rep(1, n) if (any(wts < 0 | is.na(wts))) stop("missing or negative weights not allowed") m <- switch(algorithm, plinear = nlsModel.plinear(formula, mf, start, wts), port = nlsModel(formula, mf, start, wts, upper), nlsModel(formula, mf, start, wts)); I am struggling with the environment issues associated with performing these operations. thank you
2006 Sep 21
0
Help understanding how nls parses the formula argument to estimate the model
...alq(mf,data); n<-nrow(mf) mf<-as.list(mf); wts <- if (!mWeights) model.weights(mf) else rep(1, n) if (any(wts < 0 | is.na(wts))) stop("missing or negative weights not allowed") m <- switch(algorithm, plinear = nlsModel.plinear(formula, mf, start, wts), port = nlsModel(formula, mf, start, wts, upper), nlsModel(formula, mf, start, wts)); I am struggling with the environment issues associated with performing these model.frame operations with the eval functions. thank you
2012 Jan 19
3
fitting an exp model
...40.66,59.81,73.11,81.65) df <- data.frame(t, var) # model # var ~ a+b*(1-exp(-k*t)) # I'm looking for values of a,b and k # formula # mod <- nls(formula = var ~ a+b *(1-exp((-k)*t)), start=list(a=0, b=10, k=0), trace=T) # It fails and I get the following error - Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I was trying different methods and looking for some solutions but nothing is working... Any suggestions how I can fix this? I appreciated any help Thanks in advance. -- View this message in context: http://...
2011 Nov 30
2
nls help
...on between X and Y, and I would like to fit an appropriate model. I was thinking an exponential decay model might work well. I tried the following (a and k starting values are based off of a lm() fit), but get an error. fit <- nls(Y ~ a*exp(-k * X), datum, start=c(a=3400, k=1867)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I have never attempted to fit a non-linear model before, and thus the model may be inappropriately specified, or it is also possible that I have no idea what I am doing. Would someone please offer some advice....
2009 Aug 25
3
Covariates in NLS (Multiple nonlinear regression)
...expecting the output to give individual regression models for each coefficient (a,b,c) with q as a covariate. I have tried the following code, and get the resultant error messages: > weib.nls <- nls(Y ~ (a*(1-exp(-b*X^c)))|q, > + data=DATA, > + start=c(a=75,b=0.05,c=0.7)) > Error in nlsModel(formula, mf, start, wts) : > singular gradient matrix at initial parameter estimates > > summary(weib.nls) > > weib.nls2 <- nls(Y~ (a*(1-exp(-b*X^c)))+q, > + data=DATA, > + start=c(a=75,b=0.05,c=0.7)) > Error in numericDeriv(form[[3L]], names(ind), env) : > Miss...
2010 Mar 30
6
Error "singular gradient matrix at initial parameter estimates" in nls
...r the parameters ki (including generating them at random). If I fit the non linear function to the same data using an external algorithm, it fits perfectly and finds the parameters. As soon as I come to my R installation (2.10.1 on Kubuntu Linux 910 64 bit), I keep getting the error: Error in nlsModel(formula, mf, start, wts, upper) : singular gradient matrix at initial parameter estimates I have read all the previous postings and the documentation, but to no avail: the error is there to stay. I am sure the problem is with nls, because the external fitting algorithm perfectly fits it in le...
2013 Mar 14
2
question about nls
Hi,all: I met a problem of nls. My data: x y 60 0.8 80 6.5 100 20.5 120 45.9 I want to fit exp curve of data. My code: > nls(y ~ exp(a + b*x)+d,start=list(a=0,b=0,d=1)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I can't find out the reason for the error. Any suggesions are welcome. Many thanks. [[alternative HTML version deleted]]
2001 Sep 30
2
non linear models
...List, Honestly, I feel a little bit stupid - I would like to do something rather simple: fit a non linear model to existing data, to be more precise I wanted to start with simple higher order polynomials. Unfortunately, I do not quite understand the examples in the helpfiles for the nlm, nls and nlsModel commands. Could anyone please provide a simple example to get me started (i.e. y = p + x^2 fitted to x= -1 0 1 y = 2 1 2; a simple parabola p should turn out to be 1). How do I do this and how do I do the same for something like y = a + bx + cx^2 + dx^3 ?? Thank you very much, Christian Endter...
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
...ars) > ..$ getPars :function () > ..$ getAllPars:function () > ..$ getEnv :function () > ..$ trace :function () > ..$ Rmat :function () > ..$ predict :function (newdata = list(), qr = FALSE) > ..- attr(*, "class")= chr "nlsModel" > $ convInfo :List of 5 > ..$ isConv : logi TRUE > ..$ finIter : int 8 > ..$ finTol : num 1.64e-08 > ..$ stopCode : int 0 > ..$ stopMessage: chr "converged" > $ data : language parent.frame() > $ call : language nls(for...
2004 Oct 07
1
confidence interval for nls
...oduce confidence intervals for the nls predictions using R? I had a course were we used SAS PROC nlin and there you could get intervals for the parameters and the prediction but I do not have access to SAS. Would it be difficult to implement, I tried to dig into the help pages of nls, vcov and nlsModel but I could not really make sense out of this? --------------------------------------------- Henrik Andersson Netherlands Institute of Ecology - Centre for Estuarine and Marine Ecology P.O. Box 140 4400 AC Yerseke Phone: +31 113 577473 h.andersson at nioo.knaw.nl http://www.nioo.knaw.nl/ppages/han...
2005 Jul 20
1
nls
...y[t-1])%*%beta1*(1-w). So I ran some simulations to obtain the y's, and I am putting it into the nls: res<-nls(y~(a+b*x)*w+(c+d*x)*(1-w),start=list(a=1,b=0.3,c=-1,d=-0.2,w=0.5)) and the starting parameter values are similar to the ones I used for simulations, however I am getting Error in nlsModel(formula, mf, start) : singular gradient matrix at initial parameter estimates What am I doing wrong? I tried many different parameter values to no avail. Thank you so much in advance, Sincerely, Eugene McGill University