# Thread: Calculate the r-squared in models with more than one predictor/variable? TRICKY!!!

1. ## Calculate the r-squared in models with more than one predictor/variable? TRICKY!!!

Hi there!

CAREFUL, my question isharder than it seems!

Ok, we all know that r-squared is : one minus (the sum of squares of the residuals divided by the total sum of squares or the total variance).

However the residuals are usually calculated based on the deviations of the predicted y from a value based on a single x variable.

How do you do calculate the r-squared with several X variables? (like in: Y = const + X1 + X2 + e).
Can you simply add up the sum of squares of X1, X2, and X1*X2, and divided by the total variance?

And then, here is the hardest part, how you calcule the r-squared in a ANOVA mixing within (repeated measures) and between variables ?

In my case: I want to estimate the r-squated of the model that has a factorial design as follows: 2 (within) x 2 (within) x 4 (between) ANOVA.

Can you simply add up the sum of squares of X1, X2, X3, X1*X2, X1*X3, X2*X3, and X1*X2*X3, and divided by the total variance?

I am not even sure how to it, but would that be correct?