Loading...

Linear Regression

Linear regression is one of the most popular regression algorithms and produces good predictions for well-prepared data. Its optimization function computes coefficients to express a response column as a linear relationship of its predictors.

You must verify the Gauss-Markov assumptions when using linear regression algorithms:

  • Linearity: the parameters we are estimating using the OLS method must be linear.

  • Non-Collinearity: the regressors being calculated aren’t perfectly correlated with each other.

  • Exogeneity: the regressors aren’t correlated with the error term.

  • Homoscedasticity: no matter what the values of our regressors might be, the error of the variance is constant.

To create a good linear regression model, it’s important to:

  • Impute missing values.

  • Encode categorical features (linear regression only accepts numerical variables).

  • Compute the correlation matrix to retrieve highly-correlated predictors.

  • Decompose the data (optional).

  • Normalize the data (optional, but recommended).

Example without decomposition

Let’s use the africa_education dataset to compute a linear regression model of students’ performance in school.

from vastorbit.datasets import load_africa_education

africa = load_africa_education()
africa = africa.select(
    [
        "(zralocp + zmalocp) / 2 AS student_score",
        "zraloct AS teacher_score",
        "XNUMYRS AS teacher_year_teaching",
        "numstu AS number_students_school",
        "PENGLISH AS english_at_home",
        "PTRAVEL AS travel_distance",
        "PTRAVEL2 AS means_of_travel",
        "PMOTHER AS m_education",
        "PFATHER AS f_education",
        "PLIGHT AS source_of_lighting",
        "PABSENT AS days_absent",
        "PREPEAT AS repeated_grades",
        "zpsit AS sitting_place",
        "PAGE AS age",
        "zpses AS socio_eco_statut",
        "country_long AS country",
    ],
)
africa.head(100)
123
student_score
Decimal(23,18)
99%
123
teacher_score
Decimal(11,7)
89%
123
teacher_year_teaching
Decimal(3,1)
99%
123
number_students_school
Integer
100%
Abc
english_at_home
Varchar(16)
100%
Abc
travel_distance
Varchar(11)
100%
Abc
means_of_travel
Varchar(13)
100%
Abc
m_education
Varchar(34)
100%
Abc
f_education
Varchar(34)
99%
Abc
source_of_lighting
Varchar(12)
100%
123
days_absent
Integer
100%
Abc
repeated_grades
Varchar(10)
100%
Abc
sitting_place
Varchar(27)
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
99%
Abc
country
Varchar(12)
100%
1508.4821854812.33118972.015NEVER>0.5-1KMWALKI Do Not Have a MotherI Do Not KnowELECTRIC0NEVERI have my own sitting place1310.0Botswana
2499.890896740.60723352.018NEVER>0.5-1KMWALKCompleted Some PrimaryNo School, No Adult EducationCANDLE0NEVERI have my own sitting place145.0Botswana
3512.3963035781.810357320.023SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted All SecondaryELECTRIC0ONCEI have my own sitting place1412.0Botswana
4638.0964246767.59909472.023SOMETIMES>4KM-4.5KMBUS/TRUCK/VANCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1114.0Botswana
5476.61604135740.607233520.019NEVER>3-3.5KMWALKCompleted Some SecondaryCompleted All SecondaryPARAFFIN/OIL0ONCEI have my own sitting place138.0Botswana
6363.50642795796.68926313.015NEVER>1.5-2KMWALKCompleted All SecondarySome Training After PrimaryPARAFFIN/OIL0ONCEI have my own sitting place129.0Botswana
7486.87185345740.607233523.025NEVER>4KM-4.5KMWALKCompleted All PrimaryCompleted All SecondaryCANDLE0ONCEI have my own sitting place147.0Botswana
8574.16180765796.689263117.025SOMETIMES>0.5-1KMWALKCompleted Some SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1212.0Botswana
9464.89787835703.219213817.023NEVERUP TO 0.5KMWALKCompleted Some PrimaryCompleted Some SecondaryCANDLE0NEVERI have my own sitting place125.0Botswana
10518.8684453767.599094722.024SOMETIMES>0.5-1KMWALKCompleted Some SecondaryI Do Not KnowPARAFFIN/OIL0NEVERI have my own sitting place128.0Botswana
11473.3024924812.331189718.025SOMETIMES>2-2.5KMWALKNo School, Some Adult EducationNo School, No Adult EducationPARAFFIN/OIL2ONCEI have my own sitting place153.0Botswana
12523.5419478715.332169213.025SOMETIMESUP TO 0.5KMWALKCompleted All SecondaryCompleted University DegreeELECTRIC0NEVERI have my own sitting place1113.0Botswana
13438.3829052727.826634925.025NEVERUP TO 0.5KMWALKI Do Not KnowI Do Not Have a FatherPARAFFIN/OIL0ONCEI have my own sitting place115.0Botswana
14431.55012475781.81035732.024SOMETIMES>5KMWALKNo School, No Adult EducationCompleted Some PrimaryPARAFFIN/OIL0NEVERI have my own sitting place134.0Botswana
15468.7501092740.60723359.025NEVER>0.5-1KMWALKCompleted Some SecondaryCompleted All PrimaryELECTRIC0ONCEI have my own sitting place1210.0Botswana
16462.11156245846.09486062.024NEVER>0.5-1KMWALKI Do Not KnowI Do Not KnowPARAFFIN/OIL0NEVERI have my own sitting place134.0Botswana
17625.32189785796.68926319.025NEVERUP TO 0.5KMWALKI Do Not KnowCompleted University DegreeELECTRIC0NEVERI have my own sitting place1313.0Botswana
18510.49975695767.599094712.025SOMETIMESUP TO 0.5KMWALKCompleted All PrimarySome Training After PrimaryPARAFFIN/OIL0NEVERI have my own sitting place128.0Botswana
19392.6647144767.59909476.025NEVER>1-1.5KMOTHERI Do Not KnowI Do Not KnowCANDLE0NEVERI have my own sitting place123.0Botswana
20604.00500395767.599094716.025SOMETIMES>4KM-4.5KMWALKI Do Not Have a MotherI Do Not Have a FatherELECTRIC2THREE PLUSI have my own sitting place1210.0Botswana
21523.57632325753.864720117.025SOMETIMESUP TO 0.5KMWALKCompleted All SecondaryI Do Not KnowELECTRIC0NEVERI have my own sitting place1211.0Botswana
22408.61576405753.864720120.024NEVERUP TO 0.5KMWALKNo School, Some Adult EducationNo School, Some Adult EducationPARAFFIN/OIL0TWICEI have my own sitting place156.0Botswana
23506.12832545727.826634926.025SOMETIMES>2.5-3KMWALKCompleted Some PrimaryCompleted All PrimaryELECTRIC0NEVERI have my own sitting place139.0Botswana
24612.54879395812.33118972.023SOMETIMESUP TO 0.5KMWALKCompleted All PrimaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place127.0Botswana
25[null]796.689263117.024SOMETIMES>1-1.5KMWALKNo School, Some Adult EducationNo School, Some Adult EducationCANDLE0NEVERI have my own sitting place135.0Botswana
26471.31550095753.864720122.024SOMETIMES>3.5-4KMBICYCLECompleted Some PrimaryCompleted Some PrimaryELECTRIC0ONCEI have my own sitting place139.0Botswana
27501.8363334753.86472017.024SOMETIMESUP TO 0.5KMWALKCompleted Training After SecondaryI Do Not KnowELECTRIC0NEVERI have my own sitting place1213.0Botswana
28498.8611914906.564259816.025SOMETIMESUP TO 0.5KMWALKCompleted Some SecondaryCompleted Training After SecondaryELECTRIC0ONCEI have my own sitting place1212.0Botswana
29423.1570224846.09486067.024SOMETIMES>1-1.5KMWALKCompleted All SecondaryI Do Not KnowELECTRIC0NEVERI have my own sitting place1212.0Botswana
30450.387201812.331189710.024NEVER>0.5-1KMWALKCompleted Some PrimaryCompleted All PrimaryCANDLE3ONCEI have my own sitting place144.0Botswana
31519.147368781.810357312.025SOMETIMESUP TO 0.5KMWALKCompleted All SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1412.0Botswana
32590.32581285624.628070312.025SOMETIMESUP TO 0.5KMWALKCompleted Some SecondaryCompleted University DegreeCANDLE0NEVERI have my own sitting place129.0Botswana
33510.49975695846.094860622.025NEVER>0.5-1KMWALKCompleted Some SecondaryI Do Not Have a FatherCANDLE0NEVERI have my own sitting place147.0Botswana
34643.49873135646.278785822.025SOMETIMESUP TO 0.5KMWALKCompleted All SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1212.0Botswana
35495.3200764767.599094715.024NEVER>0.5-1KMWALKCompleted Some PrimaryNo School, No Adult EducationELECTRIC3NEVERI have my own sitting place138.0Botswana
36459.9863116781.81035737.025NEVERUP TO 0.5KMWALKCompleted Some SecondaryCompleted All PrimaryELECTRIC0TWICEI have my own sitting place1310.0Botswana
37487.99064305740.607233513.025SOMETIMES>1-1.5KMWALKCompleted Some PrimaryCompleted Some PrimaryPARAFFIN/OIL0NEVERI have my own sitting place125.0Botswana
38566.4337237715.332169215.025SOMETIMES>1.5-2KMWALKI Do Not Have a MotherI Do Not KnowPARAFFIN/OIL0NEVERI have my own sitting place124.0Botswana
39552.117438691.39239123.025SOMETIMES>1.5-2KMWALKNo School, Some Adult EducationNo School, Some Adult EducationCANDLE0ONCEI have my own sitting place144.0Botswana
40468.7501092691.392391215.025SOMETIMESUP TO 0.5KMWALKNo School, No Adult EducationSome Training After PrimaryELECTRIC0THREE PLUSI have my own sitting place144.0Botswana
41538.25214075781.810357310.024SOMETIMES>3-3.5KMWALKCompleted All PrimaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place127.0Botswana
42577.2088944846.094860610.024SOMETIMESUP TO 0.5KMWALKCompleted Training After SecondaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place139.0Botswana
43430.1331224781.810357314.025NEVER>0.5-1KMWALKCompleted All PrimaryI Do Not Have a FatherELECTRIC0ONCEI have my own sitting place139.0Botswana
44532.00740605646.278785826.025SOMETIMES>1.5-2KMWALKCompleted Some PrimaryCompleted Some PrimaryELECTRIC0NEVERI have my own sitting place1110.0Botswana
45488.90656515864.598115217.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted Some SecondaryPARAFFIN/OIL2ONCEI have my own sitting place147.0Botswana
46504.18288805884.627411518.024SOMETIMES>1.5-2KMWALKCompleted Some SecondarySome Training After PrimaryPARAFFIN/OIL2NEVERI have my own sitting place127.0Botswana
47498.21906805753.86472014.025SOMETIMES>5KMCARCompleted University DegreeCompleted University DegreeELECTRIC0NEVERI have my own sitting place1214.0Botswana
48518.8684453753.864720111.023NEVER>0.5-1KMWALKCompleted Training After SecondaryCompleted Training After SecondaryPARAFFIN/OIL0NEVERI have my own sitting place1111.0Botswana
49536.69074345753.864720120.024NEVERUP TO 0.5KMWALKCompleted All PrimaryCompleted All PrimaryELECTRIC0NEVERI have my own sitting place1210.0Botswana
50477.86961185864.59811526.025NEVERUP TO 0.5KMWALKCompleted All PrimaryI Do Not KnowCANDLE1NEVERI have my own sitting place136.0Botswana
51569.53207295864.59811528.025SOMETIMES>0.5-1KMWALKCompleted Some PrimaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1210.0Botswana
52534.32951535679.756323917.023NEVER>0.5-1KMWALKCompleted Some SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1310.0Botswana
53428.54585685767.59909474.025SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryCompleted Some PrimaryELECTRIC0ONCEI have my own sitting place139.0Botswana
54574.3841869679.75632395.023SOMETIMESUP TO 0.5KMWALKCompleted All PrimaryNo School, No Adult EducationPARAFFIN/OIL1ONCEI have my own sitting place136.0Botswana
55588.42325725679.756323919.025ALL THE TIME>0.5-1KMCARCompleted University DegreeCompleted University DegreeELECTRIC1ONCEI have my own sitting place1213.0Botswana
56687.60827855906.56425989.025SOMETIMES>5KMCARI Do Not KnowSome Training After PrimaryELECTRIC1NEVERI have my own sitting place1211.0Botswana
57713.8913859958.640430220.023SOMETIMES>1.5-2KMCARCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1114.0Botswana
58685.5165495812.331189724.024SOMETIMES>5KMCARCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1215.0Botswana
59730.6463148767.59909471.025SOMETIMES>4KM-4.5KMBUS/TRUCK/VANCompleted University DegreeCompleted University DegreeELECTRIC0NEVERI have my own sitting place1212.0Kenya
60655.9907931781.810357327.025SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1411.0Kenya
61678.03411965767.59909472.024SOMETIMESUP TO 0.5KMWALKI Do Not KnowI Do Not KnowELECTRIC0ONCEI have my own sitting place168.0Kenya
62664.3520506846.094860622.023SOMETIMESUP TO 0.5KMWALKNo School, No Adult EducationI Do Not Have a FatherPARAFFIN/OIL0NEVERI have my own sitting place163.0Kenya
63558.4746904781.81035734.021SOMETIMES>0.5-1KMWALKCompleted Some SecondarySome Training After PrimaryPARAFFIN/OIL0NEVERI have my own sitting place124.0Kenya
64369.37215045740.60723354.040SOMETIMES>1-1.5KMWALKNo School, Some Adult EducationNo School, Some Adult EducationNO LIGHTING0NEVERI have my own sitting place132.0Kenya
65672.3160803[null]3.032SOMETIMESUP TO 0.5KMWALKNo School, Some Adult EducationI Do Not Have a FatherGAS5NEVERI have my own sitting place152.0Kenya
66659.65783435703.21921383.042SOMETIMES>1-1.5KMWALKNo School, Some Adult EducationCompleted Some PrimaryGAS0NEVERI have my own sitting place153.0Kenya
67649.74605845781.810357318.023ALL THE TIME>3-3.5KMWALKCompleted Some SecondaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place116.0Kenya
68639.2043353828.736137127.023SOMETIMES>1.5-2KMWALKCompleted All PrimarySome Training After PrimaryELECTRIC1ONCEI have my own sitting place147.0Kenya
69756.7965389[null]19.022SOMETIMES>1.5-2KMWALKCompleted Some PrimaryCompleted Some PrimaryPARAFFIN/OIL1NEVERI have my own sitting place114.0Kenya
70625.94792415753.864720129.023SOMETIMES>1-1.5KMWALKCompleted All SecondaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place127.0Kenya
71606.58769385715.332169218.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted All SecondaryPARAFFIN/OIL4ONCEI have my own sitting place118.0Kenya
72436.4143824781.810357328.025SOMETIMES>2-2.5KMWALKCompleted All PrimaryCompleted All PrimaryPARAFFIN/OIL1ONCEI have my own sitting place135.0Kenya
73430.1331224767.59909479.025SOMETIMESUP TO 0.5KMWALKCompleted All PrimaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place146.0Kenya
74612.8324285740.60723351.025SOMETIMES>1-1.5KMWALKCompleted All PrimaryCompleted Some SecondaryPARAFFIN/OIL1ONCEI have my own sitting place135.0Kenya
75556.7909405781.810357319.025NEVERUP TO 0.5KMWALKCompleted University DegreeCompleted University DegreeFIRE0NEVERI have my own sitting place138.0Kenya
76801.8048367796.68926314.025SOMETIMESUP TO 0.5KMWALKCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC2TWICEI have my own sitting place1312.0Kenya
77643.926602767.59909471.023NEVER>1-1.5KMWALKSome Training After PrimaryI Do Not KnowPARAFFIN/OIL0ONCEI have my own sitting place135.0Kenya
78653.7518235828.736137121.022ALL THE TIME>0.5-1KMWALKCompleted All PrimaryCompleted All PrimaryPARAFFIN/OIL0ONCEI have my own sitting place155.0Kenya
79545.70392675668.406389321.021SOMETIMES>0.5-1KMWALKCompleted All PrimaryCompleted Some PrimaryELECTRIC0NEVERI have my own sitting place147.0Kenya
80419.0689409864.598115218.016ALL THE TIME>1-1.5KMWALKCompleted All PrimaryCompleted All SecondaryFIRE1NEVERI have my own sitting place136.0Kenya
81544.4968754864.59811526.025SOMETIMESUP TO 0.5KMWALKCompleted All PrimaryCompleted All PrimaryPARAFFIN/OIL0TWICEI have my own sitting place143.0Kenya
82697.6229267781.81035737.021SOMETIMESUP TO 0.5KMWALKNo School, No Adult EducationCompleted All PrimaryPARAFFIN/OIL2TWICEI have my own sitting place134.0Kenya
83713.8913859781.81035731.021SOMETIMES>1-1.5KMWALKCompleted Some PrimaryI Do Not KnowPARAFFIN/OIL3NEVERI have my own sitting place143.0Kenya
84620.13842915781.810357316.021MOST OF THE TIMEUP TO 0.5KMWALKNo School, No Adult EducationCompleted Some PrimaryPARAFFIN/OIL0NEVERI have my own sitting place142.0Kenya
85653.37429785796.68926312.025SOMETIMES>2-2.5KMWALKCompleted Some PrimaryCompleted All PrimaryPARAFFIN/OIL0NEVERI have my own sitting place155.0Kenya
86545.70392675767.599094720.020SOMETIMES>1-1.5KMWALKCompleted Some PrimaryCompleted Some PrimaryPARAFFIN/OIL0NEVERI have my own sitting place133.0Kenya
87580.68518045812.33118971.023SOMETIMES>2-2.5KMWALKCompleted Some PrimaryCompleted Some PrimaryPARAFFIN/OIL0ONCEI have my own sitting place143.0Kenya
88512.77417745864.598115231.019SOMETIMES>1-1.5KMWALKCompleted All SecondaryCompleted All SecondaryPARAFFIN/OIL0ONCEI have my own sitting place126.0Kenya
89620.55908965864.598115220.023MOST OF THE TIME>1-1.5KMWALKCompleted All SecondaryCompleted All SecondaryELECTRIC0ONCEI have my own sitting place129.0Kenya
90537.2691123812.331189715.023NEVER>1.5-2KMWALKCompleted All PrimaryCompleted All PrimaryPARAFFIN/OIL2NEVERI have my own sitting place144.0Kenya
91615.66339735846.094860622.025SOMETIMES>0.5-1KMWALKCompleted Some SecondaryCompleted Some SecondaryPARAFFIN/OIL0NEVERI have my own sitting place139.0Kenya
92517.10655305668.406389319.021SOMETIMES>0.5-1KMWALKCompleted Some PrimaryCompleted Some SecondaryPARAFFIN/OIL0NEVERI have my own sitting place136.0Kenya
93488.9603572828.736137114.024SOMETIMES>1-1.5KMWALKCompleted Some PrimaryI Do Not Have a FatherPARAFFIN/OIL0TWICEI have my own sitting place154.0Kenya
94681.81298295884.627411510.022SOMETIMES>0.5-1KMWALKCompleted All SecondarySome Training After PrimaryPARAFFIN/OIL0NEVERI have my own sitting place117.0Kenya
95547.58700195[null]6.025MOST OF THE TIME>0.5-1KMWALKCompleted Some PrimaryCompleted All PrimaryPARAFFIN/OIL0ONCEI have my own sitting place155.0Kenya
96431.55012475796.68926316.025MOST OF THE TIME>1-1.5KMWALKCompleted All PrimarySome Training After PrimaryPARAFFIN/OIL0NEVERI have my own sitting place134.0Kenya
97463.9812291828.73613711.025MOST OF THE TIME>3.5-4KMBICYCLECompleted Some SecondaryCompleted Some SecondaryPARAFFIN/OIL2TWICEI have my own sitting place146.0Kenya
98495.59890395740.60723356.025SOMETIMESUP TO 0.5KMWALKNo School, No Adult EducationCompleted Some SecondaryPARAFFIN/OIL0TWICEI have my own sitting place153.0Kenya
99553.94425435781.810357325.025SOMETIMESUP TO 0.5KMWALKCompleted Some SecondaryCompleted Some SecondaryPARAFFIN/OIL0NEVERI have my own sitting place167.0Kenya
100557.51591795846.094860615.021NEVER>2-2.5KMWALKCompleted Some SecondarySome Training After PrimaryPARAFFIN/OIL1ONCEI have my own sitting place135.0Kenya

