[R] for loop in nls function

Yuelin Li liy12 at mskcc.org
Wed Apr 30 02:09:29 CEST 2008


> results[i]<- nls(Tw ~ mu + ((alpha - mu)/(1 + exp(gamma*(B -  
> Mean_Air)))),
> 	data = dem16,
> 	start = list(mu = 0.0001, alpha = 21.8, gamma = 0.22, B = 12.8))
> 	}

If you have a variable that codes "site" then you can try something
like this to get the parameters over sites.  Pinheiro and Bates (2000)
has several examples. 

nlsList(Tw ~ mu + ((alpha - mu)/(1 + exp(gamma*(B - Mean_Air)))) | site)

Yuelin.

 
     =====================================================================
     
     Please note that this e-mail and any files transmitted with it may be 
     privileged, confidential, and protected from disclosure under 
     applicable law. If the reader of this message is not the intended 
     recipient, or an employee or agent responsible for delivering this 
     message to the intended recipient, you are hereby notified that any 
     reading, dissemination, distribution, copying, or other use of this 
     communication or any of its attachments is strictly prohibited.  If 
     you have received this communication in error, please notify the 
     sender immediately by replying to this message and deleting this 
     message, any attachments, and all copies and backups from your 
     computer.



More information about the R-help mailing list