[R] gnls( ) question

Paul, David A paulda at BATTELLE.ORG
Tue Sep 16 17:19:11 CEST 2003


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))




More information about the R-help mailing list