[R] exponential day

S Ellison S@E|||@on @end|ng |rom LGCGroup@com
Thu Aug 9 14:11:31 CEST 2018

> Please, how can I determine parameters from exponential equation Example
> one:  y = a*exp(-b*x);  how do I determine  a  and  b , as well as R-square
> from data sets. And also fitting y = a*exp(-b*x) into the data sets Assuming
> data sets A = (0,2,4,6,8,10) B = (1,0.8,0.6,0.4,0.2,0.1)

For least squares fitting, you could take logs and do a simple linear fit, if the resduals are reasonably homoscedastic in the log domain (or if you can sort the weighting out properly).

For non-linear least squares, look at ?nlm, ?nls or (if you want to roll your own) ?optim

For max likelihood, maybe nlme in the nlme package.

For other ideas, look up 'non-linear fitting with R' on any search engine, or check the R Task Views

S Ellison

This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmaster using lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK

More information about the R-help mailing list