R-squared से मॉडल फिट जाँचना

Tidyverse में डेटा के साथ Modeling

Albert Y. Kim

Assistant Professor of Statistical and Data Sciences

R-squared

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)}$

  • $R^2$ 0 और 1 के बीच होता है
  • छोटा $R^2$ ~ "कमज़ोर फिट"
  • $R^2 = 1$ ~ "परफेक्ट फिट" और $R^2 = 0$ ~ "कोई फिट नहीं"
Tidyverse में डेटा के साथ Modeling

High R-squared: उदाहरण

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)}$

Tidyverse में डेटा के साथ Modeling

High R-squared: "परफेक्ट" फिट

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)}$

Tidyverse में डेटा के साथ Modeling

Low R-squared: उदाहरण

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)}$

Tidyverse में डेटा के साथ Modeling

Low R-squared: उदाहरण

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)}$

Tidyverse में डेटा के साथ Modeling

सांख्यिकीय व्याख्या

$$

चूँकि $\text{Var}(y) \geq \text{Var}(\text{residuals})$ और $$

$R^2 = 1 - \frac{\text{Var}(\text{residuals})}{\text{Var}(y)} = \frac{\text{Var}(y) - \text{Var}(\text{residuals})}{\text{Var}(y)}$

$$

$R^2$ की व्याख्या: आउटकम वैरिएबल $y$ में कुल variation का वह भाग जिसे मॉडल समझाता है.

Tidyverse में डेटा के साथ Modeling

R-squared निकालना

# Model 1: price as a function of size and year built
model_price_1 <- lm(log10_price ~ log10_size + yr_built,
                    data = house_prices)

get_regression_points(model_price_1) %>%
  summarize(r_squared = 1 - var(residual)/var(log10_price))
# A tibble: 1 x 1
  r_squared
      <dbl>
1     0.483
Tidyverse में डेटा के साथ Modeling

R-squared निकालना

# Model 3: price as a function of size and condition
model_price_3 <- lm(log10_price ~ log10_size + condition,
                    data = house_prices)

get_regression_points(model_price_3) %>%
  summarize(r_squared = 1 - var(residual)/var(log10_price))
# A tibble: 1 x 1
  r_squared
      <dbl>
1     0.462
Tidyverse में डेटा के साथ Modeling

अभ्यास करते हैं!

Tidyverse में डेटा के साथ Modeling

Preparing Video For Download...