One can do it using the GRG solver to minimize the total error (taking sign into account), but that is slow, clunky and not very accurate (I guess the minimums are very flat). For example, one might choose to make 90% of the total error to be “safe”, and allow 10% to be “unsafe”. However, I want to bias the result so that the sum of the abs(errors) in which the model underestimates the test data (“safe”) are larger than those in which it overestimates the test data (“unsafe”) by a user-selected factor. I have test data yi, for known xi, and want to fit a user-chosen curve (e.g. I have a slightly different, but related, problem. See WLS regression and heteroscedasticity. Generally, WLS regression is used to perform linear regression when the homogeneous variance assumption is not met (aka heteroscedasticity or heteroskedasticity). Until now, we haven’t explained why we would want to perform weighted least squares regression. Note that the formulas in range N19:N20, range O19:O20, and cell O14 are array formulas, and so you need to press Ctrl-Shft-Enter. The formulas used to calculate the values in all the cells in Figure 2 are the same as those in Figure 1 with the following exceptions: Cells We see from Figure 3 that the OLS regression line 12.70286 + 0.21 X and the WLS regression line 12.85626 + 0.201223 X are not very different.įigure 3 – Comparison of OLS and WLS regression lines Key formulas Figure 2 shows the WLS (weighted least squares) regression output.įigure 2 – Weighted least squares regression The right side of the figure shows the usual OLS regression, where the weights in column C are not taken into account. ExampleĮxample 1: Conduct weighted regression for that data in columns A, B, and C of Figure 1.įigure 1 – Weighted regression data + OLS regression Note too that the values of the above formulas don’t change if all the weights are multiplied by a non-zero constant. Note thatĪs for ordinary multiple regression, we make the following definitionsĪn estimate of the covariance matrix of the coefficients is given by Where 1 is the n × 1 column vector consisting of all ones. We will use definitions of SS Reg and SS T that are modified versions of the OLS values, namely Also, df Reg = k and df T = n – 1, as for OLS. The n × 1 matrix of predicted y values Y-hat = and the residuals matrix E = can be expressed asĪn estimate of the variance of the residuals is given byĪs for OLS. Where W is the n × n diagonal matrix whose diagonal consists of the weights w 1, …, w n. Using the same approach as that is employed in OLS, we find that the k+1 × 1 coefficient matrix can be expressed as In weighted least squares, for a given set of weights w 1, …, w n, we seek coefficients b 0, …, b k so as to minimize Given a set of n points ( x 11, …, x 1 k, y 1), …, ( x n1, …, x nk, y n), in ordinary least squares ( OLS) the objective is to find coefficients b 0, …, b k so as to minimize
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |