Professional Documents
Culture Documents
Exercise - MLR - Colaboratory
Exercise - MLR - Colaboratory
ipynb - Colaboratory
# As seen in class, in order to explain the effect of the predictors (X6 to X18) on the outcome,
# we must interpret the standardized regression coefficients (i.e., the coefficients for the regression
# after standardizing all variables).
# Run the standardized regression completing the current file with your own code.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as sc
import statsmodels.graphics.gofplots as sm
# selecting predictors (independent variables; x6 thorugh x18) and target (dependent, X19; satisfaction)
# first run: Confirmatory approach, all independnent variables included
variables = hbat.iloc[:, 5:18]
target = hbat[["X19"]]
#print results
model_test.summary()
# Which predictors are the most important for predicting Customer Satisfaction (X19)?
#In order to know which ones are the most important for predicting Customer Satisfaction, we should consider the
# p-value for each coefficient. Therefore, the most important ones whould be under 0,05.
# Looking at the variables, the most important ones are (in the same order): x1,x2,x7
output
https://colab.research.google.com/drive/1ZQYrKemp4yrvormaDQTnl6n3cSvBrnu-#scrollTo=_ts4uIuOKyYB&printMode=true 1/2
6/11/23, 11:26 Exercise_MLR Marcela.ipynb - Colaboratory
Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
https://colab.research.google.com/drive/1ZQYrKemp4yrvormaDQTnl6n3cSvBrnu-#scrollTo=_ts4uIuOKyYB&printMode=true 2/2