Last week (Wed 9/10/2003, "regression questions") I posted a question regarding the use of gnls( ) and its dissimilarity to the syntax that nls( ) will accept. No one replied, so I partly answered my own question by constructing indicator variables for use in gnls( ). The code I used to construct the indicators is at the end of this email. I do have a nagging, unanswered question: What exactly does "Warning message: Step halving factor reduced below minimum in NLS step in: gnls(model = y ~ 5 + ...)" mean? I have tried to address this by specifying "control = list(maxIter = 1000, pnlsMaxIter = 200, msMaxIter = 1000, tolerance = 1e-06, pnlsTol = 1e-04, msTol = 1e-07, minScale = 1e-10, returnObject = TRUE)" in my model calls, but this does not entirely eliminate the problem (I am running gnls( ) 24 separate times on separate data sets). Much thanks in advance, david paul #Constructing Indicator Variables indicator <- paste( "foo$X <- sapply(foo$subject.id, FUN = function(x) if(x == X) 1 else 0)" ) indicator <- parse( text = indicator )[[1]] subjectID.foo <- as.factor(as.character(unique(foo$animal.id))) for(i in subjectID.foo) { INDICATOR <- do.call("substitute", list(indicator, list(i = i, X = as.character(subjectID.foo[i])))) eval(INDICATOR) } foo$Overall.Effect <- rep(1,length(foo$dose.group))
Hi Paul, The message has to do with the gauss-newton algorithm and it announces that there will be a failure in convergence. An old version of the algorithm is in Bates and Watts "Nonlinear regression and its applications" (one of the appendix). When I get that kind of messages, it can mean two things: 1.-The initial estimates that I have provided are not good enough. You can try to get some good estimates using optim(). 2.-The model that I am trying to fit is not appropriate to describe the data. No straight-forward solution goes for this. If you want to fiddle around with the parameters of gnls and try to see if you reach convergence from your model and starting points, have a look at the gnls page and the gnlsControl help pages. I think you need to specify inside your gnls() call control =gnlsControl(maxIter = 1000, pnlsMaxIter = 200, msMaxIter = 1000, tolerance = 1e-06, pnlsTol = 1e-04, msTol = 1e-07, minScale = 1e-10, returnObject = TRUE) best regards, IOsu P.S.: That gnls function is a superb addition to the nonlinear regression facilities R had before!. -------------------------------------------------------------- Jes?s Mar?a Fr?as Celayeta School of Food Sci. and Env. Health. Faculty of Tourism and Food Dublin Institute of Technology Cathal Brugha St., Dublin 1. Ireland Phone: +353 1 4024459 Fax: +353 1 4024495 http://www.dit.ie/DIT/tourismfood/science/staff/frias.html --------------------------------------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Paul, David A > Sent: 16 September 2003 16:19 > To: 'r-help at stat.math.ethz.ch' > Subject: [R] gnls( ) question > > > Last week (Wed 9/10/2003, "regression questions") I posted > a question regarding the use of gnls( ) and its dissimilarity > to the syntax that nls( ) will accept. No one replied, so > I partly answered my own question by constructing indicator > variables for use in gnls( ). The code I used to construct > the indicators is at the end of this email. > > I do have a nagging, unanswered question: > > What exactly does "Warning message: Step halving factor > reduced below minimum in NLS step in: gnls(model = y ~ 5 + ...)" > mean? I have tried to address this by specifying "control > list(maxIter = 1000, pnlsMaxIter = 200, msMaxIter = 1000, > tolerance = 1e-06, pnlsTol = 1e-04, msTol = 1e-07, minScale > 1e-10, returnObject = TRUE)" in my model calls, but this > does not entirely eliminate the problem (I am running gnls( ) > 24 separate times on separate data sets). > > > Much thanks in advance, > david paul > > > > #Constructing Indicator Variables > indicator <- paste( "foo$X <- sapply(foo$subject.id, > FUN = function(x) if(x == X) 1 else 0)" ) > indicator <- parse( text = indicator )[[1]] > subjectID.foo <- as.factor(as.character(unique(foo$animal.id))) > > for(i in subjectID.foo) > { > INDICATOR <- do.call("substitute", > list(indicator, list(i = i, > X = as.character(subjectID.foo[i])))) > eval(INDICATOR) > } > > foo$Overall.Effect <- rep(1,length(foo$dose.group)) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > -- > This message has been scanned for content and > viruses by the DIT ICT Services MailScanner Service, > and is believed to be clean. > http://www.dit.ie >-- This message has been scanned for content and viruses by the DIT ICT Services MailScanner Service, and is believed to be clean. http://www.dit.ie
Thank you! Using "control = gnlsControl(...)" has made a difference in several of my model calls [no other change needed, except that gnlsControl(...) does not accept pnlsTol or pnlsMaxIter options]. For several other model calls, fiddling with the intial parameter estimates helped. Best, david paul -----Original Message----- From: Jesus Frias [mailto:Jesus.Frias at dit.ie] Sent: Wednesday, September 17, 2003 10:35 AM To: Paul, David A; R help Subject: RE: [R] gnls( ) question Hi Paul, The message has to do with the gauss-newton algorithm and it announces that there will be a failure in convergence. An old version of the algorithm is in Bates and Watts "Nonlinear regression and its applications" (one of the appendix). When I get that kind of messages, it can mean two things: 1.-The initial estimates that I have provided are not good enough. You can try to get some good estimates using optim(). 2.-The model that I am trying to fit is not appropriate to describe the data. No straight-forward solution goes for this. If you want to fiddle around with the parameters of gnls and try to see if you reach convergence from your model and starting points, have a look at the gnls page and the gnlsControl help pages. I think you need to specify inside your gnls() call control =gnlsControl(maxIter = 1000, pnlsMaxIter = 200, msMaxIter = 1000, tolerance = 1e-06, pnlsTol = 1e-04, msTol = 1e-07, minScale = 1e-10, returnObject = TRUE) best regards, IOsu P.S.: That gnls function is a superb addition to the nonlinear regression facilities R had before!. -------------------------------------------------------------- Jes?s Mar?a Fr?as Celayeta School of Food Sci. and Env. Health. Faculty of Tourism and Food Dublin Institute of Technology Cathal Brugha St., Dublin 1. Ireland Phone: +353 1 4024459 Fax: +353 1 4024495 http://www.dit.ie/DIT/tourismfood/science/staff/frias.html --------------------------------------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Paul, David A > Sent: 16 September 2003 16:19 > To: 'r-help at stat.math.ethz.ch' > Subject: [R] gnls( ) question > > > Last week (Wed 9/10/2003, "regression questions") I posted > a question regarding the use of gnls( ) and its dissimilarity to the > syntax that nls( ) will accept. No one replied, so I partly answered > my own question by constructing indicator variables for use in gnls( > ). The code I used to construct the indicators is at the end of this > email. > > I do have a nagging, unanswered question: > > What exactly does "Warning message: Step halving factor reduced below > minimum in NLS step in: gnls(model = y ~ 5 + ...)" mean? I have tried > to address this by specifying "control = list(maxIter = 1000, > pnlsMaxIter = 200, msMaxIter = 1000, tolerance = 1e-06, pnlsTol = > 1e-04, msTol = 1e-07, minScale = 1e-10, returnObject = TRUE)" in my > model calls, but this does not entirely eliminate the problem (I am > running gnls( ) 24 separate times on separate data sets). > > > Much thanks in advance, > david paul > > > > #Constructing Indicator Variables > indicator <- paste( "foo$X <- sapply(foo$subject.id, > FUN = function(x) if(x == X) 1 else 0)" ) > indicator <- parse( text = indicator )[[1]] > subjectID.foo <- as.factor(as.character(unique(foo$animal.id))) > > for(i in subjectID.foo) > { > INDICATOR <- do.call("substitute", > list(indicator, list(i = i, > X = as.character(subjectID.foo[i])))) > eval(INDICATOR) > } > > foo$Overall.Effect <- rep(1,length(foo$dose.group)) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > -- > This message has been scanned for content and > viruses by the DIT ICT Services MailScanner Service, > and is believed to be clean. > http://www.dit.ie >-- This message has been scanned for content and viruses by the DIT ICT Services MailScanner Service, and is believed to be clean. http://www.dit.ie