Re: [R] nls() syntax

2020-12-11 Thread Rolf Turner
On Fri, 11 Dec 2020 19:20:26 -0500 Gabor Grothendieck wrote: > The start= argument should be as follows: > > nls(y ~ x/(x - a[z]),start=list(a = strt),data=xxx) Nya-ha! I, uh, clearly wasn't thinking clearly! (Feel a bit *duh* now!) Thanks Gabor. cheers, Rolf > > On Fri, Dec 11, 2020

Re: [R] nls() syntax

2020-12-11 Thread Duncan Murdoch
On 11/12/2020 6:50 p.m., Rolf Turner wrote: I want to fit a model y = x/(x-a) where the value of a depends on the level of a factor z. I cannot figure out an appropriate syntax for nls(). The "parameter" a (to be estimated) should be a vector of length equal to the number of levels of z. I t

Re: [R] nls() syntax

2020-12-11 Thread Gabor Grothendieck
The start= argument should be as follows: nls(y ~ x/(x - a[z]),start=list(a = strt),data=xxx) On Fri, Dec 11, 2020 at 6:51 PM Rolf Turner wrote: > > > > I want to fit a model y = x/(x-a) where the value of a depends > on the level of a factor z. I cannot figure out an appropriate > syntax for

[R] nls() syntax

