I'm doing a liner regression fit using R. I used
lm() to do the regression. Then I standardize my data using
scale() and again do the regression on standardize data using
Surprisingly the regression coefficient of one variable was positive before standardization and after standardization I found it is showing negative coefficient. I checked the correlation between that variable and my predictor. It has positive significant correlation.
data_bd2=data_2[,c(1:3,5:7)] str(data_bd2) fit_bd=lm(data_bd2) vif(fit_bd) summary(fit_bd) scale_data_bd2=data.frame(scale(data_bd2)) colnames(scale_data_bd2)=colnames(data_bd2) fit_bd_std=lm(scale_data_bd2) summary(fit_bd_std)
Can you please help me understand why sign of regression coefficient differ before and after standardization?