hello, I want to fit a curve to a simple x,y dataset - my problem is, that I want to fit it for the following term: n(1-e^x/y) - so I get the n constant for my data... can anyone help/comment on that? cheers, gregor
curve fitting with given term
4 messages · gregor rolshausen, Uwe Ligges, Ben Bolker
gregor rolshausen wrote:
hello, I want to fit a curve to a simple x,y dataset - my problem is, that I want to fit it for the following term: n(1-e^x/y) - so I get the n constant for my data...
Not an R problem in the first place, but the question arises what "n(1-e^x/y)" means, its is just some scalar value so far. I am looking for some equation ... Uwe Ligges
can anyone help/comment on that? cheers, gregor
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
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...? cheers, gregor
Uwe Ligges wrote:
gregor rolshausen wrote:
hello, I want to fit a curve to a simple x,y dataset - my problem is, that I want to fit it for the following term: n(1-e^x/y) - so I get the n constant for my data...
Not an R problem in the first place, but the question arises what "n(1-e^x/y)" means, its is just some scalar value so far. I am looking for some equation ... Uwe Ligges
can anyone help/comment on that? cheers, gregor
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
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