1
$\begingroup$

I have created a regression model that is centered around my dependent variable R.

I have a set of categorical variables and their interactions (days of week and shift [DAY/ NIGHT])

I have a set of independent variables that i have standardized so that their effect can be compared. Y

Q1: I would like to know if this is correct or if i should have standardized my dependent variable also?

Q2: when interpreting the coefficients for my independent variables is the coef an increase in R for 1 standard deviation of Y from 0? or from the mean of Y?

p.shape
xx=pd.get_dummies(data=p[['y1', 'y2', 'y3', 'Day','Shift', 'Terminal']]
                  ,columns=['Day','Shift','Terminal']).drop(columns=['Day_Monday','Shift_Day','Terminal_L'])
xx['Intercept']=1
y = p['R']

from statsmodels.formula.api import ols
from statsmodels.regression.linear_model import OLS
# ols('R~Day_Friday+Day_Tuesday+Day_Wednesday+Day_Thursday+Day_Saturday+Day_Sunday+1',
#     data=pd.get_dummies(data=p,columns=['Day'])).fit().summary()
# xx.columns
xx.columns
xx['Shift_Nightx'+'Terminal_Tx']=xx['Shift_Night']*xx['Terminal_T']


for c in ['Day_Friday', 'Day_Saturday', 'Day_Sunday', 'Day_Thursday','Day_Tuesday', 'Day_Wednesday']:
    xx['Shift_Nightx'+c]=xx['Shift_Night']*xx[c]
for c in ['Day_Friday', 'Day_Saturday', 'Day_Sunday', 'Day_Thursday','Day_Tuesday', 'Day_Wednesday']:
    xx['Terminal_Tx'+c]=xx['Terminal_T']*xx[c]
for c in ['Day_Friday', 'Day_Saturday', 'Day_Sunday', 'Day_Thursday','Day_Tuesday', 'Day_Wednesday']:
    xx['Shift_Nightx'+'Terminal_Tx'+c]=xx['Shift_Night']*xx['Terminal_T']*xx[c]
 
    
OLS(y,xx).fit().summary()
```
$\endgroup$
1
  • $\begingroup$ Could you explain in a bit more detail what do you mean by "a regression model that is centered around my dependent variable R"? $\endgroup$
    – Adrià Luz
    Sep 20 '21 at 12:55
1
$\begingroup$

Q1: I would like to know if this is correct or if i should have standardized my dependent variable also?

No, you don't need to standardize your dependent variable. Standardizing your independent variables will be enough - as you say, it will allow you to compare the magnitude of your regression coefficients.

Q2: when interpreting the coefficients for my independent variables is the coef an increase in R for 1 standard deviation of Y from 0? or from the mean of Y?

Both. You have standardized your independent variables $y_1$, $y_2$, and $y_3$ i.e. for each of them, you have subtracted the mean and divided by the standard deviation. This means that your standardized variables will have mean 0, so 1 standard deviation from 0 and 1 standard deviation from the mean are equivalent statements in this case.

$\endgroup$
3
  • $\begingroup$ i have added in my code above to help, R is just my dependent variable that i am creating the regression for $\endgroup$
    – LScrub
    Sep 20 '21 at 13:18
  • $\begingroup$ @LScrub Just edited to answer your second question. Let me know if you have any further questions. $\endgroup$
    – Adrià Luz
    Sep 20 '21 at 14:01
  • $\begingroup$ Thankyou, appreciate the help $\endgroup$
    – LScrub
    Sep 20 '21 at 15:18

Your Answer

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

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