# [R] Linear Model with curve fitting parameter?

stephen sefick ssefick at gmail.com
Mon Apr 4 02:34:42 CEST 2011

```Steven:

You are exactly right sorry I was confused.

#######################################################
so log(y-intercept)+log(K) is a constant called b0 (is this right?)

lm(log(Q)~log(A)+log(R)+log(S)-1)

is fitting the model

log(Q)=a*log(A)+r*log(R)+s*log(S) (no beta 0)

and

lm(log(Q)~log(A)+log(R)+log(S))

is fitting the model

log(Q)=b0+a*log(A)+r*log(R)+s*log(S)

######################################################

These are the models I am trying to fit and if I have reasoned
correctly above then I should be able to fit the below models
similarly.

manning
log(Q)=log(b0)+log(K)+log(A)+r*log(R)+s*log(S)

dingman
log(Q)=log(b0)+log(K)+a*log(A)+r*log(R)+s*(log(S))^2

bjerklie
log(Q)=log(b0)+log(K)+a*log(A)+r*log(R)+s*log(S)

#######################################################

Thank you for all of your help!

Stephen

On Fri, Apr 1, 2011 at 2:44 PM, Steven McKinney <smckinney at bccrc.ca> wrote:
>
>> -----Original Message-----
>> From: stephen sefick [mailto:ssefick at gmail.com]
>> Sent: April-01-11 5:44 AM
>> To: Steven McKinney
>> Cc: R help
>> Subject: Re: [R] Linear Model with curve fitting parameter?
>>
>> Setting Z=Q-A would be the incorrect dimensions.  I could Z=Q/A.
>
> I suspect this is confusion about what Q is.  I was presuming that
> the Q in this following formula was log(Q) with Q from the original data.
>
>> >> I have taken the log of the data that I have and this is the model
>> >> formula without the K part
>> >>
>> >> lm(Q~offset(A)+R+S, data=x)
>
> If the model is
>
>   Q=K*A*(R^r)*(S^s)
>
> then
>
>   log(Q) = log(K) + log(A) + r*log(R) + s*log(S)
>
> Rearranging yields
>
>   log(Q) - log(A) = log(K) + r*log(R) + s*log(S)
>
> so what I labeled 'Z' below is
>
>   Z = log(Q) - log(A) = log(Q/A)
>
> so
>
>   Z = log(K) + r*log(R) + s*log(S)
>
> and a linear model fit of
>
>   Z ~ log(R) + log(S)
>
> will yield parameter estimates for the linear equation
>
>   E(Z) = B0 + B1*log(R) + B2*log(S)
>
> (E(Z) = expected value of Z)
>
> so B0 estimate is an estimate of log(K)
>   B1 estimate is an estimate of r
>   B2 estimate is an estimate of s
>
> More details and careful notation will eventually lead
> to a reasonable description and analysis strategy.
>
>
> Best
>
> Steve McKinney
>
>
>
>> Is fitting a nls model the same as fitting an ols?  These data are
>> hydraulic data from ~47 sites.  To access predictive ability I am
>> removing one site fitting a new model and then accessing the fit with
>> a myriad of model assessment criteria.  I should get the same answer
>> with ols vs nls?  Thank you for all of your help.
>>
>> Stephen
>>
>> On Thu, Mar 31, 2011 at 8:34 PM, Steven McKinney <smckinney at bccrc.ca> wrote:
>> >
>> >> -----Original Message-----
>> >> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of stephen
>> sefick
>> >> Sent: March-31-11 3:38 PM
>> >> To: R help
>> >> Subject: [R] Linear Model with curve fitting parameter?
>> >>
>> >> I have a model Q=K*A*(R^r)*(S^s)
>> >>
>> >> A, R, and S are data I have and K is a curve fitting parameter.  I
>> >> have linearized as
>> >>
>> >> log(Q)=log(K)+log(A)+r*log(R)+s*log(S)
>> >>
>> >> I have taken the log of the data that I have and this is the model
>> >> formula without the K part
>> >>
>> >> lm(Q~offset(A)+R+S, data=x)
>> >>
>> >> What is the formula that I should use?
>> >
>> > Let Z = Q - A for your logged data.
>> >
>> > Fitting lm(Z ~ R + S, data = x) should yield
>> > intercept parameter estimate = estimate for log(K)
>> > R coefficient parameter estimate = estimate for r
>> > S coefficient parameter estimate = estimate for s
>> >
>> >
>> >
>> > Steven McKinney
>> >
>> > Statistician
>> > Molecular Oncology and Breast Cancer Program
>> > British Columbia Cancer Research Centre
>> >
>> >
>> >
>> >>
>> >> Thanks for all of your help.  I can provide a subset of data if necessary.
>> >>
>> >>
>> >>
>> >> --
>> >> Stephen Sefick
>> >> ____________________________________
>> >> | Auburn University                                         |
>> >> | Biological Sciences                                      |
>> >> | 331 Funchess Hall                                       |
>> >> | Auburn, Alabama                                         |
>> >> | 36849                                                           |
>> >> |___________________________________|
>> >> | sas0025 at auburn.edu                                  |
>> >> | http://www.auburn.edu/~sas0025                 |
>> >> |___________________________________|
>> >>
>> >> Let's not spend our time and resources thinking about things that are
>> >> so little or so large that all they really do for us is puff us up and
>> >> make us feel like gods.  We are mammals, and have not exhausted the
>> >> annoying little problems of being mammals.
>> >>
>> >>                                 -K. Mullis
>> >>
>> >> "A big computer, a complex algorithm and a long time does not equal science."
>> >>
>> >>                               -Robert Gentleman
>> >> ______________________________________________
>> >> R-help at r-project.org mailing list
>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>> >> and provide commented, minimal, self-contained, reproducible code.
>> >
>>
>>
>>
>> --
>> Stephen Sefick
>> ____________________________________
>> | Auburn University                                         |
>> | Biological Sciences                                      |
>> | 331 Funchess Hall                                       |
>> | Auburn, Alabama                                         |
>> | 36849                                                           |
>> |___________________________________|
>> | sas0025 at auburn.edu                                  |
>> | http://www.auburn.edu/~sas0025                 |
>> |___________________________________|
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up and
>> make us feel like gods.  We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>>                                 -K. Mullis
>>
>> "A big computer, a complex algorithm and a long time does not equal science."
>>
>>                               -Robert Gentleman
>

--
Stephen Sefick
____________________________________
| Auburn University                                         |
| Biological Sciences                                      |
| 331 Funchess Hall                                       |
| Auburn, Alabama                                         |
| 36849                                                           |
|___________________________________|
| sas0025 at auburn.edu                                  |
| http://www.auburn.edu/~sas0025                 |
|___________________________________|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

-Robert Gentleman

```