0
$\begingroup$

I fitted two models using linear regression in r:

Analysis of Variance Table

Response: price
             Df     Sum Sq    Mean Sq F value    Pr(>F)    
sqft_living   1 1.5130e+13 1.5130e+13 393.784 < 2.2e-16 ***
grade         1 1.2981e+12 1.2981e+12  33.786 1.585e-08 ***
Residuals   297 1.1411e+13 3.8421e+10                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Analysis of Variance Table

Response: price
             Df     Sum Sq    Mean Sq F value    Pr(>F)    
sqft_living   1 1.5130e+13 1.5130e+13  354.75 < 2.2e-16 ***
Residuals   298 1.2709e+13 4.2649e+10                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

What is the probability the two estimates of residual variance for the two models are equal?

I guess if the second variable have no effect on the regression, then I may have similar results. But how could I have calculate such a probability.

$\endgroup$
1
$\begingroup$

Since the estimates of residual variance are constants, the probability of them being equal is $0$ (if they're not equal), or $1$ (if they're equal).

But you could ask whether the new variable in a linear model has a predictive force, and you could accomplish that using $\bar R^2$ (adjusted coefficient of determination) that measures the amount of variance explained by the model, but unlike $R^2$ (coefficient of determination), it only increases if residual variance goes down more than one would expect by random chance.

You can calculate $\bar R^2$ as

$\bar R^2 = 1-(1-R^2)\frac{n-1}{n-p-1}$, where $p$ is the number of independent variables (for your first model, $p = 2$ and for your second model $p = 1$) and $n$ is the sample size (the number of data points).

You calculate $R^2$ as

$R^2 = 1-\frac{\displaystyle\sum_{i=1}^n(y_i-f_i)^2}{\displaystyle\sum_{i=1}^n(y_i-\bar y)^2}$, where $y_i$ is the value of the dependent variable in the i-th data point (in your models, that's i-th price) and $f_i$ is the the estimate of the dependent variable from the i-th data point (in your models, that's whatever the model predicts the i-th price would be).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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