set verbose off open housing.gdt # create list of all variables ("dataset") besides price list X = dataset - price # run OLS ols price const X # predicted effect of central AC (the 10th coefficient) AC_effect = $coeff[10] printf "Predicted effect of AC on price: %g euro\n", AC_effect # 95% CI for the above se = $stderr[10] lo = AC_effect - 2*se hi = AC_effect + 2*se printf "95 percent CI: %g to %g euro\n", lo, hi # log-price version logs price ols l_price const X # the AC effect is now (approximately) a percentage AC_effect = $coeff[10] printf "AC is predicted to add %g percent to price\n", 100*AC_effect # focus on bedrooms as a factor in price ols price const bedrooms # The bedrooms coefficient here is much larger than in Model 1. # Why? Because we're not controlling for a bunch of other features # that are correlated with number of bedrooms