Регрессионный анализ данных об успеваемости студентов и определяющих их факторах.

library(readr)
## Warning: пакет 'readr' был собран под R версии 4.5.3
Advertising = read_csv("Student_Performance.csv")
## Rows: 10000 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Extracurricular Activities
## dbl (5): Hours Studied, Previous Scores, Sleep Hours, Sample Question Papers...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Advertising
## # A tibble: 10,000 × 6
##    `Hours Studied` `Previous Scores` `Extracurricular Activities` `Sleep Hours`
##              <dbl>             <dbl> <chr>                                <dbl>
##  1               7                99 Yes                                      9
##  2               4                82 No                                       4
##  3               8                51 Yes                                      7
##  4               5                52 Yes                                      5
##  5               7                75 No                                       8
##  6               3                78 No                                       9
##  7               7                73 Yes                                      5
##  8               8                45 Yes                                      4
##  9               5                77 No                                       8
## 10               4                89 No                                       4
## # ℹ 9,990 more rows
## # ℹ 2 more variables: `Sample Question Papers Practiced` <dbl>,
## #   `Performance Index` <dbl>

построим простую линейную модель

model <- lm(`Performance Index` ~ `Hours Studied` + `Previous Scores` + `Extracurricular Activities` + `Sleep Hours` + `Sample Question Papers Practiced`, data = Advertising)
summary(model)
## 
## Call:
## lm(formula = `Performance Index` ~ `Hours Studied` + `Previous Scores` + 
##     `Extracurricular Activities` + `Sleep Hours` + `Sample Question Papers Practiced`, 
##     data = Advertising)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.6333 -1.3684 -0.0311  1.3556  8.7932 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        -34.075588   0.127143 -268.01   <2e-16 ***
## `Hours Studied`                      2.852982   0.007873  362.35   <2e-16 ***
## `Previous Scores`                    1.018434   0.001175  866.45   <2e-16 ***
## `Extracurricular Activities`Yes      0.612898   0.040781   15.03   <2e-16 ***
## `Sleep Hours`                        0.480560   0.012022   39.97   <2e-16 ***
## `Sample Question Papers Practiced`   0.193802   0.007110   27.26   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.038 on 9994 degrees of freedom
## Multiple R-squared:  0.9888, Adjusted R-squared:  0.9887 
## F-statistic: 1.757e+05 on 5 and 9994 DF,  p-value: < 2.2e-16

Модель линейной регрессии показала очень высокую точность, R² = 0,989, модель объясняет около 98.9% вариации зависимой переменной. Все предикторы оказались статистически значимы (p < 0,05) и имеют положительные коэффициенты. F и p подтверждают значимость модели в целом. Adjusted R-squared = 0,989 и около 98.9%, что указывает на то, что добавление переменных в модель не привело к переобучению.