"Jared Blashka" <evilamaran...@gmail.com> wrote in message news:aanlktinffmudugqnkudvr=fmf0wrrtsbjxjexuki_...@mail.gmail.com... > I'm working with 3 different data sets and applying this non-linear > regression formula to each of them. > > nls(Y ~ (upper)/(1+10^(X-LOGEC50)), data=std_no_outliers, > start=list(upper=max(std_no_outliers$Y),LOGEC50=-8.5)) > > Previously, all of the regressions were calculated in Prism, but I'd like > to > be able to automate the calculation process in a script, which is why I'm > trying to move to R. The issue I'm running into is that previously, in > Prism, I was able to calculate a shared value for a constraint so that all > three data sets shared the same value, but have other constraints > calculated > separately. So Prism would figure out what single value for the constraint > in question would work best across all three data sets. For my formula, > each > data set needs it's own LOGEC50 value, but the upper value should be the > same across the 3 sets. Is there a way to do this within R, or with a > package I'm not aware of, or will I need to write my own nls function to > work with multiple data sets, because I've got no idea where to start with > that. > > Thanks, > Jared > > [[alternative HTML version deleted]] > An approach which works for me (code below to illustrate principle, not tried...)
1) combine all three "data sets" into one dataframe with a column (e.g. dset) indicating data set (1, 2 or 3) 2) express your formula with upper as single valued and LOGEC50 as a vector inderxed by dest e.g. Y ~ upper/(1+10^(C-LOGEC50[dset])) 3) in the start list, make LOGEC50 a vector e.g. using -8.5 as start for all three LOGEC50 values start = list(start=list(upper=max(std_no_outliers$Y),LOGEC50=c(-8.5, -8.5, -8.5)) Hope that helps, Keith J ______________________________________________ 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.