0
$\begingroup$

Looking for a bit of help on how to construct an equation for a linear model when there's a covariate involved.

I've been doing a simple lab assay where an absorbance measurement of an indicator can be compared back to a calibration curve of known concentrations of a reaction product to determine the concentration in the experiment. The calibration is easy - log of the concentration against log of the absorbance yields a straight line - so you can use the equation of the linear fit to get a concentration from an experimental absorbance value. I do the following in R:

fit <- lm(log(absorbance) ~ log(concentration))

Fine. Now, I wanted to do this assay at some temperatures different from the recommended temperature, and I had a suspicion that temperature may affect the assay, so I performed a calibration across some different temperatures.

I figured I'd just need the same linear model, but with temperature added in as a covariate, so I did this:

temp_fit <- lm(log(absorbance) ~ log(concentration) + temperature)

Which returns the following:

> summary(temp_fit)

Call:
lm(formula = log(absorbance) ~ log(concentration) + temperature, data = dataset_temperature)

Residuals:
  Min        1Q    Median        3Q       Max 
-0.151634 -0.056414  0.000995  0.068044  0.140767 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
(Intercept)             -1.5644882  0.0264804  -59.08   <2e-16 ***
log(concentration)      -0.4217933  0.0099906  -42.22   <2e-16 ***
Temperature             -0.0009536  0.0005268   -1.81   0.0755 .  

Residual standard error: 0.07586 on 57 degrees of freedom
Multiple R-squared:  0.9691,    Adjusted R-squared:  0.968 
F-statistic: 892.9 on 2 and 57 DF,  p-value: < 2.2e-16

Which suggests to me that the temperature does have an effect, albeit not with a p-value < 0.05.

Now my problem is that I don't know from this point how to go about making an equation for this model with the added temperature factor. Any advice on how to do this would be much appreciated, or advice on whether I'm even going about this the right way. Thanks!

$\endgroup$

1 Answer 1

0
$\begingroup$

Well you've basically just estimated your equation. Linear regression basically estimates a linear equation. You give it the data and it spits out the coefficients for your linear equation.

In your case the result is:

log(absorbance)=-1.56 -1.42*log(concentration)-0.0009*temperature.

You can use the equation to make predictions: if you put in a temperature and the log of a concentration it will predict the log of absorbance. NB R has a nifty predict function for that.

$\endgroup$
3
  • $\begingroup$ aha, that's easier than anticipated - basically all I've done is say "I think temperature has a small effect on the intercept"? If I thought instead that it changed the slope, would the following be appropriate? lm(log(absorbance) ~ log(concentration) * temperature) $\endgroup$
    – Tom
    Commented Jul 17, 2017 at 6:22
  • $\begingroup$ Yup, you're equation says that for every additional degree in temperature your intercept decreases with 0.0009. I find it hard to say what is "appropriate" because it depends on what you want to use it for. If the question is whether you can estimate that equation, it can certainly be done with linear regression, but the interpretation is much harder as I see it. You'll get the equation log(absorbtion)=b0+b1*log(concentration)*temperature which only has the combined effect of temperature and concentration. $\endgroup$ Commented Jul 17, 2017 at 7:39
  • $\begingroup$ Usually one estimates the model with both variable separate and an interaction effect $\endgroup$ Commented Jul 17, 2017 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.