# Can I use an ANOVA to compare groups in which each data group was calculated from a linear regression?

As a result of some previous experiments at 5 different temperatures, I have 5 simple linear regression slopes describing the effect of body mass (independent variable) on water loss rates (dependent variable) of frogs. For a new set of experiments at that the same 5 temperatures, I used the predicted values from slopes to predict the expected values (water loss rates) that new individuals (frogs)exposed at that 5 temperatures would experience based on their body masses. Can I performed an ANOVA to asses the difference between those new 5 frog groups even when their different individual values within each group were calculated from regression slopes?

I would suggest including temperature as either a continuous or categorical variable in 1 regression model rather than splitting different temperatures into 5 regression models and then running an ANOVA.

My intuition tells me you should treat temperature as a continuous variable that you exercised experimental control over. However, if you have a very good reason for treating it as a categorical variable, I have linked the Wikipedia page for using "dummy variables" in regression.

https://en.wikipedia.org/wiki/Dummy_variable_(statistics)

If you read up on dummy variables, you may notice that an ANOVA is a regression model in and of itself. Your specific ANOVA is modeled like this:

If we treat each category of temperature as a dummy variable, so that we refer to temperature group

• 1 as X1
• 2 as X2
• 3 as X3
• 4 as X4
• 5 as our base value

then y (our independent variable) is predicted by: $$y = \beta_0 + \beta_1X_1 + \beta_2X_2 + \beta_3X_3 + \beta_4X_4$$

Where all x values are either equal to 1 or 0. So if we had tempurature group 1, we would equate it as

$$y = \beta_0 + \beta_1X_1 + \beta_20 + \beta_30 + \beta_40$$

which simplifies to $$y = \beta_0 + \beta_1$$ if we had temperature group 4 then: $$y = \beta_0 + \beta_10 + \beta_20 + \beta_30 + \beta_41$$ which simplifies to $$y = \beta_0 + \beta_4$$ Because temperature group 5 is our base value, all Xs = 0 and our model simplifies to this when we want to examine group 5: $$y = \beta_0$$

If you compute this model and you are interested in whether or not your groups are statistically different from each other, you can build a confidence interval around your regression coefficients and look for overlap. If you are interested more so in prediction, you can use your standard methods for calculating prediction intervals and see if differing groups are useful in your predictions.