2020-12-11 Thread Rolf Turner
I want to fit a model y = x/(x-a) where the value of a depends on the level of a factor z. I cannot figure out an appropriate syntax for nls(). The "parameter" a (to be estimated) should be a vector of length equal to the number of levels of z. I tried: strt <- rep(3,length(levels(z)) names(

Re: [R] nls problem

2020-04-03 Thread William Dunlap via R-help
Sendt:* 2. april 2020 18:50 > *Til:* Troels Ring > *Cc:* r-help mailing list > *Emne:* Re: [R] nls problem > > > > Roundoff/cancelation error: compare the following. The first is > equivalent to your function, the last to fitted(). > > > > > with(aedf

Re: [R] nls problem

2020-04-02 Thread Troels Ring
alone saves me. BW Troels Fra: William Dunlap Sendt: 2. april 2020 18:50 Til: Troels Ring Cc: r-help mailing list Emne: Re: [R] nls problem Roundoff/cancelation error: compare the following. The first is equivalent to your function, the last to fitted(). > with(aedf, t(cbind(1,

Re: [R] nls problem

2020-04-02 Thread J C Nash
Yes, I was waiting to see how long before it would be noticed that this is not the sort of problem for which nls() is appropriate. And I'll beat the drum again that nls() uses a simple (and generally deprecated) forward difference derivative approximation that gets into trouble a VERY high proport

Re: [R] nls problem

2020-04-02 Thread William Dunlap via R-help
Roundoff/cancelation error: compare the following. The first is equivalent to your function, the last to fitted(). > with(aedf, t(cbind(1, pH, pH^2) %*% round(coef(m), digits=2))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,

Re: [R] nls problem

2020-04-02 Thread Rui Barradas
Simpler: FPG2 <- function(x, model){ as.vector(cbind(1, x, x^2) %*% coef(model)) } Hope this helps, Rui Barradas Às 12:56 de 02/04/20, Rui Barradas escreveu: Hello, Sorry, disregard my previous e-mail. Instead of your FPG function try FPG <- function(pH, model) {   coef(model)[1] + co

Re: [R] nls problem

2020-04-02 Thread Rui Barradas
Hello, Sorry, disregard my previous e-mail. Instead of your FPG function try FPG <- function(pH, model) { coef(model)[1] + coef(model)[2]*pH + coef(model)[3]*pH^2 } FPG(aedf$pH, m) fitted(m) Hope this helps, Rui Barradas Às 12:30 de 02/04/20, Rui Barradas escreveu: Hello, Tip: in a for

Re: [R] nls problem

2020-04-02 Thread Rui Barradas
Hello, Tip: in a formula, pH^2 = pH*pH is an interaction. pH^2 = pH*pH = pH + pH + pH:pH = pH Try I(pH^2) Hope this helps, Rui Barradas Às 12:07 de 02/04/20, Troels Ring escreveu: Dear friends - I'm on Win10 with R 6.3.1 and have a very simple problem with nls which apparently gives a decen

[R] nls problem

2020-04-02 Thread Troels Ring
Dear friends - I'm on Win10 with R 6.3.1 and have a very simple problem with nls which apparently gives a decent fit to the parable below, even without starting values. But when I then think I know the meaning of the three parameters a, b, and d it goes very wrong. I guess I am again overlooking so

Re: [R] nls() and loop

2017-10-21 Thread Martin Maechler
Dear Vangi, > Evangelina Viotto > on Fri, 20 Oct 2017 11:37:12 -0300 writes: > Hello I´m need fitt growth curve with data length-age. I want to evaluate > which is the function that best predicts my data, to do so I compare the > Akaikes of different models. I'm now need

Re: [R] nls() and loop

2017-10-20 Thread J C Nash
Yes, some form of try() is often needed with nls() to avoid scripts stopping. You might also find nlxb() from package nlsr more reliable in finding solutions. It uses analytic derivatives if available if the model is given as an expression, and a Marquardt stabilized solver. But do expect it to

Re: [R] nls() and loop

2017-10-20 Thread Jeff Newmiller
?tryCatch -- Sent from my phone. Please excuse my brevity. On October 20, 2017 7:37:12 AM PDT, Evangelina Viotto wrote: >Hello I´m need fitt growth curve with data length-age. I want to >evaluate >which is the function that best predicts my data, to do so I compare >the >Akaikes of different mo

[R] nls() and loop

2017-10-20 Thread Evangelina Viotto
Hello I´m need fitt growth curve with data length-age. I want to evaluate which is the function that best predicts my data, to do so I compare the Akaikes of different models. I'm now need to evaluate if changing the initial values changes the parameters and which do not allow to estimate the model

Re: [R] nls fitting & plotting to data subsets defined by combinations of categorical variables

2017-03-11 Thread J C Nash
Given that nls() often gives failures of the "singular gradient" type, you may want to give package nlsr a try with the nlxb() function. It should be able to use analytic gradients on this expression, has bounds, and uses a Marquardt stabilized solver. It can still fail, but is more robust than n

[R] nls fitting & plotting to data subsets defined by combinations of categorical variables

2017-03-11 Thread DANIEL PRECIADO
Dear list, I want to apply the same nls function to different subsets of a larger dataset. These subsets are defined as unique combinations of two (categorical) variables, each one with two levels, so I should obtain 4 sets of parameters after fitting. I have managed to do it in a loop, creatin

Re: [R] nls for R version 3.3.2

2016-11-29 Thread J C Nash
You may also want to use tools that are more robust. Package nlmrt uses analytic Jacobian where possible and a Marquardt solver. Package minpack.lm uses a Marquardt solver, but the forward difference derivatives of nls() for its Jacobian. alpha level work in https://r-forge.r-project.org/R/?gro

Re: [R] nls for R version 3.3.2

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 12:30 AM, Troels Ring wrote: > > Dear friends - updated to R 3.3.2 - tried to install nls - got this sad > response > > package ‘nls’ is not available (as a binary package for R version 3.3.2) > > I'm on windows 7 I don't see an `nls` package on CRAN. Perhaps it has bee

Re: [R] nls for R version 3.3.2

2016-11-29 Thread Berend Hasselman
> On 29 Nov 2016, at 09:30, Troels Ring wrote: > > Dear friends - updated to R 3.3.2 - tried to install nls - got this sad > response > > package ‘nls’ is not available (as a binary package for R version 3.3.2) > > I'm on windows 7 > > Did I do something wrong? Will a binary appear eventuall

[R] nls for R version 3.3.2

2016-11-29 Thread Troels Ring
Dear friends - updated to R 3.3.2 - tried to install nls - got this sad response package ‘nls’ is not available (as a binary package for R version 3.3.2) I'm on windows 7 Did I do something wrong? Will a binary appear eventually? Would I have to make it myself? Best wishes Troels Ring Aal

Re: [R] nls model parameter compare?

2015-08-26 Thread peter dalgaard
On 26 Aug 2015, at 00:34 , Jianling Fan wrote: > Hello everyone, > > I am doing nonlinear regression using a same sigmoidal model for > different treatments. for each treatment, I got a set of estimated > parameters (a1, b1, c1 for treatment 1; a2, b2, c2 for treatment 2; > a3, b3, c3 for treat

Re: [R] nls model parameter compare?

2015-08-25 Thread Bert Gunter
This is a statistical question, and is off topic for this list, which is about R programming. Post to a statistical list, like stats.stackexchange.com, instead. Warning: This is not a simple issue. You should seriously consider getting local advice from someone with the necessary statistical exper

[R] nls model parameter compare?

2015-08-25 Thread Jianling Fan
Hello everyone, I am doing nonlinear regression using a same sigmoidal model for different treatments. for each treatment, I got a set of estimated parameters (a1, b1, c1 for treatment 1; a2, b2, c2 for treatment 2; a3, b3, c3 for treatment 3). And I want to compare these parameters for different

Re: [R] nls in r

2015-08-12 Thread vidya
Thank you very much Prof.JC Nash I am still don't understand about that Jacobian. why the model not approprite. Really appreciate King regards -- View this message in context: http://r.789695.n4.nabble.com/nls-in-r-tp4711012p4711044.html Sent from the R help mailing list archive at Nabble.co

Re: [R] nls in r

2015-08-12 Thread Jeff Newmiller
This subject is introduced in multivariable calculus, and in more detail in some numerical analysis courses. Graphing is one common technique for identifying promising search ranges if the number of variables can be reduced to one or two. Analytical identification of asymptotes, extrema, and zer

Re: [R] nls in r

2015-08-12 Thread vidya
How can you find that starting value ? is there a trick for that ?. Really appreciate. Thank you very much. King Regards -- View this message in context: http://r.789695.n4.nabble.com/nls-in-r-tp4711012p4711043.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] nls in r

2015-08-12 Thread dave fournier
I believe that if your try these starting values the sum of squares is considerably smaller a=1.0851e-06 b=1.4596e-01 delta=9.1375e-01 something like SS= 0.005236471 vs SS= 0.01597071 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and mor

Re: [R] nls in r

2015-08-12 Thread ProfJCNash
With package nlmrt, I get a solution, but the Jacobian is essentially singular, so the model may not be appropriate. You'll need to read the documentation to learn how to interpret the Jacobian singular values. Or Chapter 6 of my book "Nonlinear parameter optimization with R tools." Here's the scr

[R] nls in r

2015-08-12 Thread vidya
I get this error Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model I was replace the starting value but still get error. Here is my code: library(stats) x=c(30:110) y=c(0.000760289, 0.000800320, 0.000830345, 0.000840353, 0.0008

Re: [R] nls singular gradient matrix - fit parameters in integral's upper limits

2015-07-16 Thread ProfJCNash
The list rejects almost all attachments. You could dput the data and put it in your posting. You may also want to try a Marquardt solver. In R from my nlmrt or compiled in Kate Mullen's minpack.lm. They are slightly different in flavour and the call is a bit different from nls. JN On 15-07-16 0

[R] nls singular gradient matrix - fit parameters in integral's upper limits

2015-07-16 Thread Laura Teresa Corredor Bohórquez
---The las post rejected two files I had attached, so I modified it.--- Hi. I am trying to make a nls fit for a little bit complicated expression that includes two integrals with two of the fit parameters in their upper limits. I got the error "Error in nlsModel(formula, mf, star

Re: [R] nls singular gradient matrix with an integrand

2015-07-15 Thread Jeff Newmiller
Very few attachment types are permitted on the R mailing lists... apparently whatever file you attached did not qualify. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

[R] nls singular gradient matrix with an integrand

2015-07-15 Thread Laura Teresa Corredor Bohórquez
Hi. I am trying to make a nls fit for a little bit complicated expression that includes two integrals (please find enclosed the equations). I got the error "Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates". First of all, I have searched already

Re: [R] nls and four parameter estimates

2015-06-02 Thread Prof J C Nash (U30A)
Date: Tue, 2 Jun 2015 02:54:03 + > From: > To: > Subject: [R] nls and four parameter estimates > Message-ID: > > Content-Type: text/plain; charset="UTF-8" > > Hello all! > > I am trying to estimate four parameters (mu, sigma, theta and lambda)

[R] nls and four parameter estimates

2015-06-01 Thread Onoriode.Coast
Hello all! I am trying to estimate four parameters (mu, sigma, theta and lambda) of a model Using the nls package in R, I can only get it to work if I limit the number of parameters to be estimated to three (i.e. mu, sigma and theta) as in the first model - mod1 - below. Including a fourth param

[R] R] nls model singular gradient matrix at initial parameter, > estimates

2015-05-28 Thread Prof J C Nash (U30A)
00 > From: oussama belmejdoub > To: "r-help@r-project.org" > Subject: [R] nls model singular gradient matrix at initial parameter > estimates > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Greetings, > I'm trying to use

[R] nls model singular gradient matrix at initial parameter estimates

2015-05-26 Thread oussama belmejdoub
Greetings, I'm trying to use the nls function in my statistics project but I'm really finding lot of difficulties. I have a function called apinene_modele_prediction that calculates the estimations: library(expm); #exp of a matrixapinene_modele_prediction <- function(t,theta) { x0=c(100,0,0,0,0)

[R] nls - Error in qr.qty(QR, resid) : NA/NaN/Inf in foreign function call (arg 1)

2014-07-07 Thread Arpit Jain
Dear All, I have made a script in R (r_nonlinear_leastsquare.R) to fit an exponential decay curve to my data using nls module: - args <- commandArgs(trailingOnly = TRUE) #"/project/dmp

[R] nls() help please

2014-05-14 Thread Prof J C Nash (U30A)
torials are included in conference registration. Let me know off-list of your progress. JN On 14-05-14 06:00 AM, r-help-requ...@r-project.org wrote: > Message: 29 > Date: Tue, 13 May 2014 13:20:01 -0700 (PDT) > From: Andras Farkas > To: "r-help@r-project.org"

[R] nls() help please

2014-05-13 Thread Andras Farkas
Dear All,   please help with writing the function for the following:   we have data frame "raw"   D1 <-c(2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50) D2 <-c(0.2, 0.5, 1, 2, 5, 0.2, 0.5, 1, 2, 5, 0.2, 0.5, 1, 2, 5, 0.2, 0.5, 1, 2, 5, 0.2, 0.5, 1, 2, 5)

Re: [R] nls function error

2013-10-27 Thread Rolf Turner
On 10/28/13 00:10, Hansol Yu wrote: data(Boston, package='MASS') y <- Boston$nox x <- Boston$dis nls(y~ A + B * exp(C * x), start=list(A=1, B=1, C=1)) Error in nls(y ~ A + B * exp(C * x), start = list(A = 1, B = 1, C = 1), : step factor 0.000488281 reduced below 'minFactor' of 0.000976562 I

[R] nls function error

2013-10-27 Thread Hansol Yu
data(Boston, package='MASS') y <- Boston$nox x <- Boston$dis nls(y~ A + B * exp(C * x), start=list(A=1, B=1, C=1)) Error in nls(y ~ A + B * exp(C * x), start = list(A = 1, B = 1, C = 1), : step factor 0.000488281 reduced below 'minFactor' of 0.000976562 I don't know how to fix this error. I th

Re: [R] nls model definition help

2013-10-24 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of wayne.w.jo...@shell.com > Sent: 22 October 2013 18:52 > To: R-help@r-project.org > Subject: [R] nls model definition help > > Hi fellow R users, >

Re: [R] nls model definition help

2013-10-23 Thread Prof J C Nash (U30A)
does bounds constraints and also fixed parameters (masks). JN On 13-10-23 06:00 AM, r-help-requ...@r-project.org wrote: > Message: 37 > Date: Tue, 22 Oct 2013 17:52:28 + > From: > To: > Subject: [R] nls model definition help > Message-ID: > > <823fb

[R] nls model definition help

2013-10-22 Thread Wayne.W.Jones
Hi fellow R users, I'm trying to fit a model using nls with the following model definition: y(t+1)=(th1*x1 + R1*x2) * exp(a1*x3) + (1-th1*x1 + R1*x2)*y(t) y is the dependent variable (note on both sides of eq) and the x's represent the regressors. th1, R1 and a1 are parameters to be estimated.

Re: [R] nls max iterations reached, but parameter estimates are correct

2013-08-12 Thread David Carlson
vid L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of natan hoefnagel Sent: Monday, August 12, 2013 9:54 AM To: r-help@r-project.org Subj

[R] nls max iterations reached, but parameter estimates are correct

2013-08-12 Thread natan hoefnagel
Dear All, I am trying to fit a regression (growth curve) through my data using nls(). I want to learn how this works, so I made up my own simple data: PGC = function(K, P0, r, t) { (K*P0*exp(r*t)) / (K+P0*(exp(r*t)-1)) } x <- seq(1:20) y<-PGC(6, 0.1, 0.4, x) Plotting this data yields a nice s-

Re: [R] nls power law help

2013-07-15 Thread Prof J C Nash (U30A)
obust. JN On 13-07-15 06:00 AM, r-help-requ...@r-project.org wrote: Message: 9 Date: Sun, 14 Jul 2013 16:11:40 +0100 From: Prof Brian Ripley To:r-help@r-project.org Subject: Re: [R] nls power law help Message-ID:<51e2bfac.1010...@stats.ox.ac.uk> Content-Type: text/plain; charset=ISO-8859-1

Re: [R] nls power law help

2013-07-14 Thread Prof Brian Ripley
On 14/07/2013 14:30, JenPool wrote: Hi, I am trying to use a power law y=bx^a as a nls model as below, however I keep getting 'singular gradient' error. I have tried multiple different starting values but always get an error. That is not the model you tried to fit. b*x*exp(a) is always over-p

[R] nls power law help

2013-07-14 Thread JenPool
Hi, I am trying to use a power law y=bx^a as a nls model as below, however I keep getting 'singular gradient' error. I have tried multiple different starting values but always get an error. > x2 <- > c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, > 31,32,33,3

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread Adams, Jean
It's hard to say without seeing the data. It could be the data, it could be the starting values, it could be the model choice. Jean On Wed, Jun 19, 2013 at 10:45 AM, pakoun wrote: > Yes it should look like that... what i am doing is a variogram fit . But > the > data of course are spread almo

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread pakoun
Yes it should look like that... what i am doing is a variogram fit . But the data of course are spread almost all over.. I would guess might be problem with the data only? -- View this message in context: http://r.789695.n4.nabble.com/nls-singular-gradient-as-always-tp4669859p4669898.html Sent

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread Adams, Jean
What does a plot of your data look like? plot(ndat$dist, ndat$vario.dNEE) Anything remotely like a two-parameter single exponential rise to a maximum from zero as shown on this webpage, for example? http://www.graphpad.com/guides/prism/6/curve-fitting/index.htm?reg_classic_1assoc.htm Jean O

[R] nls singular gradient ..as always..

2013-06-19 Thread pakoun
Hi all. Sorry for posting again such a topic but I went through previous posts but couldn't find a solution. I use the following code to fit an exponential model to my data. I have 4 different datasets. For 3 datasets nls seems to work fine and I have no error messages. But for 1 dataset I am get

Re: [R] nls: example code throws error

2013-04-26 Thread Duncan Murdoch
On 13-04-26 10:14 AM, Ben Bolker wrote: Keith Jewell campden.co.uk> writes: Others have pointed out that the error is probably from an unclean environment. Completely OT, but "an unclean environment" sounds sort of scary to me. Like it contains zombies or something. Isn't that accurate

Re: [R] nls: example code throws error

2013-04-26 Thread Ben Bolker
Keith Jewell campden.co.uk> writes: > Others have pointed out that the error is probably from an unclean > environment. > Completely OT, but "an unclean environment" sounds sort of scary to me. Like it contains zombies or something. I don't know a better, short way to express the idea though

Re: [R] nls: example code throws error

2013-04-26 Thread Keith Jewell
On 26/04/2013 00:16, Steven LeBlanc wrote: > Greets, > > I'm trying to learn to use nls and was running the example code for an exponential model: > > > > Perhaps also, a pointer to a comprehensive and correct document that details model formulae syntax if someone has one? > > Thanks& Best

Re: [R] nls: example code throws error

2013-04-26 Thread Duncan Mackay
Hi Try x <- -(1:100)/10 set.seed(1) y <- 100 + 10 * exp(x / 2) + rnorm(x)/10 short cut to starting values lm(log(y) ~-log(x+10)) Call: lm(formula = log(y) ~ -log(x + 10)) Coefficients: (Intercept) 4.624 nlmod <- nls(y ~ A + B * exp(C * x), start=list(A=90, B=5,C=0.1)) Formula: y ~ A +

Re: [R] nls: example code throws error

2013-04-25 Thread Gabor Grothendieck
On Thu, Apr 25, 2013 at 7:16 PM, Steven LeBlanc wrote: > 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-nu

[R] nls: example code throws error

2013-04-25 Thread Steven LeBlanc
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 nl

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-03-14 Thread John Kane
No , but please RSVP if you disagree with me. John Kane Kingston ON Canada > -Original Message- > From: cl...@ecy.wa.gov > Sent: Thu, 14 Mar 2013 09:28:46 -0700 (PDT) > To: gunter.ber...@gene.com > Subject: Re: [R] NLS results different from Excel -- Tricky fortun

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-03-14 Thread Clint Bowman
Following up on Bert's nomination, may I take one from a recent email I received? "The second file is air concentrations against frequencies plotted by SAS; however we don't have the SAS statistical package..." I thought the original name for SAS was Statistical Analysis System--am I missing

Re: [R] NLS results different from Excel

2013-02-20 Thread Marc Schwartz
Just as an FYI, there is the NISTnls package on CRAN by Doug Bates: http://cran.r-project.org/web/packages/NISTnls/index.html There have also been threads over the years touching on some of the issues in replicating the NIST results, for example: http://tolstoy.newcastle.edu.au/R/devel/06/0

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-02-20 Thread Rolf Turner
I think that this nomination is a Good Idea! cheers, Rolf On 02/21/2013 06:50 AM, Bert Gunter wrote: Folks: I thought the following excerpt from Bruce McCullough's post would be a good candidate for the R fortunes package -- except that it's about Excel, not R! So I nominate it.

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-02-20 Thread Bert Gunter
Folks: I thought the following excerpt from Bruce McCullough's post would be a good candidate for the R fortunes package -- except that it's about Excel, not R! So I nominate it... but leave it to others to say whether it's really "qualified" to be nominated. "The idea that the Excel solver

Re: [R] NLS results different from Excel

2013-02-20 Thread Bruce McCullough
The idea that the Excel solver "has a good reputation for being fast and accurate" does not withstand an examination of the Excel solver's ability to solve the StRD nls test problems. Solver's ability is abysmal. 13 of 27 "answers" have zero accurate digits, and three more have fewer than tw

Re: [R] R nls results different from those of Excel ??

2013-02-19 Thread Jeff Newmiller
I use Excel regularly, and do not consider this a "slam"... it is a fact. I am aware of Solver, but the query was about trend lines generated by Excel. In general it is possible to do arbitrarily complex computations with a four function calculator, but we don't describe that as something the ca

Re: [R] R nls results different from those of Excel ??

2013-02-19 Thread Hans W Borchers
Jeff Newmiller dcn.davis.ca.us> writes: > > Excel definitely does not use nonlinear least squares fitting for power > curve fitting. It uses linear LS fitting of the logs of x and y. There > should be no surprise in the OP's observation. May I be allowed to say that the general comments on MS Ex

Re: [R] R nls results different from those of Excel ??

2013-02-19 Thread Prof J C Nash (U30A)
ge: 79 Date: Mon, 18 Feb 2013 22:40:25 -0800 From: Jeff Newmiller To: Greg Snow<538...@gmail.com>, David Gwenzi Cc: r-help Subject: Re: [R] R nls results different from those of Excel ?? Message-ID:<50c09528-7917-4a20-ad0e-5f4ebf9d0...@email.android.com> Content-Type: text/plain; charset=UTF-8

Re: [R] R nls results different from those of Excel ??

2013-02-18 Thread Jeff Newmiller
Excel definitely does not use nonlinear least squares fitting for power curve fitting. It uses linear LS fitting of the logs of x and y. There should be no surprise in the OP's observation. --- Jeff Newmiller

Re: [R] R nls results different from those of Excel ??

2013-02-18 Thread Rolf Turner
To paraphrase Bill Venables (see fortune(217)): Simple. Excel must be broken. Have you reported it to them? (The difference in this case is that it is probable that Excel *is* broken. It usually is.) cheers, Rolf Turner On 02/19/2013 05:49 PM, David Gwenzi wrote: Hi all I

Re: [R] R nls results different from those of Excel ??

2013-02-18 Thread Greg Snow
Have you plotted the data and the lines to see how they compare? (see fortune(193)). Is there error around the line in the data? The nls function is known to not work well when there is no error around the line. Also check and make sure that the 2 methods are fitting the same model. You might

[R] R nls results different from those of Excel ??

2013-02-18 Thread David Gwenzi
Hi all I have a set of data whose scatter plot shows a very nice power relationship. My problem is when I fit a Power Trend Line in an Excel spreadsheet, I get the model y= 44.23x^2.06 with an R square value of 0.72. Now, if I input the same data into R and use model< -nls(y~ a*x^b , trace=TRUE, d

Re: [R] nls, controling the max. number of iterations; was: (no subject)

2013-01-06 Thread Uwe Ligges
Please read the posting guide and use a sensible subject line, tell us about the R version you are using, and add a *reproducible* example. We get: Error in nls(npe ~ SSgompertz(npo, Asym, b2, b3), data = f, control = nls.control(maxiter = 500)) : object 'f' not found Best, Uwe Ligges On

Re: [R] nls problem with iterations

2013-01-03 Thread Bert Gunter
Would you show the exact message you get please. -- Bert On Thu, Jan 3, 2013 at 5:22 AM, Karine HEERAH < karine.hee...@locean-ipsl.upmc.fr> wrote: > Hi, > > I am using the nls function and it stops because the number of iterations > exceeded 50, but i used the nls.control argument to allow for 5

[R] nls problem with iterations

2013-01-03 Thread Karine HEERAH
Hi, I am using the nls function and it stops because the number of iterations exceeded 50, but i used the nls.control argument to allow for 500 iterations. Do you have any idea why it's not working? fm1 <- nls(npe ~ SSgompertz(npo, Asym, b2, b3), data=f,control=nls.control(maxiter=500)) T

Re: [R] nls for sum of exponentials

2012-12-16 Thread Bert Gunter
1. Fit a simpler model -- you're probably overfitting. 2. Consult your local statistician. 3. Post to stats.stackexchange.com, as this appears to be primarily a statistical issue, not an R issue. But 2) would probably be better. Cheers, Bert On Sun, Dec 16, 2012 at 3:57 PM, Diviya Smith wrote: >

[R] nls for sum of exponentials

2012-12-16 Thread Diviya Smith
Hi there, I am trying to fit the following model with a sum of exponentials - y ~ Ae^(-md) + B e^(-nd) + c the model has 5 parameters A, b, m, n, c I am using nls to fit the data and I am using DEoptim package to pick the most optimal start values - fm4 <- function(x) x[1] + x[2]*exp(x[3] * -d

Re: [R] nls NAs

2012-10-14 Thread Elizabeth Webb
Hello all- I got some help on this. While it did not fix the problem with nls, one can get around the problem by creating a data frame with the NAs excluded. As follows: goodidx<-which(! is.na(warming$T10cm)) warming2<-warming[goodidx,] warm.10<-nls(umoles60~alpha*exp(beta*T10cm),start = start,

[R] nls NAs

2012-10-11 Thread Elizabeth Webb
Hi- I am using the following code: start=c(alpha=0.4,beta=0.4) warm.10<-nls(warming$umoles60~alpha*exp(beta*warming$T10cm),start = start,data=warming,na.action=na.omit) This code works for other columns in my dataset that are similar to $T10cm but the code does not work for this particular

Re: [R] NLS bi exponential Fit

2012-08-25 Thread vincent guyader
thanks it seems to be a good idea. a also find the PK package with the biexp function. 2012/8/23 Peter Ehlers > > Have you checked help(SSbiexp) ? > > Peter Ehlers > > > On 2012-08-23 04:54, vincent guyader wrote: > >> Hi everyone, >> >> I'm trying to perform a bi exponential Fit with the pac

Re: [R] NLS bi exponential Fit

2012-08-23 Thread Peter Ehlers
Have you checked help(SSbiexp) ? Peter Ehlers On 2012-08-23 04:54, vincent guyader wrote: Hi everyone, I'm trying to perform a bi exponential Fit with the package NLS. the plinear algorithm seems to be a good choice see: p<-3000 q<-1000 a<--0.03 b<--0.02 t<-seq(0:144);t y<-p*exp(a*t) + q*ex

[R] NLS bi exponential Fit

2012-08-23 Thread vincent guyader
Hi everyone, I'm trying to perform a bi exponential Fit with the package NLS. the plinear algorithm seems to be a good choice see: p<-3000 q<-1000 a<--0.03 b<--0.02 t<-seq(0:144);t y<-p*exp(a*t) + q*exp(b*t)+rnorm(t,sd=0.3*(p* exp(a*t) + q*exp(b*t))) fittA <- nls(y~cbind(exp(a*t), exp(b*t)), alg

Re: [R] nls()

2012-08-15 Thread Gabor Grothendieck
On Wed, Aug 15, 2012 at 9:08 PM, li li wrote: > Dear all, > I have a question on the four parameter logistic regression. > Not sure about how to set the start values for the parameters. > Can anyone familiar with this give some hint? Thanks so much. > > See ?SSfpl which is the self-starter four

[R] nls()

2012-08-15 Thread li li
Dear all, I have a question on the four parameter logistic regression. Not sure about how to set the start values for the parameters. Can anyone familiar with this give some hint? Thanks so much. Hannah For example, suppose I have the following data values, > temp mean_st

Re: [R] nls question

2012-07-12 Thread Felipe Carrillo
gt;Cc: "r-help@r-project.org" >Sent: Thursday, July 12, 2012 1:03 PM >Subject: Re: [R] nls question > >On Thu, Jul 12, 2012 at 3:40 PM, Felipe Carrillo > wrote: >> I get a different error now: >>>  nls(weight ~ cbind(1, exp(gamma*week)), weightData, start

Re: [R] nls question

2012-07-12 Thread Bert Gunter
To add to Gabor's remarks: This has nothing to do per se with R -- it is your insufficient understanding of the underlying mathematical issues. It is pretty trivial to do the plinear algorithm by hand. Fit linear regressions weight ~ lm(weight ~z) where z is exp(gamma*week) for a suitable sequen

Re: [R] nls question

2012-07-12 Thread Gabor Grothendieck
On Thu, Jul 12, 2012 at 3:40 PM, Felipe Carrillo wrote: > I get a different error now: >> nls(weight ~ cbind(1, exp(gamma*week)), weightData, start = list(gamma= >> 0.2), alg = "plinear") > Error in nls(weight ~ cbind(1, exp(gamma * week)), weightData, start = > list(gamma = 0.2), : > step fac

Re: [R] nls question

2012-07-12 Thread Felipe Carrillo
px > >From: Gabor Grothendieck >To: Felipe Carrillo >Cc: Bert Gunter ; "r-help@r-project.org" > >Sent: Thursday, July 12, 2012 12:14 PM >Subject: Re: [R] nls question > >On Thu, Jul 12, 2012 at 3:02 PM, Felipe Carrillo > wr

Re: [R] nls question

2012-07-12 Thread Gabor Grothendieck
On Thu, Jul 12, 2012 at 3:02 PM, Felipe Carrillo wrote: > Thanks Bert, I increased the number of iterations: > > M_model <- nls(weight ~ alpha + > beta*exp(gamma*week),control=nls.control(maxiter=200), weightData, > start = c(alpha = 0.0, beta = 1, gamma = 0.2), trace = TRUE) > > Bu

Re: [R] nls question

2012-07-12 Thread Felipe Carrillo
e California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx > >From: Bert Gunter >To: Felipe Carrillo >Cc: "r-help@r-project.org" >Sent: Thursday, July 12, 2012 10:56 AM >Subject: Re: [R] nls question > > >Read the Help file

Re: [R] nls question

2012-07-12 Thread Bert Gunter
Read the Help file! ?nls ## Note the "control" argument ?nls.control -- Bert On Thu, Jul 12, 2012 at 10:47 AM, Felipe Carrillo wrote: > Hi: > Using nls how can I increase the numbers of iterations to go beyond 50. > I just want to be able to predict for the last two weeks of the year. > Thi

Re: [R] nls question

2012-07-12 Thread Prof Brian Ripley
See ?nls.control (referenced from ?nls). On 12/07/2012 18:47, Felipe Carrillo wrote: Hi: Using nls how can I increase the numbers of iterations to go beyond 50. I just want to be able to predict for the last two weeks of the year. This is what I have: weight_random <- runif(50,1,24)

[R] nls question

2012-07-12 Thread Felipe Carrillo
 Hi:  Using nls how can I increase the numbers of iterations to go beyond 50.  I just want to be able to predict for the last two weeks of the year.  This is what I have:  weight_random <- runif(50,1,24)  weight <- sort(weight_random);weight weightData <- data.frame(weight,week=1:50)  

[R] nls problem: singular gradient

2012-07-12 Thread John C Nash
ace=TRUE) -- Best, JN On 07/12/2012 06:00 AM, r-help-requ...@r-project.org wrote: > From: Jonas Stein > To: > Subject: [R] nls problem: singular gradient > Message-ID: > Content-Type: text/plain > > Why fails nls with "singular gradient&qu

Re: [R] nls problem: singular gradient

2012-07-12 Thread peter dalgaard
On Jul 11, 2012, at 20:34 , Jonas Stein wrote: >> Take a look at the predicted values at your starting fit: there's a >> discontinuity at 0.4, which sure makes it look as though overflow is >> occurring. I'd recommend expanding tanh() in terms of exponentials and >> rewrite the prediction in

Re: [R] nls problem: singular gradient

2012-07-12 Thread Jonas Stein
On 07/12/2012 01:39 AM, Duncan Murdoch wrote: On 12-07-11 2:34 PM, Jonas Stein wrote: Take a look at the predicted values at your starting fit: there's a discontinuity at 0.4, which sure makes it look as though overflow is occurring. I'd recommend expanding tanh() in terms of exponentials and re

Re: [R] nls problem: singular gradient

2012-07-11 Thread Duncan Murdoch
On 12-07-11 2:34 PM, Jonas Stein wrote: Take a look at the predicted values at your starting fit: there's a discontinuity at 0.4, which sure makes it look as though overflow is occurring. I'd recommend expanding tanh() in terms of exponentials and rewrite the prediction in a way that won't over

  1   2   3   4   >