First, let’s look for missing values.

africa.count_percent()
123
student_score
Decimal(23,18)
100%
123
teacher_score
Decimal(11,7)
100%
123
teacher_year_teaching
Decimal(3,1)
100%
123
number_students_school
Integer
100%
Abc
english_at_home
Varchar(16)
100%
Abc
travel_distance
Varchar(11)
100%
Abc
means_of_travel
Varchar(13)
100%
Abc
m_education
Varchar(34)
100%
Abc
f_education
Varchar(34)
100%
Abc
source_of_lighting
Varchar(12)
100%
123
days_absent
Integer
100%
Abc
repeated_grades
Varchar(10)
100%
Abc
sitting_place
Varchar(27)
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
100%
Abc
country
Varchar(12)
100%
1409.34074155727.826634912.025SOMETIMES>2-2.5KMWALKNo School, No Adult EducationI Do Not KnowCANDLE0TWICEI have my own sitting place134.0South Africa
2418.54468005703.219213811.024MOST OF THE TIME>0.5-1KMWALKNo School, Some Adult EducationCompleted Some SecondaryELECTRIC1ONCEI have my own sitting place1510.0South Africa
3457.34268235703.219213811.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted Training After SecondaryELECTRIC5NEVERI have my own sitting place1212.0South Africa
4411.3052167703.219213811.024NEVER>0.5-1KMOTHERI Do Not KnowNo School, No Adult EducationELECTRIC0THREE PLUSI have my own sitting place134.0South Africa
5430.619181703.219213811.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryI Do Not Have a FatherELECTRIC5ONCEI have my own sitting place1311.0South Africa
6482.43679495703.219213811.024SOMETIMES>0.5-1KMWALKI Do Not Have a MotherCompleted All SecondaryELECTRIC1NEVERI have my own sitting place1211.0South Africa
7384.113366679.756323915.022SOMETIMES>4.5-5KMWALKCompleted All SecondaryI Do Not Have a FatherELECTRIC2THREE PLUSI have my own sitting place1411.0South Africa
8519.13142985679.756323915.022NEVER>2-2.5KMWALKCompleted All SecondaryI Do Not KnowCANDLE4NEVERI have my own sitting place1210.0South Africa
9439.6800531679.756323915.022NEVER>2-2.5KMWALKCompleted All SecondaryI Do Not Have a FatherCANDLE2NEVERI have my own sitting place1211.0South Africa
10385.53865385679.756323915.022ALL THE TIME>0.5-1KMWALKI Do Not KnowI Do Not KnowGAS5ONCEI have my own sitting place125.0South Africa
11436.8841869679.756323915.022NEVERUP TO 0.5KMWALKCompleted Some UniversityI Do Not KnowELECTRIC2NEVERI have my own sitting place1213.0South Africa
12656.75362455864.598115214.018SOMETIMES>5KMCARCompleted All SecondaryCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place1212.0South Africa
13643.9412439864.598115214.018SOMETIMES>1-1.5KMWALKCompleted Some UniversityCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1214.0South Africa
14644.39741815864.598115214.018SOMETIMES>3.5-4KMCARCompleted All SecondaryCompleted All PrimaryELECTRIC0NEVERI have my own sitting place1311.0South Africa
15687.60827855864.598115214.018SOMETIMES>0.5-1KMCARCompleted Some SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1213.0South Africa
16618.89140445864.598115214.018SOMETIMES>0.5-1KMCARCompleted University DegreeCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place1212.0South Africa
17436.4143824715.332169217.024SOMETIMES>0.5-1KMWALKCompleted Some PrimaryI Do Not KnowELECTRIC0ONCEI have my own sitting place1310.0South Africa
18528.06517375715.332169217.024SOMETIMES>3-3.5KMWALKCompleted Some SecondaryCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place129.0South Africa
19535.91289125715.332169217.024SOMETIMES>3-3.5KMWALKI Do Not KnowI Do Not KnowPARAFFIN/OIL0ONCEI have my own sitting place138.0South Africa
20507.1368738884.627411512.021SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryCompleted Some PrimaryELECTRIC0NEVERI have my own sitting place129.0South Africa

We’ll simply drop the missing values to avoid adding bias to the data.

africa.dropna()
123
student_score
Decimal(23,18)
100%
123
teacher_score
Decimal(11,7)
100%
123
teacher_year_teaching
Decimal(3,1)
100%
123
number_students_school
Integer
100%
Abc
english_at_home
Varchar(16)
100%
Abc
travel_distance
Varchar(11)
100%
Abc
means_of_travel
Varchar(13)
100%
Abc
m_education
Varchar(34)
100%
Abc
f_education
Varchar(34)
100%
Abc
source_of_lighting
Varchar(12)
100%
123
days_absent
Integer
100%
Abc
repeated_grades
Varchar(10)
100%
Abc
sitting_place
Varchar(27)
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
100%
Abc
country
Varchar(12)
100%
1409.34074155727.826634912.025SOMETIMES>2-2.5KMWALKNo School, No Adult EducationI Do Not KnowCANDLE0TWICEI have my own sitting place134.0South Africa
2418.54468005703.219213811.024MOST OF THE TIME>0.5-1KMWALKNo School, Some Adult EducationCompleted Some SecondaryELECTRIC1ONCEI have my own sitting place1510.0South Africa
3457.34268235703.219213811.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryCompleted Training After SecondaryELECTRIC5NEVERI have my own sitting place1212.0South Africa
4411.3052167703.219213811.024NEVER>0.5-1KMOTHERI Do Not KnowNo School, No Adult EducationELECTRIC0THREE PLUSI have my own sitting place134.0South Africa
5430.619181703.219213811.024SOMETIMES>0.5-1KMWALKCompleted All SecondaryI Do Not Have a FatherELECTRIC5ONCEI have my own sitting place1311.0South Africa
6482.43679495703.219213811.024SOMETIMES>0.5-1KMWALKI Do Not Have a MotherCompleted All SecondaryELECTRIC1NEVERI have my own sitting place1211.0South Africa
7384.113366679.756323915.022SOMETIMES>4.5-5KMWALKCompleted All SecondaryI Do Not Have a FatherELECTRIC2THREE PLUSI have my own sitting place1411.0South Africa
8519.13142985679.756323915.022NEVER>2-2.5KMWALKCompleted All SecondaryI Do Not KnowCANDLE4NEVERI have my own sitting place1210.0South Africa
9439.6800531679.756323915.022NEVER>2-2.5KMWALKCompleted All SecondaryI Do Not Have a FatherCANDLE2NEVERI have my own sitting place1211.0South Africa
10385.53865385679.756323915.022ALL THE TIME>0.5-1KMWALKI Do Not KnowI Do Not KnowGAS5ONCEI have my own sitting place125.0South Africa
11436.8841869679.756323915.022NEVERUP TO 0.5KMWALKCompleted Some UniversityI Do Not KnowELECTRIC2NEVERI have my own sitting place1213.0South Africa
12656.75362455864.598115214.018SOMETIMES>5KMCARCompleted All SecondaryCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place1212.0South Africa
13643.9412439864.598115214.018SOMETIMES>1-1.5KMWALKCompleted Some UniversityCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1214.0South Africa
14644.39741815864.598115214.018SOMETIMES>3.5-4KMCARCompleted All SecondaryCompleted All PrimaryELECTRIC0NEVERI have my own sitting place1311.0South Africa
15687.60827855864.598115214.018SOMETIMES>0.5-1KMCARCompleted Some SecondaryCompleted All SecondaryELECTRIC0NEVERI have my own sitting place1213.0South Africa
16618.89140445864.598115214.018SOMETIMES>0.5-1KMCARCompleted University DegreeCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place1212.0South Africa
17436.4143824715.332169217.024SOMETIMES>0.5-1KMWALKCompleted Some PrimaryI Do Not KnowELECTRIC0ONCEI have my own sitting place1310.0South Africa
18528.06517375715.332169217.024SOMETIMES>3-3.5KMWALKCompleted Some SecondaryCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place129.0South Africa
19535.91289125715.332169217.024SOMETIMES>3-3.5KMWALKI Do Not KnowI Do Not KnowPARAFFIN/OIL0ONCEI have my own sitting place138.0South Africa
20507.1368738884.627411512.021SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryCompleted Some PrimaryELECTRIC0NEVERI have my own sitting place129.0South Africa

We need to encode the categorical columns to dummies to retain linearity.

