[R] curve fitting with given term

Ben Bolker bolker at ufl.edu
Tue Jan 13 19:24:23 CET 2009


gregor rolshausen <gregor.rolshausen <at> biologie.uni-freiburg.de> writes:

> 
> ok. sorry for being blurry.
> 
> I have x,y data, that probably fits a asymptotic curve (asymptote at N). 
> now I want to fit a curve onto the data, that gives me the N. therefore 
> I thought to fit an e-function, namely N(1-e^(y/x)) onto the data and 
> get the N from the fitted curves' equation.
> in the course of this, I was looking for a R-function to fit a given 
> function to data.
> (I believe there is some implementation in MatLab for this kind of 
> question, anyhow, I wanted to look in R as well...)
> 
> I am not an expert, so excuse my misuse of terms. I hope my problem 
> graspable...?
> 

   Perhaps you mean

y = N*(1-exp(-x/a))

assuming x is the predictor and y the response variable.
(This further assumes that the errors are independent,
normally distributed [if you want to make inferences
on the parameters etc.], etc..)

Check out ?nls (for "nonlinear least squares").

  good luck,
    Ben Bolker




More information about the R-help mailing list