Series: Wiley Series in Probability and Statistics
Hardcover: 672 pages
Publisher: Wiley; 2 edition (May 4, 2015)
Author: Douglas Montgomery
Language: English
ISBN-10: 1118745116
ISBN-13: 978-1118745113
Example 3.13
We repeat Example 3.12 with the model expanded to include Population as well.
复制代码
As concluded in the example, adding the input variable Population seems to resolve the autocorrelation issue resulting in large p-value for the test for autocorrelation.
Example 4.2 The US CPI data are in the second column of the array called cpi.data in which the first column is the month of the year. For this case we use the firstsmooth function twice to obtain the double exponential smoothing as
复制代码
Note that the fitted values are obtained using Eq. (4.23). Also the corresponding command using Holt–Winters function is
The average speed data are in the second column of the array called speed.data in which the first column is the index for the week.
To find the “best” smoothing constant, we will use the firstsmooth function for various lambda values and obtain the sum of squared one-step-ahead prediction error (SSE) for each. The lambda value that minimizes the sum of squared prediction errors is deemed the “best” lambda. The obvious option is to apply firstsmooth function in a for loop to obtain SSE for various lambda values. Even though in this case this may not be an issue, in many cases for loops can slow down the computations in R and are to be avoided if possible. We will do that using sapply function.
Example 4.5
We will first try to find the best lambda for the CPI data using first-order exponential smoothing.We will also plot ACF of the data. Note that we will use the data up to December 2003.
Example 4.7 The clothing sales data are in the second column of the array called closales.data in which the first column is the month of the year. We will use the data up to December 2002 to fit the model and make forecasts for the coming year (2003). We will use Holt–Winters function given in stats package. The model is additive seasonal model with all parameters equal to 0.2.
Example 4.8 The liquor store sales data are in the second column of the array called liqsales.data in which the first column is the month of the year. We will first fit additive and multiplicative seasonal models to the entire data to see the difference in the fits. Then we will use the data up to December 2003 to fit the multiplicative model and make forecasts for the coming year (2004). We will once again use Holt–Winters function given in stats package. In all cases we set all parameters to 0.2.
Example 5.1
The loan applications data are in the second column of the
array called loan.data in which the first column is the number of weeks.
We first plot the data as well as the ACF and PACF.
Example 6.2 The data for this example are in the array called vistemp. data of which the two columns represent the viscosity and the temperature respectively. Below we first start with the prewhitening step.