africa.one_hot_encode(max_cardinality = 20)
123
student_score
Decimal(23,18)
100%
123
teacher_score
Decimal(11,7)
100%
123
teacher_year_teaching
Decimal(3,1)
100%
123
number_students_school
Integer
100%
Abc
english_at_home
Varchar(16)
100%
Abc
travel_distance
Varchar(11)
100%
Abc
means_of_travel
Varchar(13)
100%
Abc
m_education
Varchar(34)
100%
Abc
f_education
Varchar(34)
100%
Abc
source_of_lighting
Varchar(12)
100%
123
days_absent
Integer
100%
Abc
repeated_grades
Varchar(10)
100%
Abc
sitting_place
Varchar(27)
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
100%
Abc
country
Varchar(12)
100%
123
english_at_home_ALL_THE_TIME
Bool
100%
123
english_at_home_MOST_OF_THE_TIME
Bool
100%
123
english_at_home_NEVER
Bool
100%
travel_distance_>0.5-1KMtravel_distance_>1-1.5KMtravel_distance_>1.5-2KMtravel_distance_>2-2.5KMtravel_distance_>2.5-3KMtravel_distance_>3-3.5KM...
123
socio_eco_statut_3.0
Bool
100%
123
socio_eco_statut_4.0
Bool
100%
123
socio_eco_statut_5.0
Bool
100%
123
socio_eco_statut_6.0
Bool
100%
123
socio_eco_statut_7.0
Bool
100%
123
socio_eco_statut_8.0
Bool
100%
123
socio_eco_statut_9.0
Bool
100%
123
socio_eco_statut_10.0
Bool
100%
123
socio_eco_statut_11.0
Bool
100%
123
socio_eco_statut_12.0
Bool
100%
123
socio_eco_statut_13.0
Bool
100%
123
socio_eco_statut_14.0
Bool
100%
123
country_Botswana
Bool
100%
123
country_Kenya
Bool
100%
123
country_Lesotho
Bool
100%
123
country_Malawi
Bool
100%
123
country_Mozambique
Bool
100%
123
country_Namibia
Bool
100%
123
country_Seychelles
Bool
100%
123
country_South_Africa
Bool
100%
123
country_Swaziland
Bool
100%
123
country_Tanzania
Bool
100%
123
country_Uganda
Bool
100%
123
country_Zambia
Bool
100%
123
country_Zanzibar
Bool
100%
1618.89140445864.59811529.025SOMETIMES>1.5-2KMWALKCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1214.0Botswana000001000...0000000000011000000000000
2480.2333067864.59811529.025SOMETIMES>3-3.5KMWALKCompleted Some PrimaryI Do Not KnowELECTRIC0ONCEI have my own sitting place1210.0Botswana000000001...0000000100001000000000000
3445.80907615864.59811529.025SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryNo School, Some Adult EducationPARAFFIN/OIL0ONCEI have my own sitting place136.0Botswana000000000...0001000000001000000000000
4582.5511155781.810357315.025SOMETIMES>1-1.5KMWALKCompleted Training After SecondaryCompleted University DegreePARAFFIN/OIL0NEVERI have my own sitting place1213.0Botswana000010000...0000000000101000000000000
5433.75709155646.278785814.025SOMETIMESUP TO 0.5KMWALKCompleted All SecondaryCompleted All SecondaryPARAFFIN/OIL0NEVERI have my own sitting place128.0Botswana000000000...0000010000001000000000000
6402.9024375646.278785814.025NEVER>2-2.5KMWALKCompleted All PrimaryCompleted All SecondaryELECTRIC0ONCEI have my own sitting place148.0Botswana001000100...0000010000001000000000000
7645.3928111781.810357315.025MOST OF THE TIME>0.5-1KMWALKCompleted All SecondaryCompleted All SecondaryELECTRIC2ONCEI have my own sitting place1314.0Botswana010100000...0000000000011000000000000
8534.7037205781.810357315.025SOMETIMES>3.5-4KMWALKCompleted Training After SecondaryCompleted Training After SecondaryPARAFFIN/OIL0NEVERI have my own sitting place1211.0Botswana000000000...0000000010001000000000000
9448.50248125781.810357315.025SOMETIMES>2-2.5KMWALKCompleted Some SecondaryI Do Not KnowELECTRIC0NEVERI have my own sitting place1210.0Botswana000000100...0000000100001000000000000
10596.5705475864.59811528.025SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryCompleted Some PrimaryCANDLE0NEVERI have my own sitting place125.0Botswana000000000...0010000000001000000000000
11561.55982055864.59811528.025SOMETIMESUP TO 0.5KMWALKCompleted Some PrimaryCompleted All PrimaryCANDLE0NEVERI have my own sitting place126.0Botswana000000000...0001000000001000000000000
12365.26664425781.81035734.025MOST OF THE TIME>1.5-2KMWALKI Do Not KnowI Do Not Have a FatherCANDLE0ONCEI have my own sitting place164.0Botswana010001000...0100000000001000000000000
13509.855262781.81035734.025SOMETIMES>3-3.5KMWALKCompleted All PrimaryCompleted All PrimaryCANDLE0NEVERI have my own sitting place124.0Botswana000000001...0100000000001000000000000
14495.3200764781.810357313.025SOMETIMES>2.5-3KMWALKI Do Not Have a MotherNo School, No Adult EducationELECTRIC0ONCEI have my own sitting place146.0Botswana000000010...0001000000001000000000000
15459.9863116812.331189714.024SOMETIMES>3-3.5KMCARI Do Not Have a MotherI Do Not Have a FatherELECTRIC0NEVERI have my own sitting place1211.0Botswana000000001...0000000010001000000000000
16586.986174812.331189714.024SOMETIMES>5KMCARCompleted Some PrimaryCompleted Some SecondaryELECTRIC0NEVERI have my own sitting place1210.0Botswana000000000...0000000100001000000000000
17776.69753635884.627411515.024MOST OF THE TIME>5KMCARCompleted All SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1113.0Botswana010000000...0000000000101000000000000
18510.4680063884.627411515.024SOMETIMES>5KMCARCompleted University DegreeCompleted Some UniversityELECTRIC0NEVERI have my own sitting place1215.0Botswana000000000...0000000000001000000000000
19600.0593246828.736137110.024SOMETIMES>4.5-5KMCARCompleted Some UniversityCompleted University DegreeELECTRIC0NEVERI have my own sitting place1114.0Botswana000000000...0000000000011000000000000
20607.15746125828.736137110.024SOMETIMES>4KM-4.5KMCARCompleted Training After SecondaryCompleted Training After SecondaryELECTRIC0NEVERI have my own sitting place1214.0Botswana000000000...0000000000011000000000000

Linear regression can only handle numerical columns, so we’ll drop the categorical columns.

africa.drop(
    columns = [
        "english_at_home",
        "travel_distance",
        "means_of_travel",
        "m_education",
        "f_education",
        "source_of_lighting",
        "repeated_grades",
        "sitting_place",
        "country",
    ],
)
123
student_score
Decimal(23,18)
100%
123
teacher_score
Decimal(11,7)
100%
123
teacher_year_teaching
Decimal(3,1)
100%
123
number_students_school
Integer
100%
123
days_absent
Integer
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
100%
123
english_at_home_ALL_THE_TIME
Bool
100%
123
english_at_home_MOST_OF_THE_TIME
Bool
100%
123
english_at_home_NEVER
Bool
100%
travel_distance_>0.5-1KMtravel_distance_>1-1.5KMtravel_distance_>1.5-2KMtravel_distance_>2-2.5KMtravel_distance_>2.5-3KMtravel_distance_>3-3.5KMtravel_distance_>3.5-4KMtravel_distance_>4.5-5KMtravel_distance_>4KM-4.5KMtravel_distance_>5KM
123
means_of_travel_BICYCLE
Bool
100%
123
means_of_travel_BUS_TRUCK_VAN
Bool
100%
123
means_of_travel_CAR
Bool
100%
123
means_of_travel_OTHER
Bool
100%
123
means_of_travel_TRAIN
Bool
100%
...
123
socio_eco_statut_3.0
Bool
100%
123
socio_eco_statut_4.0
Bool
100%
123
socio_eco_statut_5.0
Bool
100%
123
socio_eco_statut_6.0
Bool
100%
123
socio_eco_statut_7.0
Bool
100%
123
socio_eco_statut_8.0
Bool
100%
123
socio_eco_statut_9.0
Bool
100%
123
socio_eco_statut_10.0
Bool
100%
123
socio_eco_statut_11.0
Bool
100%
123
socio_eco_statut_12.0
Bool
100%
123
socio_eco_statut_13.0
Bool
100%
123
socio_eco_statut_14.0
Bool
100%
123
country_Botswana
Bool
100%
123
country_Kenya
Bool
100%
123
country_Lesotho
Bool
100%
123
country_Malawi
Bool
100%
123
country_Mozambique
Bool
100%
123
country_Namibia
Bool
100%
123
country_Seychelles
Bool
100%
123
country_South_Africa
Bool
100%
123
country_Swaziland
Bool
100%
123
country_Tanzania
Bool
100%
123
country_Uganda
Bool
100%
123
country_Zambia
Bool
100%
123
country_Zanzibar
Bool
100%
1618.89140445864.59811529.02501214.0000001000000000000...0000000000011000000000000
2480.2333067864.59811529.02501210.0000000001000000000...0000000100001000000000000
3445.80907615864.59811529.0250136.0000000000000000000...0001000000001000000000000
4582.5511155781.810357315.02501213.0000010000000000000...0000000000101000000000000
5433.75709155646.278785814.0250128.0000000000000000000...0000010000001000000000000
6402.9024375646.278785814.0250148.0001000100000000000...0000010000001000000000000
7645.3928111781.810357315.02521314.0010100000000000000...0000000000011000000000000
8534.7037205781.810357315.02501211.0000000000100000000...0000000010001000000000000
9448.50248125781.810357315.02501210.0000000100000000000...0000000100001000000000000
10596.5705475864.59811528.0250125.0000000000000000000...0010000000001000000000000
11561.55982055864.59811528.0250126.0000000000000000000...0001000000001000000000000
12365.26664425781.81035734.0250164.0010001000000000000...0100000000001000000000000
13509.855262781.81035734.0250124.0000000001000000000...0100000000001000000000000
14495.3200764781.810357313.0250146.0000000010000000000...0001000000001000000000000
15459.9863116812.331189714.02401211.0000000001000000100...0000000010001000000000000
16586.986174812.331189714.02401210.0000000000000100100...0000000100001000000000000
17776.69753635884.627411515.02401113.0010000000000100100...0000000000101000000000000
18510.4680063884.627411515.02401215.0000000000000100100...0000000000001000000000000
19600.0593246828.736137110.02401114.0000000000010000100...0000000000011000000000000
20607.15746125828.736137110.02401214.0000000000001000100...0000000000011000000000000

Let’s look at the correlation between the response column and the predictors. We’ll look to keep columns with correlations coefficients greater than 20% (the top 10 features).

x = africa.corr(focus = "student_score", show = False)
africa = africa.select(columns = x["index"][0:12])
africa.head(100)
123
student_score
Decimal(23,18)
100%
123
socio_eco_statut
Decimal(3,1)
100%
123
source_of_lighting_ELECTRIC
Integer
100%
123
socio_eco_statut_14.0
Integer
100%
123
means_of_travel_CAR
Integer
100%
123
english_at_home_NEVER
Integer
100%
123
repeated_grades_NEVER
Integer
100%
123
age
Integer
100%
123
country_Tanzania
Integer
100%
123
teacher_score
Decimal(11,7)
100%
123
source_of_lighting_CANDLE
Integer
100%
123
f_education_Completed_University_Degree
Integer
100%
1508.482185410.010011130812.331189700
2499.8908965.000011140740.607233510
3512.396303512.010000140781.810357300
4638.096424614.011001110767.599094700
5476.616041358.000010130740.607233500
6363.506427959.000010120796.689263100
7486.871853457.000010140740.607233510
8574.1618076512.010001120796.689263100
9464.897878355.000011120703.219213810
10518.86844538.000001120767.599094700
11473.30249243.000000150812.331189700
12523.541947813.010001110715.332169201
13438.38290525.000010110727.826634900
14431.550124754.000001130781.810357300
15468.750109210.010010120740.607233500
16462.111562454.000011130846.094860600
17625.3218978513.010011130796.689263101
18510.499756958.000001120767.599094700
19392.66471443.000011120767.599094710
20604.0050039510.010000120767.599094700
21523.5763232511.010001120753.864720100
22408.615764056.000010150753.864720100
23506.128325459.010001130727.826634900
24612.548793957.000001120812.331189700
25471.315500959.010000130753.864720100
26501.836333413.010001120753.864720100
27498.861191412.010000120906.564259800
28423.157022412.010001120846.094860600
29450.3872014.000010140812.331189710
30519.14736812.010001140781.810357300
31590.325812859.000001120624.628070311
32510.499756957.000011140846.094860610
33643.4987313512.010001120646.278785800
34495.32007648.010011130767.599094700
35459.986311610.010010130781.810357300
36487.990643055.000001120740.607233500
37566.43372374.000001120715.332169200
38552.1174384.000000140691.392391210
39468.75010924.010000140691.392391200
40538.252140757.000001120781.810357300
41577.20889449.000001130846.094860600
42430.13312249.010010130781.810357300
43532.0074060510.010001110646.278785800
44488.906565157.000000140864.598115200
45504.182888057.000001120884.627411500
46498.2190680514.011101120753.864720101
47518.868445311.000011110753.864720100
48536.6907434510.010011120753.864720100
49477.869611856.000011130864.598115210
50569.5320729510.010001120864.598115200
51534.3295153510.010011130679.756323900
52428.545856859.010000130767.599094700
53574.38418696.000000130679.756323900
54588.4232572513.010100120679.756323901
55687.6082785511.010101120906.564259800
56713.891385914.011101110958.640430200
57685.516549515.010101120812.331189700
58730.646314812.010001120767.599094701
59655.990793111.010001140781.810357300
60678.034119658.010000160767.599094700
61664.35205063.000001160846.094860600
62558.47469044.000001120781.810357300
63369.372150452.000001130740.607233500
64659.657834353.000001150703.219213800
65649.746058456.000001110781.810357300
66639.20433537.010000140828.736137100
67625.947924157.000001120753.864720100
68606.587693858.000000110715.332169200
69436.41438245.000000130781.810357300
70430.13312246.000001140767.599094700
71612.83242855.000000130740.607233500
72556.79094058.000011130781.810357301
73801.804836712.010000130796.689263100
74643.9266025.000010130767.599094700
75653.75182355.000000150828.736137100
76545.703926757.010001140668.406389300
77419.06894096.000001130864.598115200
78544.49687543.000000140864.598115200
79697.62292674.000000130781.810357300
80713.89138593.000001140781.810357300
81620.138429152.000001140781.810357300
82653.374297855.000001150796.689263100
83545.703926753.000001130767.599094700
84580.685180453.000000140812.331189700
85512.774177456.000000120864.598115200
86620.559089659.010000120864.598115200
87537.26911234.000011140812.331189700
88615.663397359.000001130846.094860600
89517.106553056.000001130668.406389300
90488.96035724.000000150828.736137100
91681.812982957.000001110884.627411500
92431.550124754.000001130796.689263100
93463.98122916.000000140828.736137100
94495.598903953.000000150740.607233500
95553.944254357.000001160781.810357300
96557.515917955.000010130846.094860600
97640.0246596.000000140884.627411500
98459.98631162.000000150812.331189710
99586.651276954.000000150812.331189700
100573.56749979.000001110846.094860600

Let’s examine the correlation matrix to see if we have any independent predictors.

africa.corr()

Some of these features are highly-correlated, like socioeconomic status and having an electric lighting. We’ll drop the lighting column to avoid unexpected results while computing the linear regression.

