3.2 Aplicación del CDP a Redes Reales
3.2.3 DNS (Modelo Jerarquizado) [157][158]
Step 1. Hypothesize the form of the model for E(y). Step 2. Collect the sample data.
Step 3. Use the sample data to estimate unknown parameters in the model. Step 4. Specify the probability distribution of the random error term, and
estimate any unknown parameters of this distribution. Also, check the validity of each assumption made about the probability distribution. Step 5. Statistically check the usefulness of the model.
Step 6. When satisfied that the model is useful, use it for prediction, estimation, and so on.
In this chapter, since we are dealing only with the straight-line model, we concentrate on steps 2–6. In Chapters 4 and 5, we discuss how to build more complex models.
3.2 Exercises
3.1 Graphing lines. In each case, graph the line that passes through the points.
(a) (0, 2) and (2, 6) (b) (0, 4) and (2, 6) (c) (0,−2) and (−1, −6) (d) (0, −4) and (3, −7) 3.2 Finding β0 and β1. The equation for a straight
line (deterministic) is
y= β0+ β1x
If the line passes through the point (0, 1), then
x= 0, y = 1 must satisfy the equation. That is,
1= β0+ β1(0)
Similarly, if the line passes through the point (2, 3), then x= 2, y = 3 must satisfy the equation:
Use these two equations to solve for β0and β1, and
find the equation of the line that passes through the points (0, 1) and (2, 3).
3.3 Finding the equation for a line. Find the equations of the lines passing through the four sets of points given in Exercise 3.1.
3.4 Graphing lines. Plot the following lines:
(a) y= 3 + 2x (b) y = 1 + x (c) y =−2+3x (d) y= 5x (e) y= 4 − 2x
3.5 Findingβ0andβ1. Give the slope and y-intercept for each of the lines defined in Exercise 3.4.
3.3 Fitting the Model: The Method of Least Squares
Suppose an appliance store conducts a 5-month experiment to determine the effect of advertising on sales revenue. The results are shown in Table 3.1. (The number of measurements is small, and the measurements themselves are unrealistically simple to avoid arithmetic confusion in this initial example.) The straight-line model is hypothesized to relate sales revenue y to advertising expenditure x. That is,
y = β0+ β1x+ ε
The question is this: How can we best use the information in the sample of five observations in Table 3.1 to estimate the unknown y-intercept β0and slope β1?
ADSALES
Table 3.1 Appliance store data
Month Advertising Expenditure x, hundreds of dollars Sales Revenue y, thousands of dollars 1 1 1 2 2 1 3 3 2 4 4 2 5 5 4
To gain some information on the approximate values of these parameters, it is helpful to plot the sample data. Such a graph, called a scatterplot, locates each of the five data points on a graph, as in Figure 3.2. Note that the scatterplot suggests a general tendency for y to increase as x increases. If you place a ruler on the scatterplot, you will see that a line may be drawn through three of the five points, as shown in Figure 3.3. To obtain the equation of this visually fitted line, notice that the line intersects the y-axis at y= −1, so the y-intercept is −1. Also, y increases exactly 1 unit for every 1-unit increase in x, indicating that the slope is+1. Therefore, the equation is
˜y = −1 + 1(x) = −1 + x
where ˜y is used to denote the predictor of y based on the visually fitted model. One way to decide quantitatively how well a straight line fits a set of data is to determine the extent to which the data points deviate from the line. For example, to evaluate the visually fitted model in Figure 3.3, we calculate the magnitude of
Figure 3.2 Scatterplot for data in Table 3.1 Figure 3.3 Visual straight-line fit to data in Table 3.1 error of prediction = y − y = 2−3 = −1 (or residual) ∼ y 4 3 2 1 0 1 2 3 4 5 x y = ∼ −1 + x
the deviations (i.e., the differences between the observed and the predicted values of y). These deviations or errors of prediction, are the vertical distances between observed and predicted values of y (see Figure 3.3). The observed and predicted values of y, their differences, and their squared differences are shown in Table 3.2. Note that the sum of the errors (SE) equals 0 and the sum of squares of the errors (SSE), which gives greater emphasis to large deviations of the points from the line, is equal to 2.
By shifting the ruler around the graph, we can find many lines for which the sum of the errors is equal to 0, but it can be shown that there is one (and only one) line for which the SSE is a minimum. This line is called the least squares line, regression line, or least squares prediction equation.
To find the least squares line for a set of data, assume that we have a sample of n data points that can be identified by corresponding values of x and y, say,
Table 3.2 Comparing observed and predicted values for the visual model Prediction Error of prediction Squared error
x y ˜y = −1 + x (y− ˜y) (y− ˜y)2
1 1 0 (1− 0) = 1 1
2 1 1 (1− 1) = 0 0
3 2 2 (2− 2) = 0 0
4 2 3 (2− 3) = −1 1
5 4 4 (4− 4) = 0 0
Sum of errors (SE)= 0 Sum of squared errors (SSE) = 2
are (1, 1), (2, 1), (3, 2), (4, 2), and (5, 4). The straight-line model for the response y in terms of x is
y = β0+ β1x+ ε
The line of means is
E(y)= β0+ β1x
and the fitted line, which we hope to find, is represented as ˆy= ˆβ0+ ˆβ1x
The ‘‘hats’’ can be read as ‘‘estimator of.’’ Thus, ˆy is an estimator of the mean value of y, E(y), and a predictor of some future value of y; and ˆβ0 and ˆβ1are estimators
of β0and β1, respectively.
For a given data point, say, (xi, yi), the observed value of y is yiand the predicted value of y is obtained by substituting xiinto the prediction equation:
ˆyi = ˆβ0+ ˆβ1xi
The deviation of the ith value of y from its predicted value, called the ith residual, is
(yi− ˆyi)= [yi− ( ˆβ0+ ˆβ1xi)]
Then the sum of squares of the deviations of the y-values about their predicted values (i.e., the sum of squares of residuals) for all of the n data points is
SSE= n
i=1
[yi− ( ˆβ0+ ˆβ1xi)]2
The quantities ˆβ0 and ˆβ1 that make the SSE a minimum are called the least
squares estimates of the population parameters β0 and β1, and the prediction
equation ˆy= ˆβ0+ ˆβ1xis called the least squares line.
Definition 3.1 The least squares line is one that satisfies the following two properties:
1. SE=(yi− ˆyi)= 0; i.e., the sum of the residuals is 0.
2. SSE=(yi− ˆyi)2; i.e., the sum of squared errors is smaller than for any other straight-line model with SE= 0.
The values of ˆβ0 and ˆβ1 that minimize the SSE are given by the formulas in
the box.∗