dear members, I am getting the "singular gradient error" when I use nls for a function of two variables:> formulaDH5HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2)))) + (A * sin(w * HM3 + a) + C) HM1 is the response variable, and HM2 and HM3 are predictors. The problem is I get the same error even when I use nlsLM(in the minpack.lm package):> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 2))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I came to know that nlsLM converges when nls throws a singular gradient error. What is happening above? Can the problem get solved if I use nls.lm function(in the minpack.lm package) instead? very many thanks for your time and effort.... yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]]
dear members, also,I can provide HM1,HM2 and HM3 if needed.... ________________________________________ From: R-help <r-help-bounces at r-project.org> on behalf of akshay kulkarni <akshay_e4 at hotmail.com> Sent: Tuesday, March 19, 2019 5:43 PM To: R help Mailing list Subject: [R] problem with nlsLM function dear members, I am getting the "singular gradient error" when I use nls for a function of two variables:> formulaDH5HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2)))) + (A * sin(w * HM3 + a) + C) HM1 is the response variable, and HM2 and HM3 are predictors. The problem is I get the same error even when I use nlsLM(in the minpack.lm package):> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 2))Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I came to know that nlsLM converges when nls throws a singular gradient error. What is happening above? Can the problem get solved if I use nls.lm function(in the minpack.lm package) instead? very many thanks for your time and effort.... yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
On 19/03/2019 8:26 a.m., akshay kulkarni wrote:> > dear members, > also,I can provide HM1,HM2 and HM3 if needed.... > > ________________________________________ > From: R-help <r-help-bounces at r-project.org> on behalf of akshay kulkarni <akshay_e4 at hotmail.com> > Sent: Tuesday, March 19, 2019 5:43 PM > To: R help Mailing list > Subject: [R] problem with nlsLM function > > dear members, > I am getting the "singular gradient error" when I use nls for a function of two variables: >> formulaDH5 > HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2)))) + (A * sin(w * HM3 + a) + > C) > > HM1 is the response variable, and HM2 and HM3 are predictors. > > The problem is I get the same error even when I use nlsLM(in the minpack.lm package): > >> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94))You have "a" twice in your start list. That's bound to cause trouble... Duncan Murdoch> Error in nlsModel(formula, mf, start, wts) : > singular gradient matrix at initial parameter estimates >> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94)) > Error in nlsModel(formula, mf, start, wts) : > singular gradient matrix at initial parameter estimates >> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 2)) > Error in nlsModel(formula, mf, start, wts) : > singular gradient matrix at initial parameter estimates > > I came to know that nlsLM converges when nls throws a singular gradient error. What is happening above? Can the problem get solved if I use nls.lm function(in the minpack.lm package) instead? > > very many thanks for your time and effort.... > yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >