[R] Nonlinear Regression Parameter Shared Across Multiple Data Sets
Keith Jewell
k.jewell at campden.co.uk
Tue Oct 12 13:07:37 CEST 2010
"Jared Blashka" <evilamarant7x at gmail.com> wrote in message
news:AANLkTinFfMuDugqNkUDVr=FMf0wrRTsbjXJExuki_MRH at 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
More information about the R-help
mailing list