Dear All, It is not very difficult, in R, to perform a linear fit y=Ax+B on a single set of data. However, imagine that you have several datasets labelled by a number (real or integer does not matter) K. For each individual dataset, it would make sense to resort to a linear fit, but now A and B both depend on K. In other words you would like to fit all your data according to
y=A(K)x+B(K). You already have an idea of the functional dependence of A and B on K (which involves other unknown parameters to estimate) e.g. A(K)=alpha+beta^K, with unknown parameters alpha and beta. How would you tackle this problem? On top of my head, if I have N datasets, I can only think about getting N estimates {A1,A2...AN} for the A parameter for all the N datasets by fitting them individually. I would then resort e.g. to a Levemberg-Marquardt algorithm to determine the values of alpha and beta that best fit alpha+beta^K to my set {A1,A2...AN} for the corresponding N values of K. For B(K), I would follow exactly the same procedure. Does anybody know any better method? Any suggestion is welcome. Cheers Lorenzo ______________________________________________ R-help@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.