africa["source_of_lighting_ELECTRIC"].drop()
123
student_score
Decimal(23,18)
100%
123
socio_eco_statut
Decimal(3,1)
100%
123
socio_eco_statut_14.0
Integer
100%
123
means_of_travel_CAR
Integer
100%
123
english_at_home_NEVER
Integer
100%
123
repeated_grades_NEVER
Integer
100%
123
age
Integer
100%
123
country_Tanzania
Integer
100%
123
teacher_score
Decimal(11,7)
100%
123
source_of_lighting_CANDLE
Integer
100%
123
f_education_Completed_University_Degree
Integer
100%
1508.482185410.00011130812.331189700
2499.8908965.00011140740.607233510
3512.396303512.00000140781.810357300
4638.096424614.01001110767.599094700
5476.616041358.00010130740.607233500
6363.506427959.00010120796.689263100
7486.871853457.00010140740.607233510
8574.1618076512.00001120796.689263100
9464.897878355.00011120703.219213810
10518.86844538.00001120767.599094700
11473.30249243.00000150812.331189700
12523.541947813.00001110715.332169201
13438.38290525.00010110727.826634900
14431.550124754.00001130781.810357300
15468.750109210.00010120740.607233500
16462.111562454.00011130846.094860600
17625.3218978513.00011130796.689263101
18510.499756958.00001120767.599094700
19392.66471443.00011120767.599094710
20604.0050039510.00000120767.599094700

Let’s normalize the dataset to follow the Gaussian-Markov assumptions.

africa.normalize(columns = africa.get_columns(exclude_columns = ["student_score"]))
123
student_score
Decimal(23,18)
100%
123
socio_eco_statut
Real
100%
123
socio_eco_statut_14.0
Real
100%
123
means_of_travel_CAR
Real
100%
123
english_at_home_NEVER
Real
100%
123
repeated_grades_NEVER
Real
100%
123
age
Real
100%
123
country_Tanzania
Real
100%
123
teacher_score
Real
100%
123
source_of_lighting_CANDLE
Real
100%
123
f_education_Completed_University_Degree
Real
100%
1394.65259091.433742650904167-0.1798854581-0.23960430342.022972143810.80707982649-0.80723920987-0.28325775741.3392338760315992-0.521244728-0.258861602
2553.944254351.433742650904167-0.17988545814.1733141292-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
3711.0125382.01894373290586775.5587818787-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
4552.63809381.433742650904167-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
5473.375922851.1411421099033165-0.1798854581-0.2396043034-0.494294510030.80707982649-0.80723920987-0.28325775741.3392338760315992-0.521244728-0.258861602
6567.917072951.7263431919050174-0.17988545814.1733141292-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
7562.544176652.01894373290586775.5587818787-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
8470.893511851.433742650904167-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
9495.08526891.1411421099033165-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
10337.417111750.8485415689024662-0.1798854581-0.23960430342.022972143810.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
11672.193917052.01894373290586775.55878187874.1733141292-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
12566.42407821.433742650904167-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.3392338760315992-0.521244728-0.258861602
13672.31608031.1411421099033165-0.1798854581-0.2396043034-0.494294510030.80707982649-0.80723920987-0.28325775741.101928632197215-0.521244728-0.258861602
14606.587693850.8485415689024662-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.101928632197215-0.521244728-0.258861602
15713.89138591.7263431919050174-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.101928632197215-0.5212447283.8628518743
16665.95882791.7263431919050174-0.17988545814.1733141292-0.494294510030.80707982649-1.40536158075-0.28325775741.101928632197215-0.521244728-0.258861602
17601.768626751.433742650904167-0.17988545814.1733141292-0.494294510030.80707982649-0.80723920987-0.28325775741.101928632197215-0.521244728-0.258861602
18616.66324991.7263431919050174-0.1798854581-0.2396043034-0.494294510030.80707982649-0.80723920987-0.28325775741.101928632197215-0.5212447283.8628518743
19545.703926750.8485415689024662-0.1798854581-0.2396043034-0.494294510030.80707982649-0.80723920987-0.28325775741.101928632197215-0.521244728-0.258861602
20558.595809651.433742650904167-0.1798854581-0.2396043034-0.494294510030.80707982649-1.40536158075-0.28325775741.101928632197215-0.521244728-0.258861602

We can use a cross-validation to test our model.

from vastorbit.machine_learning.vast import LinearRegression
from vastorbit.machine_learning.model_selection import cross_validate

cross_validate(
    LinearRegression(),
    input_relation = africa,
    X = africa.get_columns(exclude_columns = ["student_score"]),
    y = "student_score",
)
explained_variancemax_errormedian_absolute_errormean_absolute_errormean_squared_errorroot_mean_squared_errorr2r2_adjaicbictime
1-fold0.27642002833993773371.797095648.70493757.836224513664.88350270142773.022508079338520.276340653423135850.27511432001087256319.6057588411656393.0521302181950.355010986328125
2-fold0.27602050991272475385.773431847.08754356.883275713451.91178698297771.964886685561920.27600445737108370.274777346281882156217.23285874619656290.677354804880.34036874771118164
3-fold0.29088408634668095386.638750946.79002457.559034914005.83811169577573.056645254854330.290774337220719440.2895751054608627456589.4205373467556662.8912588141540.32038116455078125
avg0.28110820819978116381.403092766666647.5275013333333357.4261783666666713707.54446712672772.68134667325160.28103981600497970.2798222572512056356375.41971831136556448.873581279070.338586966196696
std0.0069145136681570296.8016459018246710.84138594025743580.4002216033585845228.142589501579950.50680536839978360.0068847141998836660.006897677095658918156.98686904605265156.998563440058120.014193594755068688

The model isn’t bad. We’re just using a few variables to get a median absolute error of 47; that is, our score has a distance of 47 from the true value. This seems high, but if we keep in mind that the final score is over 1000, our predictions are quite good.

Let’s compare the importance of our features.

model = LinearRegression()
model.fit(
    input_relation = africa,
    X = africa.get_columns(exclude_columns = ["student_score"]),
    y = "student_score",
)
model.features_importance()
The following factors seem to have the greatest influence on a student’s performance:
  • Having a good teacher.

  • Being of good socio-economic status.

  • Tanzanian teachers tend to overrate their students.

  • Age (younger students tend to perform better).

  • Being able to get to school by car.

Let’s add the prediction to the VastFrame to see how our model performs its estimations.

model.predict(africa, name = "estimated_student_score")
africa.boxplot(["estimated_student_score", "student_score"])
africa.describe(columns = ["student_score", "estimated_student_score"])
countmeanstdminapprox_25%approx_50%approx_75%max
"student_score"17865.0504.196673766563186.29385920170321117.53299985441.20236494.76453556.62067918.5515125
"estimated_student_score"17865.0504.196673846.27915086017581389.798936471.03687497.74542531.69556689.2642057

Our model has trouble catching outliers: exceptionally well-performing and struggling students.

Let’s draw a residual plot.

africa["residual"] = africa["student_score"] - africa["estimated_student_score"]
africa.scatter(["residual", "student_score"])

We see a high heteroscedasticity, indicating that we can’t trust the p-value of the coefficients.

model.coef_

Let’s look at the model’s analysis of variance (ANOVA) table.

model.report("anova")
DfSSMSFp_value
Regression1038260397.144710283826039.714471028275.654050349603950.0
Residual17854247811026.0869739713879.86031628621
Total17864133026600.74813513

According to the ANOVA table, at least one of our variables is influencing the prediction.

We can also see that a student’s estimated score and true score skew heavily from a normal distribution.

africa["estimated_student_score"].hist()
from vastorbit.machine_learning.model_selection.statistical_tests import jarque_bera

jarque_bera(africa, "estimated_student_score")

Our model doesn’t verify the basic hypothesis and therefore isn’t stable enough to be put into production. Let’s look at a second technique.

Example with decomposition

Let’s look at the same dataset, but use decomposition techniques to filter out unimportant information. We don’t have to normalize our data or look at correlations with these types of methods.

We’ll begin by repeating the data preparation process of the previous section and export the resulting VastFrame to VAST.

africa = load_africa_education()
africa = africa.select(
    [
        "(zralocp + zmalocp) / 2 AS student_score",
        "zraloct AS teacher_score",
        "XNUMYRS AS teacher_year_teaching",
        "numstu AS number_students_school",
        "PENGLISH AS english_at_home",
        "PTRAVEL AS travel_distance",
        "PTRAVEL2 AS means_of_travel",
        "PMOTHER AS m_education",
        "PFATHER AS f_education",
        "PLIGHT AS source_of_lighting",
        "PABSENT AS days_absent",
        "PREPEAT AS repeated_grades",
        "zpsit AS sitting_place",
        "PAGE AS age",
        "zpses AS socio_eco_statut",
        "country_long AS country",
    ],
)
africa.dropna()
africa.one_hot_encode(max_cardinality = 20)
africa.drop(
    columns = [
        "english_at_home",
        "travel_distance",
        "means_of_travel",
        "m_education",
        "f_education",
        "source_of_lighting",
        "repeated_grades",
        "sitting_place",
        "country",
    ],
)
123
student_score
Decimal(23,18)
100%
123
teacher_score
Decimal(11,7)
100%
123
teacher_year_teaching
Decimal(3,1)
100%
123
number_students_school
Integer
100%
123
days_absent
Integer
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3,1)
100%
123
english_at_home_ALL_THE_TIME
Bool
100%
123
english_at_home_MOST_OF_THE_TIME
Bool
100%
123
english_at_home_NEVER
Bool
100%
travel_distance_>0.5-1KMtravel_distance_>1-1.5KMtravel_distance_>1.5-2KMtravel_distance_>2-2.5KMtravel_distance_>2.5-3KMtravel_distance_>3-3.5KMtravel_distance_>3.5-4KMtravel_distance_>4.5-5KMtravel_distance_>4KM-4.5KMtravel_distance_>5KM
123
means_of_travel_BICYCLE
Bool
100%
123
means_of_travel_BUS_TRUCK_VAN
Bool
100%
123
means_of_travel_CAR
Bool
100%
123
means_of_travel_OTHER
Bool
100%
123
means_of_travel_TRAIN
Bool
100%
...
123
socio_eco_statut_3.0
Bool
100%
123
socio_eco_statut_4.0
Bool
100%
123
socio_eco_statut_5.0
Bool
100%
123
socio_eco_statut_6.0
Bool
100%
123
socio_eco_statut_7.0
Bool
100%
123
socio_eco_statut_8.0
Bool
100%
123
socio_eco_statut_9.0
Bool
100%
123
socio_eco_statut_10.0
Bool
100%
123
socio_eco_statut_11.0
Bool
100%
123
socio_eco_statut_12.0
Bool
100%
123
socio_eco_statut_13.0
Bool
100%
123
socio_eco_statut_14.0
Bool
100%
123
country_Botswana
Bool
100%
123
country_Kenya
Bool
100%
123
country_Lesotho
Bool
100%
123
country_Malawi
Bool
100%
123
country_Mozambique
Bool
100%
123
country_Namibia
Bool
100%
123
country_Seychelles
Bool
100%
123
country_South_Africa
Bool
100%
123
country_Swaziland
Bool
100%
123
country_Tanzania
Bool
100%
123
country_Uganda
Bool
100%
123
country_Zambia
Bool
100%
123
country_Zanzibar
Bool
100%
1417.89208995691.39239121.0191134.0001000001000000000...0100000000000000000000000
2380.3882634691.39239121.0190132.0001000100000000000...0000000000000000000000000
3533.9601487727.82663495.0242125.0001010000000000000...0010000000000000000000000
4462.11156245727.82663495.0240127.0001100000000000000...0000100000000000000000000
5394.6525909727.82663495.0240116.0001000000000000000...0001000000000000000000000
6413.12320985727.82663495.02410123.0001001000000000000...1000000000000000000000000
7462.0710837727.82663495.0240115.0001000000000000000...0010000000000000000000000
8397.036715727.82663495.0248125.0001000000000000000...0010000000000000000000000
9365.22920145796.68926314.0243115.0001000000000100000...0010000000000000000000000
10517.10655305796.68926314.0245114.0001000000000100000...0100000000000000000000000
11497.7289933796.68926314.0245136.0001000000000100000...0001000000000000000000000
12504.14250455796.68926314.0246132.0001001000000000000...0000000000000000000000000
13543.1042547796.68926314.0240127.0001001000000000000...0000100000000000000000000
14555.7062418846.094860615.02501112.0000000000000000000...0000000001000000000000000
15553.94425435846.094860615.02501210.0100000000100010000...0000000100000000000000000
16645.4134935846.094860615.02521113.0000000000000000000...0000000000100000000000000
17713.8913859846.094860615.02521214.0000010000000000000...0000000000010000000000000
18575.6524936846.094860615.02501212.0000000000000000000...0000000001000000000000000
19736.76449035812.331189710.02521211.0000000000000000000...0000000010000000000000000
20615.3610104812.331189710.02501112.0000000100000000000...0000000001000000000000000

Let’s create our principal component analysis (PCA) model.

from vastorbit.machine_learning.vast import PCA

model = PCA()
model.fit(
    africa,
    africa.get_columns(exclude_columns = ["student_score"]),
)
africa_pca = model.transform()
africa_pca.head(100)
123
student_score
Decimal(23, 18)
100%
123
teacher_score
Decimal(11, 7)
100%
123
teacher_year_teaching
Decimal(3, 1)
100%
123
number_students_school
Integer
100%
123
days_absent
Integer
100%
123
age
Integer
100%
123
socio_eco_statut
Decimal(3, 1)
100%
123
english_at_home_ALL_THE_TIME
Integer
100%
123
english_at_home_MOST_OF_THE_TIME
Integer
100%
123
english_at_home_NEVER
Integer
100%
travel_distance_>0.5-1KMtravel_distance_>1-1.5KMtravel_distance_>1.5-2KMtravel_distance_>2-2.5KMtravel_distance_>2.5-3KMtravel_distance_>3-3.5KMtravel_distance_>3.5-4KMtravel_distance_>4.5-5KMtravel_distance_>4KM-4.5KMtravel_distance_>5KM
123
means_of_travel_BICYCLE
Integer
100%
123
means_of_travel_BUS_TRUCK_VAN
Integer
100%
123
means_of_travel_CAR
Integer
100%
123
means_of_travel_OTHER
Integer
100%
123
means_of_travel_TRAIN
Integer
100%
...
123
col71
Double
100%
123
col72
Double
100%
123
col73
Double
100%
123
col74
Double
100%
123
col75
Double
100%
123
col76
Double
100%
123
col77
Double
100%
123
col78
Double
100%
123
col79
Double
100%
123
col80
Double
100%
123
col81
Double
100%
123
col82
Double
100%
123
col83
Double
100%
123
col84
Double
100%
123
col85
Double
100%
123
col86
Double
100%
123
col87
Double
100%
123
col88
Double
100%
123
col89
Double
100%
123
col90
Double
100%
123
col91
Double
100%
123
col92
Double
100%
123
col93
Double
100%
123
col94
Double
100%
123
col95
Double
100%
1459.30500675691.392391233.0252158.0000000000000000000...-0.164684246730364660.005478813736449143-0.07581419241058990.0215558100381088720.019264815404196210.07527774297467825-0.09285981592076925-0.21931697246016343-0.00773985475240080050.0159010267423193920.019832864790750190.00170614788500201620.024705060906892166-0.0011996385299720895-0.005038044053941804-0.018920656312102487-0.003469793572097145-0.0005652200162196022-0.0013034927445658994-0.003999780398782298-0.0010247333029025933-9.70868546023751e-05-0.000373883979905003262.0714492708818413e-123.918824062221148e-12
2415.95588695691.392391233.0254157.0000000000000000000...0.075373601860609860.0016268675098148342-0.088957575080134440.1549386692403849-0.273207472068721-0.021710613859685143-0.197961466523024960.006228130981422693-0.0147022541161337830.0044739068958536030.017575225881049890.005809926723884975-0.16235458466713956-0.003568406129030553-0.014275902171451488-0.223793948646557330.004179761370909981-0.0084037658273051090.000805630985773145-0.0046708885880034130.000848435591817498-0.00042046636046948486-0.00014244407822225827-9.853331336526696e-12-1.8643558455633323e-11
3626.91634205715.33216927.0252147.0000010000000000000...-0.0051722375148657695-0.16114436115964130.05166270590153258-0.0152754675057899650.057470894599715020.07630068283914170.0086779516775760160.0193737066319500140.011664045192633522-0.002258566484757832-0.0065711658366296980.0054425163056280630.008833271871696215-0.008694826817393171-0.0191572569735512960.00068496814466607-0.00509903663689935-0.00166167152909817370.0018245555795430933-0.002535093348303169-0.0006830647117833293-0.0007193113966225306-0.000387452451958145762.1321507147532218e-124.032941111364806e-12
4430.21879075715.33216927.0251129.0000000000100000000...-0.3906827346992055-0.118457886769222660.107353958490671060.0055508342176904110.03489416134110126-0.0283317463503372470.184161191342190140.13030234091168028-0.02080826411923034-0.0095682550441449910.0012068436051373022-0.0188018234002063430.0341198761295375060.0076898050755273980.03989289248697943-0.015989416059230176-0.0020789441736798420.005893286345246452-0.0026977557436544015-0.004225928935381707-0.00018471020101292504-0.0005350477678121061-0.00028418516814500161.8623751933866886e-123.523161392926454e-12
5459.11697145715.33216927.0250186.0000100000000000000...0.0037732500040189470.012687363620875771-0.17177062429041917-0.6552869212182855-0.6144920912179278-0.318969670267634840.009373614919960970.031311071517202124-0.081215449637654950.424253620630881960.109547376511421840.00580413558961190.033579148155911620.03346109492496352-0.024022073629845530.009076190797223879-0.0393909411911824640.0020914800725588944-0.013922060719186889-0.0005520332204358156-0.003335592151863145-0.0017254339361437612-8.973114020465088e-052.1298539408710285e-124.026363039943902e-12
6532.25568495715.33216927.0252139.0000001000000000000...-0.016830316578898708-0.134300611512713360.04934381283933908-0.0255696908899736420.045351093799221180.072904252809486470.035569205999015460.029644638504764866-0.00271655752784076030.010233767879623856-0.013595699611988192-6.410437404176778e-050.00435452544021716450.0050193139415554770.005196440512462470.0016189014429899090.0016127399687157306-0.00173895971082692550.00018286855908229748-0.001162968335591439-0.0006796017700717988-0.00094285222301343187.527225512566338e-067.21565524433109e-131.3645547661477619e-12
7456.26620545657.247216.0224136.0000000000000000000...-0.0416532116147601550.0033270274029735735-0.059677066601445370.00254773270809515850.0152834620931647830.08259937331981884-0.17385160705536354-0.0261476544525123850.029363883349448235-0.0066642913107906350.0126488074488582470.00238126514997442220.005159177816571993-0.00446370539714488-0.0021545935788060860.004743152377648132-0.0010671662209808612-0.0052828355901300570.0020450321475314580.000214919410195125530.0001560834798091177-0.001040639542542261-0.00042180362149455352.251576017733369e-124.259260074934644e-12
8450.7787366657.247216.0229166.0001100000000000000...-0.0489783907082303-0.0052071698927649150.0248760558158798020.093382657733996620.07228071506810850.0448660434552314860.0014329569417056480.0143824406821345140.0040349448943028770.0087582275811222010.0152171394530115080.00081030744779573780.009653941285250033-0.0004582574634411983-2.3563281169636935e-050.005103493394347334-0.0032425584347476710.00378720310262718570.0024765318008756207-0.000404963425866127940.00019310755938481105-0.0011001583003489327-0.00053509713859869123.26112956960064e-126.168621632684988e-12
9436.4143824657.247216.0220126.0000001000000000000...0.080302688932851350.061223282307440930.00287665102907932930.0293638094679613170.03556140429039695-0.12499770076968030.022886554435036555-0.004294034808958650.0029364058408168324-0.00183346763350480140.0024726100496145712-0.0101057511670715070.018543149166708190.0153062077646364310.030257581059947317-0.004227950194250579-0.00249088207277410040.002755364685206303-0.00138317273643421180.00088326487617868890.0006124536547563527-0.00069392985181930960.00039702671346004156-1.0288277087021964e-12-1.948052366895837e-12
10337.41711175657.247216.0220167.0000000000000000000...0.11644579445829246-0.120527898156807350.0179456159999938770.082377890317949790.08000285402637680.07599385390899198-0.198499042415363450.0183643613363759960.0475246269504841150.036427768693216345-0.0077122995665236330.02095250010469227-0.16145026094828843-0.00822746536658499-0.03690530806967643-0.21817124385381956-0.0029375440821105925-0.0099181268335074430.0009850495584282674-0.0015982452108470654-0.0006758620057912403-0.000739053275009882-0.0004102845391956915-8.130556635852417e-12-1.538283343230924e-11
11385.53865385657.247216.0220136.0001000000010000000...-0.03136611568082949-0.0227197799423250230.036697368812136480.0036264189897251093-0.004338580246844779-0.00145455482675841050.170814416949151750.061409547184253310.046756545531359860.0024552003937192528-0.011280234228801901-0.02020256704333490.004861467205633548-0.0024736977298835530.0098849767196959160.00493647864637172550.0034492689989346534-0.0008574304440151384-0.0028143957061212855-0.0085455312125833264.805565982733718e-05-0.0008259696545435234-0.00041446905690007352.9018336432563233e-125.4887210524045424e-12
12438.7512602753.86472015.0253143.0000000000010000000...-0.07875244245759995-0.053381501435829930.0482974980105316460.0406301969129239450.06339773516808284-0.201519835501137060.134854560325033620.020060747022352384-0.0028431195093741190.0004318155186491085-0.0052649022835595406-0.0180020809961658930.010877490997256547-6.110697177508879e-050.009612297848165237-0.0032053886493603730.00234430453693249260.009779832475616741-0.005473384032225864-0.008142661730804045-0.0008840712570197127-0.0005422215790630742-0.000124086709294206819.769844743124581e-131.846009919670365e-12
13435.52195685812.331189717.0254175.0000010000000000000...0.032784104474714325-0.010206009546066607-0.038125824998011180.4804335481196948-0.15984604786824470.088658877433750880.02286593392387765-0.022670525753225004-0.03293927394959940.0352499420247527760.016426378559827343-0.0056824319690999630.0095369188519682530.0122404298534464550.0141048453278950890.016717382416431118-0.0051491745980068630.0005880043942150925-0.0020110545652857106-0.002515101258817299-0.0005332590208827346-0.0007600799983012576-0.000289881572862972043.225519166085788e-126.0994963716142645e-12
14494.23537775753.86472015.0250114.0000000000100000000...-0.15800052150314461-0.0104167377030684220.167931286027130140.0071821412431710440.017910555252913695-0.190348326450019260.2291455495392692-0.0122387799356431-0.11284325755007908-0.02018205126879639-0.011427184744255053-0.0259925444783015160.0290214492411391550.00305975430494941770.075825026309664240.0087691056267012730.0015612438007139968-0.0013708981775329583-0.003907098987073816-0.004728937829043918-0.0018701905612353838-0.0010435687660657557-0.00050765037458847083.5784590656141253e-126.76968250042924e-12
15435.52195685753.86472015.0250166.0100000000000000000...-0.07014089505164044-0.064228203303737640.0152862574739078080.09424120929163240.0377146998882805850.09808951301305764-0.14426403301719196-0.052867254634088560.0249001929341275340.0250801560298050360.00332130211807466460.0070629880531199870.020186891430883265-0.00759685271604932-0.02662592263271663-0.006784941946718988-0.0104785730216828570.001803229327913365-0.0010632602937147408-0.0017590669607800116-0.0012737195303157169-0.0013565486741837517-4.663428304623387e-051.2437433115542676e-122.3525908080190162e-12
16494.23537775753.86472015.0250128.0000000100000000000...-0.1357647453839869-0.059748809698719520.0341513143870087740.036260675821998730.028134862708115355-0.104980169320127460.094060795175102380.03127265220829989-0.03767569895875409-0.0136672699331426280.005444599975844679-0.0143766760192037420.013601480785774108-0.0025687932880138620.026418891043215250.0128748552403958340.0070262799558799940.008739274214101934-0.0004413487990810776-0.003977192745325572-0.0025411108899540203-0.0021727028710087277-0.00050957439161071353.292028464154739e-126.2273940640510825e-12
17438.76115885753.86472015.0253137.0000000010000000000...-0.11045825509403083-0.04853939887873455-0.00552946287502367050.11726149775620334-0.29580379796906026-0.029417118223167460.084621453471192790.04587384936578884-0.015756162980939917-0.0107753515190493620.00032388061547458495-0.0123582084569562960.02629141395381259-0.00051402390918672090.024795782152777070.004597130884029962-0.0015421429821645820.0016305481040705795-0.0017088256225630527-0.004074872796632865-2.4375667360536868e-05-0.001370929339435872-0.00040253023749284952.7413162105772374e-125.184131365598631e-12
18421.22448725812.331189717.0250135.0001000000100000000...-0.06654824178453587-0.0141050264605168010.070221554668593670.11146787193641185-0.2840622489801758-0.045044301812310470.20935825226243880.059953528654162064-0.040434304705447295-0.013503206743414826-0.007152175272696561-0.034751907138267190.00869224409797150.0168550324212392230.049759773302741050.00732960142162628150.0067269374372440965-0.0011815416004087745-0.0023713179717299677-0.004397658397189970.000584251485739427-0.0005511416782386868-0.000266320658600437762.416277603436511e-124.570441710949268e-12
19510.4680063812.331189717.0250133.0000000010000000000...-0.039483072757637320.05666581265387954-0.004272059013649224-0.0123849280714439530.028971551654994515-0.0081358552452462040.06923561825795604-0.00879638949421498-0.043271933695230365-0.00510312627811122-0.0140719998172690870.000153263088186982840.0055867458103693470.0044581725034892260.035228553643874910.0075336461063140090.0016726067470384442-0.005697813872269879-0.0010694423966225253-0.0008431418215113873-0.0001465817067331073-0.00027884716206095345-0.000319402978775133141.6067307294554625e-123.039388648839946e-12
20459.30500675691.39239123.0251136.0000001000000000000...0.0047556978598275130.05539150935563374-0.00202298877868408240.0090741354584713050.023317168711707920.0165256403374495520.037022861604745510.006356028055911276-0.0072664217241179150.00083068700659274750.006152994165094912-0.0040375591701701390.0067291268621961010.0052897878620018560.0147676951478221530.0099210007951022920.0024274317968676134-0.006473162962495159-0.00112656772184650570.0003376794693903119-0.00043733284016424885-0.0008369306695025334-5.6628101059418647e-051.2787847257689991e-122.4183715222280568e-12
21484.62067635691.39239123.0250155.0000000010000000000...0.0211453253493549820.01615765855468512-0.0170468783030684680.1318580481132251-0.2778164354230367-0.0241906740423826860.07944495941879356-0.0004386590945539316-0.00761466012988058940.00040410243918310490.009757869305531998-0.0144033721563867740.014214857975736950.0027954417342099870.005334464735945550.0079573432657536370.00017935484508958634-0.007264822324282704-0.0022400218137460575-0.00188058921908282980.0003691770043263346-0.00020626663725460684-0.00028690132324647481.9399641702967033e-123.668135703260787e-12
22447.4437773691.39239123.0251135.0000000010000000000...0.24309399320245545-0.071738916219337130.05411241512890049-0.050497315149765930.057929507127954010.0138815062673691150.077321872218790970.010898507158601758-0.0024373902803399590.001876281592168301-0.01998034860798406-0.0057203685779688720.03482787104522949-0.0015172729558490315-0.0025311624493116087-0.01813624127459842-0.005763386205230253-0.00365755274685635160.0007553014120965058-0.00084706697981857770.00105876695595803-0.0009698985614557346-0.000329666944429886941.7186967214889096e-123.2513857353921195e-12
23482.43679495691.39239123.0253125.0000000100000000000...-0.0176101174013811140.0160202188497332-0.006872411323888182-0.0073003134904732420.017210480403242910.0068127403594490370.047155024668626010.007823419563733034-0.025297843167015728-0.0191921818221705770.005471414829812336-0.0123400622746191610.017040065089713917-0.00219258691036703460.019956131287682324-0.00465708012457864960.0037511850346758145-0.00077814963871018970.00189726920406047470.00021452096818184410.0001808979250373362-0.0012996551698436234-0.000451586074928847332.4922168583208718e-124.71463192627246e-12
24490.83732915691.39239123.0252175.0000100000000000000...-0.0204825849814839440.0156666861087577350.0163487768220296480.36641609798075610.127672408259304840.144314201107442420.0104238181052136-0.0407459441243225-0.00366530892219561930.0500416805364355540.025029786093511330.00076610975728504130.012610674554399744-0.0006833254842627599-0.015388860681514478-0.004376662085654772-0.01208493276129685-0.0036616364966486235-0.004009322786396907-0.00033147504682683274-0.0005783780682036698-0.0006805180234210337-0.00029851536300068522.4203021619007773e-124.578546339029031e-12
25445.80907615691.39239123.0252193.0000000000010000000...0.03343875294842417-0.127845469903273420.0026230881172726516-0.5158485616631041-0.2011676131659857-0.16285713089487070.12959018577437680.00551670269110984650.05376172369110834-0.8220130619066143-0.19202193157178896-0.06313429842548592-0.035474411636120810.4678656717287773-0.14032754147383392-0.002113059783893901-0.2027162679440671-0.0007332734876423377-0.052817517594531224-0.008085275062305948-0.011239287771631684-0.00261510481418472450.000398020567048198231.751947901076433e-123.3146684477957535e-12
26464.56443645691.39239123.0259183.0000000000001000000...-0.0321321842072107640.014880611678249004-0.07716586488263139-0.7799031838044772-0.2582546936222958-0.346488669301199650.130214736675712430.029718319470756357-0.092151278094887270.421871128401517250.078047903381881930.014929475989215240.0242253677455478570.03781974947128430.0092145614316973390.01412626204493795-0.0394035287987289-0.0023255873897955353-0.0131354885278608290.0018024969493055315-0.0032003126822884843-0.0006973613902841031-0.00034491196801323182.687116510293818e-125.0827263700869305e-12
27431.5787757691.39239123.0252173.0000000000001000000...-0.052124918364651650.072060161987454370.088826145690428680.136754250849938590.60923744469578940.128591793625318860.16160756006364452-0.012268237471164605-0.0164792683630280430.01284417238533214-0.02170398477261736-0.0071566833427109070.0035064666051614040.0095002701415701130.014908452815547880.007426539981045274-0.004375607296477075-0.007721391962894524-0.00468673840149064-0.010082848804428142-0.0018710852371411934-0.000917031786423340.0005095989631967503-2.1994696853592317e-13-4.157364260960039e-13
28480.2333067703.219213810.0171158.0001010000000000000...0.55528868522911430.20500512384103778-0.023755563828045640.0362770825424095850.044925913110535245-0.05311905429544760.014428834776373599-0.20285467120842980.069275488752784440.011791943053149649-0.011131919601928185-0.0126824653860927810.030052817987078150.00613694759175186650.021750360329297960.033764643542197825-0.00094253795407209190.0140153682839540690.00084559516378032862.2763043735939863e-05-0.0003685432055816491-0.00033522430654752246-0.00030247604208007893.267326001856829e-126.179321407084813e-12
29506.3606662703.219213810.0172156.0001000000100000000...0.06770658583645177-0.133199393580715250.150898314027939570.0206675012802455050.09431957025998007-0.108060875882297320.172576869647465580.046040935681005370.071335533397031280.009582008027697186-0.02773460821359031-0.024345892870624590.0176370480101621170.0146722575382235340.017570610679060475-0.003909483810937624-0.00246904817970056620.008479953860906093-0.0016838850213922423-0.00157174720816444240.0005482981576839521-0.0010409522894188092-0.000175111785301027322.0748146344252363e-123.9261654119714815e-12
30459.30500675781.81035737.0251138.0000000000000000000...-0.08351096744122888-0.058171657762645136-0.100520372172578390.1072205310313986-0.308191944342654730.03199101538968283-0.1399578483415807-0.005562484460656329-0.014298927557182402-0.0120387509916178270.0217609498800269140.007223068277938191-0.23488459947627263-0.0145019680054551230.00102290795989072420.17325051590532410.012231623702061115-0.0035317418642951013-0.00131129568034405-0.00077256936848997650.0005694223848523711-0.000640468769182998-0.000177761263663223826.034568765712282e-131.13790967456444e-12
31447.4437773781.81035737.0250149.0100001000000000000...-0.1357813725183744-0.081772781080289440.009970200311767097-0.011359832416441280.0211819653585311670.075349555619759050.0402251802626992640.041810240389374150.0252806284601157850.0108714704033319230.0004030053101815712-0.0102855515295970820.014263064194462664-0.007147588121863552-0.01880817100281958-0.0068174902644333730.00151042542237458160.0027767841320013153-0.003257741892114748-0.001769597922683725-0.0008991923012059931-0.00068932140445234640.00044103607773160567-1.3112944670189758e-12-2.4823680141784053e-12
32445.7273602781.81035737.0253148.0000000001000000000...0.06790072728041403-0.0080297208726192410.036615374931086310.0166311826130226440.058899839416876560.0013138138908607680.132679499912336160.009620765955150434-0.03140974245964954-0.00340307110633785060.011765407739930657-0.0148011264309711470.00317400517772270040.000124095849253907930.0147944904691318220.0087800912809318280.0008594605673746890.00258487021443513760.0033871165507910480.00017075185119509837-0.00182531931019659363.095133484902002e-05-0.00035158087896911731.772660499379596e-123.352110719301237e-12
33450.7787366781.81035737.0250146.0000000000000000000...-0.003638029024072799-0.11547542020722211-0.03609107387294646-0.027238064152991120.033767572772974110.10252770267707685-0.15643807494926326-0.026040256507240362-0.005445341519061399-0.002014680055412852-0.0095340668909698160.0135925380580781060.007857800968097219-0.0003479866737093949-0.0030688757463173020.0019253064203066990.00292324817164219250.0031485468482475975-0.0012615645118069414-0.00039784202773263073-0.0005067905082561486-0.001397255430046544-0.000478306769303885362.981728067665911e-125.6405440510220326e-12
34518.60185665781.81035737.0251126.0000000000000000000...-0.021742751330194876-0.006020465252159525-0.105391945813948530.11714125982819298-0.33535931387512430.04019172661121704-0.14611206328676687-0.010784120400604483-0.03041665061287483-0.0196710722130442640.0033262713557511373-0.0042746148152625210.00166667446036020650.00218033297936912760.0252489961657234720.0090240142640638280.0059328263267512290.00014356769599847656-0.0009120040748067665-0.00122268736553345470.0002973159535903176-0.0008732380777210542-0.000302241711031320161.9114314385638368e-123.6136098749638847e-12
35444.7408847753.864720115.0252153.0000000000000000000...-0.026524502108621270.003789934034533474-0.100046510838168260.122930804996265-0.29657100719262470.06434471967500789-0.17422252734227878-0.03854831238564055-0.01959413702835905-0.0123815847726532340.0106130616610716040.003984110499683759-0.003553949856702025-0.0012585991127231004-0.00148443109997247260.00300615128361227680.0039857472551706385-0.005339486030415107-0.0028211327616092163-0.00140577637120645630.0005125767320088865-0.00023853338645501792-0.000387465001263844531.6799499379294916e-123.1765011923811527e-12
36418.54468005753.864720115.0259162.0000001000000000000...0.054384971676622450.057553229754142920.0225756519122570780.112651659272291980.10348351908616876-0.032587137958860820.014387260932349343-0.007606952390871741-0.046071447392222280.018603924464602486-0.00589882965041769150.0036126184507982440.006382354549672731-0.00430153731941940350.0009753274111995013-0.01722344382639465-0.005901543267261479-0.0060992972363081030.0039085455921209880.00176989030500295140.0014397258753260716-0.00066561998489420360.0008116278921446069-3.604961459466794e-12-6.822056345090545e-12
37484.60224753.864720115.0250172.0000000000001000000...0.095659961147132890.0184265241771550370.101005094376896640.39899341775824880.175306937989382240.016449919350388340.174891232950889820.011079841100071958-0.0253397829517574630.04375162030637533-0.006976129178177235-0.004957515470485162-0.0028007063956856223-0.0010006173346658385-0.003203563231958601-0.019021954407382895-0.011609251907446473-0.005175014875860072-0.0012149430712480173-0.00148494978395365480.0003928148847265786-0.00085912234139126980.0005501469511352014-2.0524533374065905e-12-3.882879665273521e-12
38453.0102116753.864720115.0250136.0000010000000000000...-0.01952648122465593-0.130401279436238050.04673641529669254-0.0197352165249880320.0203598706223152570.067269493820260820.012594586961702680.024716215036692870.004055080495576593-0.0056034693799946215-0.0171274557053665430.0054975514410533470.004656163586320719-0.000450345007286134370.001449745554371230.0096173721757656550.00020132002634350673-0.0012775989556691898-0.0010448675129645516-0.002675387623734372-0.0010156498869533723-0.0010869724770980718-0.00047864777623816063.007957086622681e-125.690670620583858e-12
39457.34268235753.864720115.0250145.0000000100000000000...0.03840486473636607-0.147647772264890230.0203452583319015530.10448969817739893-0.271142192173726540.0222272003467088340.050468336671940620.00343860541417855340.009048760253702843-0.0069403835551185514-0.015660975870212014-0.0045359698667607420.01209814676152562-0.003222679205852549-0.0011936468669929041-0.00220373931616923760.004189881795994113-0.00425144788088973-0.0014879142640804746-0.0010050774826267986-0.0003276436904897629-0.0015423033065821135-0.00045576773150420462.8292528130214537e-125.35145585319745e-12
40384.113366753.864720115.0250124.0010000000000000000...-0.03165028817492944-0.01350111247552693-0.097991546201321640.08632875855240227-0.342113864567998750.03486980305273868-0.15350452755317626-0.031852562207265483-0.017831713189734297-0.0189976174123669860.0026623370238096217-0.0082134365830818980.0080944232627565070.00577940606019535650.0209331245014424540.0087728387310851560.0060412172190524670.0013756712873552023-0.001912096003305062-0.0035182083354326030.0008871557117846341-3.071829124732866e-05-0.00023563752496741471.6174998927943266e-123.057485284141336e-12
41424.1239538753.864720115.0250184.0000000000000000000...-0.338324166827806970.03448935438262712-0.20946882212108692-1.0107502729953230.12405116866561595-0.16402274083742469-0.1751624007360347-0.054947486209678695-0.11411841291794540.42343142504387010.097923538234182140.019292252796438210.0431989139212774140.03697186712022234-0.0070003017425773920.01805802082251868-0.04248688222039378-0.00032855109355968605-0.016824978857039763-0.010439243381161357-0.005824524698664188-0.0010626662479118030.0007604785976352747-6.232493600188191e-13-1.1799306895211144e-12
42442.27302135753.864720115.0252138.0001000000001000000...-0.04028905428402547-0.055042564445626460.056763021516428530.0061308115382461940.04967869286224057-0.045256096943000860.186787359047821870.0716032829504075-0.027324073197432942-0.021220214396666288-0.008455851085534111-0.011101137539877714-0.00708484262864790550.0059698164787962140.0310664921316107930.0076357880360929760.0064293242288307640.0064553831539779350.001826633006510948-0.004139809531107559-0.00021379309867442084-0.0008314143418062295-0.000219582007493718981.3508035055976522e-122.555303654527762e-12
43450.59161785753.864720115.02501211.0000000000100001000...0.0986571200444837-0.161661973938361180.15455598326771763-0.00127698830859207740.0569553799587511140.023106334965826886-0.001530629768904715-0.03908999193154349-0.17068846551890487-0.014975440120428422-0.00085525595193884810.0176218909657116370.016611957175719814-0.0038256805756238742-0.0074044249392692560.010171604809257682-0.00128523268026283420.025575896147203875-0.0015708307456747180.0025806280315542347-0.000710824781880378-0.0009496321959895315-0.000207411075590962321.6993987901804056e-123.2142930106670455e-12
44523.57632325767.59909474.0250139.0100000100000000000...0.27961668973600240.0178723661687143240.055577719237815730.0152194779048527560.0444842731227525-0.026879653912774190.06643336379572565-0.121059286791923580.055205600527103110.008347677809937252-0.008324850339237366-0.0119749968511986740.02793221931832582-0.0038725924967825897-0.0050302701025753020.027244511134724123-0.00130360785155286250.02654244917007796-0.0005083822466163484-0.005495509463069274-0.0013634721459708703-0.0013531422435382572-9.074075059450296e-052.9703222608113636e-125.620233908565296e-12
45441.1832625767.59909474.0254146.0000000000010000000...0.361357701689258240.032451616613904410.070367243087026440.109591437156510710.1363144216211305-0.2783291778791942-0.13006399761184080.9213390419463517-0.041524698172269954-0.007210859553791961-0.009402680875742048-0.0268999853635262280.064265286662475690.0035608756307808910.00177081299154073330.0476945382031438-0.0055705130832315690.01464542770204279-0.0031201274172463446-0.0066235938875582690.0013546306530644885-0.0012057654262263681-5.244000541331257e-052.6828282738612033e-125.0715825064772555e-12
46479.52518475767.59909474.0250148.0000000000000100000...-0.017305581956371042-0.146470649136757170.009790101114025434-0.034356305071354470.0581626242206306350.020783414368487710.098360793413943410.030154402020457910.0254692327985025850.006572353427425961-0.040162094771393105-0.0141102088149561380.0029166465370105650.00373706531100687080.0061854527709936780.00270950552510130150.0051762951517776640.0050016968361239030.0006840723011423438-0.005746443822304472-0.0004219553525586483-0.0006448042419376471-0.00041741946750920762.295409010524351e-124.341097389637326e-12
47589.27915745767.59909474.0251127.0000000000000000000...-0.03163014203932511-0.13398277356283317-0.030075795615135854-0.035138395389320766-0.0069342855284618730.08215775180904546-0.15254040608335315-0.03319118680060656-0.025217939008732683-0.0038059114217203266-0.0194698742543607530.016018322666525280.009833973541302854-0.00026547618086460820.020052134109314237-0.0062732954602868285-0.0012849102262355510.0027588066488978946-0.0009190347518462126-0.0020445911457853258-9.484705723874161e-06-0.0007150959980443028-0.00025128492922673781.4648927991656949e-122.7707007990928502e-12
48462.0710837767.59909474.0250125.0010100000000000000...-0.054409308016349340.00819576773342134-0.0192358929261325-0.0031759938381610330.005845077364850579-0.029235573178972973-0.0022658637562627646-0.0323083191378244-0.021983433135659168-0.009195580278977357-0.013730229944971084-0.0027294459835393730.022681300885657710.0131593848109514880.037114141187365930.009955717818735376-0.00120553824607189590.00304489009961229730.0003751963486016154-0.00113144999490379480.0005784439594039414-0.00041223264918222144-0.000226442844481508472.03358372684822e-123.846215476410662e-12
49481.63339065767.59909474.0252156.0001000000000100000...0.0082078360441242040.11136917042007778-0.0910426418113032-0.133679950329058440.5485915764000862-0.15878171476416790.00261569919825040570.056182503957901385-0.02040567850164396-0.008237302309278795-0.01776326119570714-0.04414084000290336-0.154806907780019350.025190725567581770.04474328518769417-0.213800948759181990.0081129615183856210.0006062592696702406-0.0024789244131209138-0.012604248075779718-0.0006059718201949779-0.00163497791062909790.001100248726428038-1.3558124753019131e-11-2.5651647009550315e-11
50525.78591475691.392391218.0250122.0000000000010000000...0.0519813932020903240.0174488904578755480.044395488567644670.0182388931194372440.009512706367366303-0.094061327981690630.149803254632466740.03736213280200329-0.0151709254951497580.0003440545612937355-0.02705174877089634-0.0123261217686143430.004765212313430472-0.0052556011371390990.012197593134387964-0.015854032208286933-0.0018736136101650568-0.004640790155124635.6321177273674694e-05-0.0081193476720443690.0017813502211397089-0.000370019447972177550.0005587395121964543-2.47827937850157e-12-4.6906501824151694e-12
51428.98821145691.392391218.02501810.0100000000100000000...-0.0027007312242205415-0.079950422921141360.03640032422496761-0.76753332843243-0.26853235652504903-0.33234582711212350.213962003982340580.033755862871819024-0.06175477741740960.45597645630266480.08595508453778694-0.0111388663142434950.04712199354377810.03474566598071774-0.027246523969540170.01628211375694322-0.05106695614453096-0.00291508934723571-0.01665481322268492-0.0012918950665804876-0.004280641916562705-0.00117429790729117480.000219039274458771171.4853399847770335e-122.8088837975225757e-12
52433.75709155691.392391218.0252135.0010000000001000000...-0.03990953132812222-0.180344702701480840.13125550955070558-0.030737779783885060.038190751536463670.0046493012058470260.157171695667334440.035003118151848990.02751906174899111-0.010538126898850801-0.03620012651420055-0.0121422376026480060.0154400366231865380.009580204070995820.0138534038684345170.0021618903881899810.00114545993423655220.00019295266118503178-0.0023409397542040254-0.00323839232517343040.0006286090910252436-0.000598215235500335-0.000380290184407368862.637461785517458e-124.990716636921121e-12
53508.05662265691.392391218.0255127.0000000000100000000...-0.01123284209940479-0.149826536023794750.15917643788777341-0.023525337897264810.054915849877068455-0.033500131693366330.187636959625135070.03188039931306606-0.0145899293770132020.004373027760403334-0.018116325847368074-0.0048380315107611396-0.21634402565363772-0.00375369260905440830.0256614448771456250.182643610401522880.004925855582450378-0.002892662280251356-0.000782913154689691-0.00044171360244936370.0008012371429299684-0.00040642686963348153-0.00042208679833829643.2191839559515208e-126.08904639739498e-12
54607.15746125691.392391218.02521211.0001000010000000000...0.46071458375952720.181201339180378530.0005245105990477330.0082892114244783550.02303820026566958-0.0319188070995054040.18518227911102328-0.33624603424640503-0.0410078368065481050.019705931724566025-0.012652822935672187-0.0320369142815953440.0362916098172964760.0029366507429570630.0267994056066679230.0234907095358220380.00081952948776199150.0173489307008420360.0022214495534337323-0.002730207626149034-0.00087946753037933190.00034230990456889543-0.00039064448104968943.8559792599391565e-127.291892379934704e-12
55644.39741815691.392391218.0250144.0000000000010000000...-0.029750985537749665-0.00072236208898202040.0101637953087912980.10860920977131376-0.31038700991174517-0.053428929824568450.175217913775493260.0150953746714665330.011984746240102834-0.0009090475737689925-0.0032734746591221043-0.0198489801667457720.014927505458163348-0.0052222906940622510.005079486084035951-0.0120536634988271490.004801375453630357-0.0037554066332615875-0.006860149018670534-0.0105838065301059920.0004295484621438917-0.00016818293121613267-0.000251218852795098741.669749763890748e-123.1554902216401216e-12
56470.89351185691.392391218.0250128.0000000001000000000...-0.010633210909815213-0.153076689644364580.08111902314863059-0.0170278426043472370.0093335570075164240.0218926898058459630.119350051978462090.03306257509521846-0.0154436803731173460.003908523220214469-0.02584943694704637-0.00202556009882710970.0096313815810966180.0075585105496985830.031137716306386580.0020931293121053650.000523011437307038-0.00044137571228532370.00012599759405182692-0.00031280936369239466-0.0017016445481700191-6.656250276169038e-05-0.000370365083317154931.8711372816638475e-123.5386559430138788e-12
57499.890896691.392391218.0253125.0000000010000000000...-0.095298874139714480.00220728671648379260.016227611796461726-0.0073820955597464570.014687554740562016-0.031898821819229280.07158078443746416-0.0028160745278344628-0.034887031987989765-0.0047911189021976880.008762596087388351-0.0035265553385185272-0.20938795841256116-0.014464787643449950.019144462480851680.17015604486752710.004937252406370543-0.003630560314983866-0.000409633393602062360.00172416797864833470.001117216294716699-0.00047366628974190975-0.000262326088304581861.271082553535662e-122.402509210763725e-12
58428.98821145691.392391218.0253144.0000000000000100000...-0.041740955597168450.042856563212067995-0.0266242654273178-0.0301373657743251870.0425303324359986650.0180680316174398860.075114973149436520.0137960766512251480.014986844397549895-0.0022488928932225738-0.0021557571510919266-0.0271647264917192450.009856679315543968-0.00231249634371580950.0033072745119965673-0.00246519340657794370.0056637391038452025-0.0005397049842691007-0.000443693414576558-0.00538331879820017150.00063628694590709985.203906493135785e-05-0.0004376112029483462.1387634806436454e-124.044778864364872e-12
59457.34268235703.21921383.0251154.0001000000000100000...0.09864532002456562-0.109094452457941730.046574732708464080.0052621750381848370.08253075556839655-0.07969193312393540.04630879766827669-0.0180415939300734260.02358947992969130.015894266166497625-0.036755915304830473-0.02303519847138260.0230761995337365260.00462709499710153150.004826790644184576-0.014379242942301767-0.00033844107769392880.0024988392088716015-0.00021602500032812783-0.00263424846472168260.0007321067584511534-0.00016364614965134726-0.000124299663722095247.440458059582925e-131.407111002460425e-12
60404.57186145703.21921383.0252155.0000000001000000000...-0.034217316792613540.0120264876606296890.0118673129874623360.0099854216905120150.04276686142861310.0096425843264901220.113378296131315070.021557146371435274-0.006314217537563243-0.0046405742058572620.010385859961759294-0.0174737377030086160.015539366783208344-0.000225599626697832020.006789254812651175-0.00072399432787970180.0020136979224698580.002966297422030374-0.0004988499706203884-0.0007215473692500686-0.0011338494898884640.00013692571103253416-0.000449157920314383242.3644024326109006e-124.4726865736310226e-12
61427.09602845703.21921383.0251167.0001100000000000000...-0.064896930620420610.0011426920794433840.0162006431722926670.09147725616827460.0540164695982747260.0368884676161534560.0252505175733596270.00225802036417374-0.0223589532456527420.0154601396568331340.0114254180956322970.0043272323276388330.012317589098274559-0.0035176248047308688-0.001011045383723281-0.009057077977176446-0.0071432604896309420.0016998700234957932-0.0005937218875587087-0.0022274691719620585-0.00020992226236822402-0.0006015501149852663-0.00022007989672694721.4236896471642938e-122.692846409491011e-12
62438.3829052703.21921383.0251116.0001100000000000000...-0.149448093853247170.022877325085778413-0.02013627468355792-0.03182552689729703-0.040183435891098510.020370760656658440.06502025290758402-0.17878200455300222-0.08871324850951079-0.018023596196242227-0.0032304424004127846-0.00384955492400092070.0225280874603290960.00153890825457476260.054091347533618786-0.0178123737885309270.003975729026610965-0.00210730470530303080.001851801543115697-0.00028233015598510457-0.0007776361118991754-0.0001254271179433476-0.00048355633712716392.262567225677158e-124.279688178587747e-12
63390.59366675703.21921383.0250118.0010000000010000000...0.46563792708296440.134515936829528370.010766678600927584-0.02509533610581905-0.03478625786302601-0.087344242320202450.24056126167246675-0.34102687884546534-0.02566484557771046-0.000388618637530667-0.02718721756170613-0.041946184818682230.0454014894557717150.0041596154949817550.041971450380550130.020906280365996580.0017656339847310050.01984532667494228-0.000545187937225939-0.009373685017707831-0.00049064008141201080.0005815726095792352-0.00045315962595623854.6066157920377715e-128.71146257049864e-12
64510.65265825703.21921383.0250124.0001100000000000000...-0.01869456136852610.0438536477341517560.0010415524815251846-0.01414792892538175-0.00070379496616516870.012333875222585604-0.0028441910632645236-0.010695648326581772-0.03691709526445481-0.0122574737141927690.0031757179139722744-0.00185472872200608050.014459920480579553-0.00076483103889574780.025226245336758366-0.00164908603112582750.0048257472764621865-0.0022957431361759090.00050614283627686930.000205584035084828460.00020730734957616437-0.0003285332361746532-0.00029096499956060661.4277627778858873e-122.700104492514498e-12
65424.1239538703.21921383.0250115.0000000001000000000...0.092736789740567330.034271682980820010.045446590250574785-0.027545177106944714-0.0017261360528756022-0.057252076099365580.12601205580537114-0.032959087133170466-0.10272118036165355-0.028628258941626985-0.00316782632484359-0.0150480780252755260.019887417940693090.0055526119952398410.063623200338750120.0083752282885303980.0015276494230613094-0.0041102769317082510.00132410669970557090.0014626230981340574-0.00077145983097418180.0002723368351844217-0.000370683651739814152.1549311034397492e-124.07539326426891e-12
66442.96103005646.27878585.0254136.0000100000000000000...0.0312121832459905620.036539225030117050.024695059825216110.042348247118634150.04690036951210719-0.044100817289881654-0.062137412279957210.033097671102906914-0.011070128159978850.0070253977934089060.004970462400039580.005492608486859432-0.14769714734840197-0.00108401746243960660.0005144430765055656-0.21913357515654040.0033624316896385307-0.0163854896372924650.00280768827980707770.00049850931525677783.7222869307227294e-05-0.0010926742553728328-0.0004852309293448174-8.063339570605267e-12-1.5255907185018968e-11
67468.03205725646.27878585.0250148.0100000000000000000...-0.04605183885086779-0.09636816213798498-0.0085417631392350360.11740096061205486-0.31431426860801760.03002399247369771-0.11516045119190405-0.049523927965707640.0488408902819257650.00154492360032544570.00238550579728275850.0036685913209243190.019221153594331505-0.007889981749969683-0.027182035624656323-0.005426048075589773-0.002573056375130271-0.007066198896678493-0.004933064427136829-0.005385167496538082-0.0001969008827889368-0.00046838296645692618.045514327425333e-053.063730701587854e-145.5386714403681326e-14
68418.54468005646.27878585.0250166.0000000000000000000...-0.034922746591961750.036677921984791105-0.0288333344562172740.100166413432164740.062587040403758370.08986716860406951-0.16090620257039237-0.05275709050525462-0.0049503140805731170.024389370775127730.0122272801797446850.0077201591141650470.0157002095781657160.0052327306910088175-0.00134918931749207840.0036549812544993654-0.007766751689624858-0.00728750731799753140.00044510459744842810.0019998271800406443-0.0006712969867652162-0.0011616691000570249-0.00046628554217325243.0334783384012516e-125.738660010823281e-12
69475.2331927646.27878585.0253165.0100000001000000000...0.019551460662484046-0.2296033242205890.178212765907797830.036543237081601090.069705356952470820.096602100175722670.1082355779118758-0.0042707844780472550.13188408789510275-0.116250055049707840.8759663892574925-0.33721669380710190.0269270679806372370.038217995960566340.06756325941138212-0.0029691006120362335-0.0157606116648100760.0047507403229168180.0023983778728498585-0.008156868948248987-0.00172376579040381110.00011498429925792254-0.000275503973373488551.8032679603897309e-123.4117574512992234e-12
70519.2366424646.27878585.0251117.0000000000000000000...0.10158677840844126-0.12760836369502482-0.0013395472935929008-0.06279864476770779-0.0072117108160402490.05105783339383048-0.16238444663166146-0.07201823377604002-0.07778633888940784-0.021760241943493314-0.0156978438871188470.0151682287463437770.01224401984294899-0.00031355654525521510.0312436362920313760.011420921521840922-0.0007108271529276321-0.0057010988097086370.00074210305993072160.00037601730893243980.0005096964296207992-0.0004939668862510159-0.000356816902118718952.3217906851470063e-124.3914598815918846e-12
71466.5061422646.27878585.0252144.0001000000000000000...0.0146911205005440940.008114937585839224-0.04413376899321970.019210408190805840.06083166020551214-0.037498882526800136-0.19589136573631535-0.05855070875171493-0.01763225947975823-0.00114046244099812760.0200279156473916060.0029525771838008820.0152018470708895730.0012729783519527180.00016243771852484865-0.01129449258292261-0.00506820385658696740.00096965018812762530.00127330611389256450.00058073502033874370.0006031874555168003-0.0003273481100155727-2.074822670048853e-05-1.5134906340189631e-13-2.8731137772248894e-13
72491.2592231646.27878585.0252118.0100000000000000000...-0.03988236788822677-0.09119702733537118-0.002090161882722489-0.04392254129750606-0.043635922078575850.0569865355000596-0.16730482360127777-0.06559872130908395-0.05085460154733568-0.015094450841197668-0.0061984559273384390.0078270597731471790.01535776674659025-0.00191363779579181670.0237698989418379660.009084658069777098-0.0017053774483671914-0.00823941678857225-0.00032836118130229980.00049576930181582096.2234653411460295e-06-0.00022610831075821489.420436605776785e-062.770235517558165e-135.224575408634848e-13
73468.7501092646.27878585.0251137.0001000000000000000...0.0303937011589668870.02102633805558665-0.054864832436886090.00040234361288657230.0116904201318331190.036659839529203556-0.16361640664046753-0.07799330078971053-0.0285021147980114370.00051773713652029950.0057458415589161270.012103160984800990.0105127599255992140.00342809937193946920.0208952989139068870.007238886885976681-0.001974170716560752-0.0075919523224817640.0003297092564760397-5.3250428385112993e-050.00031161541393138825-0.0002838315388291291-0.000227284902928899061.55934502298568e-122.9495854839355786e-12
74435.52195685828.736137110.0132146.0001000000000000000...-0.27549945491936595-0.06171555363284987-0.094031553006836520.016093834334919360.0056114553831927830.11165325950436268-0.1561662699850619-0.0193394053117797240.072256149045829220.012354857984795220.0046047282246849170.0080731685274968630.00286571508015212630.0080736582131939180.034376730683940360.023443237992013880.00159067505376266380.0044285984769987345-0.0019766278338399614-0.0009645684697767241-0.001146904698469845-0.0005050103852581908-0.00056728935562086093.6310420036179343e-126.86886704989169e-12
75454.86994825828.736137110.0130125.0001000000000000000...0.1036449715300576-0.07841980304918146-0.033421174270485444-0.029575782914279175-0.00288790514329716630.05481217028838057-0.18477489869489871-0.086096273584002280.056246958956199250.009996719240214636-0.0375373845836872240.0192434599524469170.0115959043421381120.0179630669482942760.067164342746419180.016043340931493330.0011385624352092895-0.002865982415694456-0.00064007998401335740.00291900442819533960.0002975639446733942-0.00058269592640134-0.00028274586915701382.4538031416688413e-124.6415792512521245e-12
76529.23396095828.736137110.0130123.0000000000000100000...0.053251155222637910.05264784595991618-0.022613676661216240.0022532524386814870.03273323664459265-0.111141446649305250.05572806773568530.0080858782402147450.08628517088067453-0.0008272031788096675-0.030124604979576173-0.0281901756150845060.0064993615690149030.015398427592804720.054888016267879716-0.013002833775817171-0.00260533795864304740.0040881878586115205-0.00032065107966889337-0.00386825525502054470.00142598802408988260.00015359696024473734.77240623758853e-05-5.887075461651689e-13-1.1150103981561584e-12
77461.4261462727.82663497.0251158.0000000000000100000...0.277907545589897830.0258290988766427360.0087414280803144140.19262849030349424-0.2030762996657255-0.238713135908048160.09306260783724571-0.09012988009112509-0.0040110290342816340.003433878288247646-0.00735041310737886-0.034348706531498910.040379151431258540.0106652243855261030.014819413003131150.006696717084037994-0.0064733262529809580.013804072334089854-0.0022703904012670354-0.0058961381448446430.0012397915793013884-0.000130977819528717059.18061878377518e-059.21646795428798e-131.7401223986967406e-12
78475.7982482727.82663497.0253125.0000010000000000000...-0.09606816033837930.014818637557131944-0.007929049698273051-0.009358465657320299-0.0066362557183195610.0040352319658448740.01576346931948602-0.0049665331845741715-0.040654868970216314-0.0167331517699243450.0029049825476455578-0.000247843323274603460.0139475141761727750.0036517443695256240.03225534286752295-0.004194577870552283-0.0019411742352543820.00011214912613134558-0.000823181590924061-0.0029604323560159944.7573099434815186e-05-0.00028271561207615756-0.000298046276297650341.4876870656400301e-122.8134582633287265e-12
79486.2592043691.392391210.0250156.0000001000000000000...-0.0594501483396347940.04030739841027383-0.00169127277833932760.03671419087070010.0331819178281244840.0062074939626251540.042447505559537996-0.007992388675174619-0.0100952442090918040.0046575502662865340.006593889704699088-0.0082021716392058630.01683745334281065-0.0026178197745043217-0.0035950314507552823-0.010612514307167021-0.00038598521480321285-0.0010261140659795656-0.002131865646294728-5.0700333183731025e-05-0.00050621311529167-0.0012709541327111417-5.15118626409934e-066.152044239505431e-131.1634031707673952e-12
80486.87185345691.392391210.0252145.0001000000000000000...0.02539284742712384-0.1298401337345198-0.021739668029167235-0.0293794257028947640.040734028778769940.0947875269208716-0.17402856248237564-0.056976322261053994-0.0037827883534017562-0.00015271356983815145-0.0111309509953056440.0150081491495710120.01447561771494112-0.0017950570322771-0.003707043703828506-0.0049323410995224250.0011298930885831665-0.00285057523417271870.00066570952976920950.00125216249025711160.00042043336714058844-0.0009253179432638593-0.000351512044605148572.00380199421265e-123.790315747120786e-12
81415.95588695691.392391210.0252144.0000001000000000000...-0.178315604843053030.6705744188432026-0.200630858556488540.22407409516596258-0.2754853649314031-0.17918690688135130.077022117619322760.026197174613729942-0.0049647641362632975-0.0047855697022763030.02018134210038059-0.022823900768609530.0204083781900608680.00372768523768859240.009057945447500727-0.0115581188192570190.0040457275611536685-0.004176553314727538-0.0019109718601462977-0.0063848740631934980.0009453926924564484-0.00040449149504476350.0004058507684522498-1.6761571209977017e-12-3.1753345316799085e-12
82497.5443413691.392391210.0255133.0000000100000000000...0.059867601327508580.029318197518344730.0146341058000849320.0170043885981336140.061646082062534045-0.079029811259600580.011092607055313099-0.01437100606968542-0.013296540128432012-0.0138330083967629530.002875010286828175-0.00727633750401874240.0106543474082039294.9127753192636237e-050.009768047658517338-0.015242519356134613-0.0015573754220387871-0.0049174586752209090.00065863409308713490.00127927331558527710.0007181618762836259-0.0007382892447283587-0.000154065076328708542.965287825196997e-135.613708578765963e-13
83489.53970635727.82663498.0252147.0000001000000000000...-0.00011672248256128096-0.098925222588485480.044128157264667935-0.0187451121565219770.060049667366050870.0533615141291689660.027907146615373680.0012260109447545188-0.0061451717897648990.013504326035326518-0.0154151075994543170.0065950167749912010.0144715243192520580.008086365487985720.0130611586307439590.0014811175450270514-0.0006120231045971769-0.003676767637482775-0.00065683480914680980.0002073780732470209-0.00039380686341292635-0.0007486250674861796-2.4725119741946496e-051.0827124007262924e-122.0474182541251763e-12
84427.07559925727.82663498.0250138.0000000000010000000...0.04054544516984523-0.152012685476619340.0760548457381218-0.0262632320308207530.010166342202358949-0.0058613439330447580.159782708785257660.0163610486156581070.0060448017606225430.013142323505345133-0.03591391179092696-0.0050483397989457710.0147737035830525880.0045236327521014990.0177215811554675560.0054345681908752880.004274974609789181-0.003936365438430778-0.005867725363493256-0.007128120260998166-0.00020210381845417582-0.0005801792494921887-0.00035250304423500382.8751674739836078e-125.437525893181515e-12
85444.1151116727.82663498.0256169.0000000000000100100...-0.07801507219444716-0.009253885388691565-0.006154253189147890.091302744545284320.100744181316073960.03821469544411175-0.08188077566179101-0.018401721479718386-0.0327674973973395640.0207064326973818680.0180285517259154040.0152902594863102460.0095379387494982210.006288835760620448-0.00051279149771273420.0004576358829518326-0.00054773634226231650.031436009460246020.0013993498487956072-0.001164209567914395-0.0010426244098391431-0.0016073252433940356-0.00057417591225223623.390611064571025e-126.414265415777208e-12
86466.5061422727.82663498.02521310.0000000000000100000...0.00819679343661955-0.004392874930981602-0.011434703993350316-0.0114622300642230940.0358692486359104140.01519016791914270.130800054886992480.0467979074983560850.0097508350576705860.0035537710120234003-0.007207200914095308-0.02642005399824844-0.0046464738020955160.00131825783221359990.0114116040652873630.006909895948587966-0.0001559885084432186-0.0025706674568632282-0.0006834413250363856-0.0074844337791265180.00017810524342801022-2.8017210855468475e-05-0.00030356059144777151.4991206280701933e-122.834432804876762e-12
87431.55012475727.82663498.0251155.0000000000010000000...-0.05280162042402116-0.073368963625005960.07061037125737896-0.243761910546337560.47626885898648430.0506243350640156740.150586683673968320.0017007338416884750.013062129419207435-0.012345701135585477-0.04480110384466191-0.0143800939060341630.0274076045545701630.00137986978129619330.003433191132611908-0.0104754142987875560.00192342923032504-0.0007498386921018666-0.00555612858014564-0.01821020813298125-0.000705643925117344-0.00124545301905079580.0006517038789463247-6.839924372536228e-13-1.2947277502673556e-12
88491.2592231727.82663498.02511511.0000100000000000000...-0.0025709873991726973-0.163996800995336730.03452789941192422-0.0109300463525822260.053493151948417130.093406254064162160.0077890075574823450.005351996670817552-0.0238361530383556020.014129738051261371-0.0110402327774244480.004821958287173406-0.001310801535087384-0.0012190083235995432-0.019259013014661890.00119769556478248650.0006456618008409165-0.0014159513199412134-0.00074665582882146250.0002898626964970252-0.0004573576071982203-0.0007323687678753941-0.00030612583591340081.7317201579848055e-123.274897310023771e-12
89457.13415415727.82663498.0250136.0000000000000000000...-0.02954778209463537-0.10854937181038492-0.01655960413627202-0.0269514564294125670.0158100786152451140.10750859421883031-0.17114998643962775-0.037069502401404920.0043031887847274250.002363546689378186-0.0219200569921911350.0114566034879384720.0138149553396528060.0029587015731933690.008604938531385870.000200984691722545720.0021868618301749405-0.005658896302036519-0.00070601093934563330.0013408604554760143-0.0003407717551022339-0.0013479182684668326-0.0004459303739698712.658833578741492e-125.03053201014174e-12
90365.26664425603.263487621.0251207.0010100000000000000...0.19229542830457030.03885923731091782-0.07201691159041024-0.46756908586879875-0.16095555733024028-0.20413462499998830.00791607688636934-0.0147553088728775050.04530106211837997-0.45699775049262314-0.06638664004362885-0.04068145959630820.05607170824534977-0.26257380691414650.06691436298421481-0.0112590363075207550.3396393247370937-0.001490205144476830.94139715586508250.02282223551600636-0.04898088589585995-0.0097487705276073230.0031843693428763534-3.5864260857896216e-11-6.786798854322435e-11
91448.38439795603.263487621.0250166.0001000000001000000...0.09740413272037328-0.0410702799728028460.065063182081732230.24697346364489067-0.19977990420747962-0.17694797112196830.16533979515678780.053541851820458760.008686112636440039-0.0039821425213104715-0.0074504910381996805-0.022029073795408030.0112171145337026990.0112763283222344830.0053112941508397080.0086345138944355690.00048408722161526350.006121242377405118-0.0022780554590293694-0.00157391381564664890.0007770377316698692-0.0008552956534194662-4.234430073015514e-061.267502084281246e-122.3958617504037817e-12
92443.61551785603.263487621.0252146.0000001000000000000...-0.07958149428404976-0.14635090078965010.076035111894591390.0044262105300181030.054172500777946310.022847406656935080.021425796258406477-0.0033237770361135870.0204904897455217980.012458650801435605-0.0050308134768172940.01289093362904089-0.21591747021885668-0.01726998120302917-0.0235416233930786260.172784332313546560.004816395470931019-0.004709984317687976-0.002137700833203490.002687897283344667-0.00022841252709713015-0.0014711398806327549-0.000232476831347850111.7903477399406556e-123.385153732071643e-12
93468.15210195603.263487621.0253166.0001000000000100000...0.2930597656110591-0.053015914184610970.04427856941898740.043462404705550080.093968570263604240.0298209302939698470.091381923303420260.0125866771979608950.0337592342507086540.03400143087722589-0.041687115577648294-0.0137088172549028590.025383501876692820.008955710253941837-0.000589820624467597-0.007185658117597725-0.004892012223601566-0.00221490472265202740.00021346013275763904-0.00264065000604119230.0011671974458028732-0.0007317555688187872-0.00053750781472002513.427329956387026e-126.483453126893067e-12
94479.52518475603.263487621.0250157.0001000010000000000...-0.0209681482438284040.102975812585742470.031817207630675186-0.207341736505045370.4979255470693680.0366314157678323950.08822714519493655-0.0062830363360482045-0.017048022755928163-0.012142944952637982-0.00980323456725125-0.0129925808290118780.025496519918573170.0056083483602392890.0135614813424353560.016778614297061095-0.0033066376835062003-0.010759648900916172-0.001708177858003797-0.012154076220523363-0.00048718969853247575-0.00061270478117831120.0007205856906141126-1.021451664482343e-12-1.9322871999461598e-12
95464.56443645603.263487621.0250165.0001000010000000010...-0.033765196092351810.0193935945953323080.0287990645463782820.082736114751994150.07290692895150927-0.022274217048898740.1644330439778120.0125214718742818750.01635518782562264-0.097196018062519120.3215221927108870.92668596706666460.0537789925011642540.0157414949790750730.013104794738495752-0.0032389010819291607-0.0093032752025009290.019910203687903014-0.00132566800905546220.004903649342337187-0.005155974111508614-0.00336110077914925130.004015472841624888-1.831022624311e-11-3.4650518102286104e-11
96480.2333067603.263487621.0253137.0001100000000000000...-0.037018527383185850.00252854506057802270.051237559198572040.0294465402762519620.02905584761511141-0.0277772606491747780.019469089709004173-0.030684965844874585-0.01716035715097257-0.000109766775592088130.0075178297183537570.00430384938853193250.024031631472570543-0.0017748883169115960.012054181464628095-0.0031989844049226395-0.00897511098863969-0.007499254564152446-0.00012452669332775853-0.0039710396374716470.0006126194486591168-0.0007022969504712454-0.000226546171297587841.6239600030188642e-123.0722373725810427e-12
97416.3602296603.263487621.0251146.0000000010000000000...0.003659645872171321-0.11089876435226050.060627589040711756-0.0301298326802462640.036724458386945420.051606130414952270.079310816468188050.0194581291130452340.0271841092924109270.0030288405770601753-0.016927425891387363-0.00312848971091522330.014046454863173564-0.009502224742826134-0.02341807001042025-5.229081143893227e-050.0013015961603376088-0.004387738382194295-0.002023603764252411-0.00018474157013696548-2.8982084277439117e-05-0.0009021886937620327-0.000442429865567753742.4194001056932693e-124.5768116155530545e-12
98423.1570224603.263487621.0252184.0000100000000000000...0.064064105691201040.0317927426432336-0.12410842166020304-0.7735709291609583-0.26130524113072073-0.3872803363881008-0.0295292643917860130.005595048566616991-0.076627335556008090.44157714988767030.113558718648210930.010699429512191530.0533693093377630.02788190307729485-0.034682513078227310.0016707130668811919-0.046064570416347840.004519604380332425-0.012224658962785760.000472180949301555-0.004368994548437792-0.0017869858286736172-0.000164162050186775341.986246592635765e-123.756426189294103e-12
99457.13415415603.263487621.0252143.0001001000000000000...-0.0474147044673538940.044349648712309696-0.0029018680595119823-0.0136403261527842530.0222365494997013860.0455445038844910640.0239444701763225530.004034011584863306-0.008041097390678391-0.005872560246083870.00246216864154759180.001424740857437639-0.001625920018573836-0.0026329810995889195-0.0026689259419935447-0.00190930070947928050.005889133320923832-0.007814446442867372-0.00326728916765029860.00080712294560560930.00041803975155164745-5.066179192061553e-06-7.502750996637078e-051.3998733604755255e-132.638310872770545e-13
100433.75709155603.263487621.0252195.0001100000000000000...-0.352125959141171230.6663957844391095-0.27322541967410147-0.4037969384904917-0.23810548341801-0.208635891450610680.0238779436461673860.0205548174517121740.02681149207107368-0.8262805937212061-0.14595655503534863-0.06528501249308948-0.0282938574361453340.4808101829722664-0.113553718452688330.0072013306166490215-0.20255786123491606-0.003939946415383466-0.04834939270325894-0.006792792213135571-0.010593134503787382-0.00273743051827700370.00059332973600251916.074467405659749e-131.149955594381623e-12

We can verify the Gauss-Markov assumptions with our PCA model.

africa_pca.corr(
    columns =
        [
            "student_score",
            "col1",
            "col2",
            "col3",
            "col4",
            "col5",
            "col6",
            "col7",
        ],
)

Let’s use a cross-validation to test our linear regression model.

cross_validate(
    LinearRegression(),
    input_relation = africa_pca,
    X = africa_pca.get_columns(exclude_columns = ["student_score"]),
    y = "student_score",
)
explained_variancemax_errormedian_absolute_errormean_absolute_errormean_squared_errorroot_mean_squared_errorr2r2_adjaicbictime
1-fold0.4050283580653491309.597551380710741.77027452956106451.3584095094675155938.2066044710965.939628756894860.40498414205508280.385008089471515165042.12605485765466306.15590230962.4776298999786377
2-fold0.40432552897486995350.265471903439240.68906722979076651.1556832709801554646.016163464566.161167389534530.40430449232475040.384302124805749364893.0507886657466157.043418208142.244778871536255
3-fold0.3884946697531727320.5343414611903742.6078598447205252.1468998192970150581.97984189018566.904130875441110.38846208845837340.3679779155665394764587.8182818649765852.33131520732.1981658935546875
avg0.39928285226446397326.7991215817800741.6890672013574551.5536641999148953722.06753660858566.334975673956830.39925024094606890.37909604328126864840.9983751294666105.176878575022.30685822168986
std0.00763379126451608317.183432764928810.78544562612261510.427567427057281242282.18492996640730.41249086775379660.00763342022566175850.007866984574286298189.08724347349425188.86819463103790.12224406463642548

As you can see, we’ve created a much more accurate model here than in our first attempt. This example emphasizes the importance of filtering noise from the data.

Conclusion

We’ve seen two techniques that can help us create powerful linear regression models. While the first method normalized the data and looked for correlations, the second method applied a PCA model. The second one allows us to confirm the Gauss-Markov assumptions - an essential part of using linear models.