Download presentation
Presentation is loading. Please wait.
Published byJeffery Flowers Modified over 7 years ago
1
business analytics II ▌assignment three - solutions pet food
Managerial Economics & Decision Sciences Department Developed for business analytics II week 3 ▌assignment three - solutions week 4 pet food soap sales dvd resales week 3 © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II
2
► statistics & econometrics
session three inference, confidence and prediction intervals Developed for business analytics II learning objectives ► statistics & econometrics definition of confidence and prediction intervals differences between confidence and prediction intervals ► generate confidence and prediction intervals klincom and kpredint commands readings ► (MSN) Chapter 3 ► (CS) Pet Food Soap Sales DVD Resales © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II
3
Pet Food: Visualize Data and Regression
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Visualize Data and Regression Figure 1. Graphical relation: price and sqfoot ► First step in analyzing (a two-dimensional data problem) is to visualize the relation between the variables. To find the parameters of the linear fit (intercept and slope) we should run the regression of WeeklySales_hundredsofdollars on ShelfSpace_sqft. Remark. The linear regression provides estimates b0 and b1 of true parameters 0 and 1 assumed to reflect the relation between mean of WeeklySales_hundredsofdollars and ShelfSpace_sqft at population level. rename WeeklySales_hundredsofdollars wsales rename ShelfSpace_sqft sspace regress wsales sspace Figure 2. Results for linear regression of wsales on sspace wsales | Coef. Std. Err t P>|t| [95% Conf. Interval] sspace | _cons | ► The estimated parameters are b0 1.45 and b1 These values are stored by STATA as _b[_cons] and _b[sspace] respectively; these can be referred as such in subsequent calculations. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 1
4
Est.E[wsales] 1.45 0.074 sspace
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Interpret the Linear Regression ► The estimated regression line is: Est.E[wsales] 1.45 sspace regress wsales sspace generate wsaleshat _b[_cons] _b[sspace]*sspace twoway (scatter wsales sspace) (connected wsaleshat sspace, sort msymbol(i)) Figure 3. Linear regression graphical representation In the first step we perform the regression which provides the estimates for the linear coefficients. We generate then the fitted values of wsales for each available observation of sspace. We usually call this fitted value as varnamehat and its calculation is fairly intuitive: use the estimated coefficients and “plug” the values for sspace. Add msymbol(i) as an option to the connected graph in order to remove the markers along the line. Est. E[wsales] 1.45 0.074·sspace © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 2
5
Est.E[ wsales | sspace 8 ] 1.45 0.074·8 2.042 (in hundreds)
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Prediction ► For sspace = 8 the average wsales according to the estimated regression is: Est.E[ wsales | sspace 8 ] 1.45 0.074·8 (in hundreds) Figure 4. Prediction: graphical representation Use display _b[_cons] _b[sspace]*8 to get the result. predicted average wsales for sspace = 8 Remark. Graphically, the predicted price lies on the fitted line corresponding to the estimated regression. Why? Whenever you “plug” values for independent variables into the regression equation you basically pick points on the regression line. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 3
6
► For the confidence interval we use the klincom command:
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Intervals ► For the confidence interval we use the klincom command: klincom _b[_cons] _b[sspace]*8, level(90) ► The confidence interval says that with 90% confidence the average weekly sales of pet food for stores with 8 square feet of shelf space for pet food will be between $ and $ (in hundreds) ► The prediction interval says that with 90% confidence the weekly sales of pet food in any individual store with 8 square feet of self space for pet food will be between $ and $ (in hundreds) Figure 5. Results for klincom command wsales | Coef. Std. Err. t P>|t| [90% Conf. Interval] (1) | ► For the prediction interval we use the kpredint command: kpredint _b[_cons] _b[sspace]*8, level(90) Figure 6. Results for kpredint command Estimate: 2.042 Standard Error of Individual Prediction: Individual Prediction Interval (90%): [ , ] t-ratio: Remark. The key difference is that the confidence interval is about the average over stores of weekly sales of pet food for stores having 8 square feet of shelf space while the prediction interval is about the weekly sales of pet food for an individual store having 8 square feet of shelf space. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 4
7
Pet Food: Intervals generate estwsales _b[_cons] _b[sspace]*sspace
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Intervals generate estwsales _b[_cons] _b[sspace]*sspace This command will generate a new variable estwsales by calculating for each value of sspace in the sample the corresponding value from the expression _b[_cons] _b[sspace]*sspace generate tval invttail(10,0.025) This command will generate a new variable tval by calculating for each value of sspace in the sample the corresponding value from the expression invttail(10,0.025). predict CIstderror, stdp (for confidence interval) predict PIstderror, stdf (for prediction interval) This command will generate new variables CIstderror and PIstderror by calculating for each value of sspace in the sample the standard error of mean for _b[_cons] _b[sspace]*sspace. As such, the command generates n observations (sample size) and after this command you should have two extra columns in the data sets for CIstderror and PIstderror. Since you have different values for sspace in the sample set, and therefore different estimates for the dependent variable, you will have different standard error for each value of sspace. generate lbCI estwsales – tval*CIstderror generate ubCI estwsales tval*Cistderror generate lbPI estwsales – tval*PIstderror generate ubPI estwsales tval*PIstderror These commands will generate new variables lbCI, ubCI and lbPI, ubPI by calculating for each value of sspace in the sample the corresponding value from the expressions in the above commands. These bounds will be different for different values of sspace. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 5
8
Pet Food: Intervals Figure 7. Confidence and prediction intervals
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Pet Food: Intervals Figure 7. Confidence and prediction intervals This is where you find the intervals (confidence and prediction) for Shelf Space = 8 sqft ubPI = 2.63 ubCI = 2.24 lbCI = 1.83 lbPI = 1.44 8 © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 6
9
Soap Sales: Estimated Regression
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Soap Sales: Estimated Regression ► The regression table provides the following information: regress Sales Price Figure 8. Results for linear regression of Sales on Price Sales | Coef. Std.Err. t P>|t| [95% Conf. Interval] Price | _cons | ► The estimated regression is thus: Est. E[Sales] ·Price ► We can use this equation to determine how the change in Price affects the change in estimated mean Sales: Change in Est. E[Sales] ·Change in Price ► A decrease in Price by $0.50 means a change in Price 0.50 implying a change in estimated mean Sales: Change in Est. E[Sales] ·( 0.50) That is an increase in estimated mean Sales by $0.14651,000 $146.5. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 7
10
Soap Sales: Confidence Interval
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Soap Sales: Confidence Interval ► Notice that we are asked to provide a confidence interval for the change in estimated mean Sales when the Price decreases by $0.50. We saw that: Change in Est. E[Sales] b1·Change in Price ► Since the change in price is fixed (as 0.50) the uncertainty about the true change in mean Sales is related to the uncertainty about the true value of the parameter 1. In other words, if we are given that the true parameter 1 is in the interval lower bound for 1 1 upper bound for 1 then, if Change in Price is positive: (lower bound for 1)Change in Price Change in E[Sales] (upper bound for 1)Change in Price and if Change in Price is negative: (upper bound for 1)Change in Price Change in E[Sales] (lower bound for 1)Change in Price ► Since the change in price is 0.50 and the lower ad upper bound are given in the regression table ( and respectively) we get the 95% interval for the change in true mean Sales as (in thousands): ( )(0.50) Change in E[Sales] ( )(0.50) that is $ Change in E[Sales] $ © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 8
11
Soap Sales: Hypothesis Testing
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Soap Sales: Hypothesis Testing ► The claim is that a decrease of $0.50 in Price will result in an increase true mean Sales per store by at least $160. Thus we set up first the null/alternative hypotheses (notice the symbol delta for Change) hypothesis H0: E[Sales] | Price 0.50 0.160 Ha: E[Sales] | Price 0.50 0.160 set hypotheses ► To get the test remember that (notice how the equality holds for change in true mean of Sales and the true regression parameter 1): E[Sales] 1Price ► We can recast the above hypotheses in terms of true parameter 1 and provide the hypothesis H0: 1Price 0.160 Ha: 1Price 0.160 H0: 1 0.320 Ha: 1 0.320 set hypotheses for Price 0.50: test calculate decision calculate (right tail) pvalue Pr[ T ttest ] reject the null hypothesis if pvalue © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 9
12
H0: E[Sales] | Price 0.50 0.160
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ Soap Sales: Hypothesis Testing and Prediction Figure 9. Results for linear regression of Sales on Price Sales | Coef. Std.Err. t P>|t| [95% Conf. Interval] Price | _cons | ► We calculate the ttest as ► The (right tail) pvalue Pr[ T ttest ] ttail(923,0.438) ► We cannot reject the stated null H0: E[Sales] | Price 0.50 for 5% (in fact we cannot reject the null for any choice of up to about 34%.) Remark. Given that the calculated ttest is fairly close to zero, “flipping” the null and alternative will lead you to calculate the left tail pvalue 0.667, again concluding that you cannot reject the null which in this flipped case would be H0: E[Sales] | Price 0.50 0.160 ► For Price $9.99 the estimated mean Sales per store is found based on the estimated regression as Est. E[Sales | Price 9.99] ·9.99 (thousands) ► For 2000 stores the estimated mean sales in dollars is simply 2000· ·1,000 $5,805, © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 10
13
Est. E[ DVDs|Gross 36 ] 26.535 8.0831·36 $317.530 (thousands)
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ DVD Resales: Hypothesis Testing and Prediction ► The regression table provides the following information: Figure 10. Results for linear regression of DVDs on Gross DVDs | Coef. Std.Err. t P>|t| [95% Conf. Interval] Gross | _cons | ► The estimated regression equation (in thousands): Est. E[DVDs] ·Gross with estimated mean resales of DVDs for Gross 36: Est. E[ DVDs|Gross 36 ] ·36 $ (thousands) ► The prediction interval has the form: Est. E[ DVDs|Gross 36 ] std.errDVDs·tdf,/2 DVDs|Gross 36 Est. E[ DVDs|Gross 36 ] std.errDVDs·tdf,/2 ► With tdf,/2 invttail(28,0.025) and std.errDVDs thousands we get: · DVDs|Gross 36 ·49.841 that is $ DVDs|Gross 36 $ © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 11
14
DVD Resales: Confidence Interval
Managerial Economics & Decision Sciences Department assignment three - solutions inference, confidence and prediction intervals Developed for business analytics II pet food ◄ soap sales ◄ dvd resales ◄ DVD Resales: Confidence Interval ► The regression table provides the following information: Figure 11. Results for linear regression of DVDs on Gross DVDs | Coef. Std.Err. t P>|t| [95% Conf. Interval] Gross | _cons | ► The key here is to recognize that when Gross 0, the only remaining part of the regression equation is b0 since the term b1·Gross “drops out” for Gross 0. Thus, estimated mean DVD sales, given that Gross 0 become: Est. E[ DVDs|Gross 0 ] b0 ► This implies that, whenever Gross 0, the uncertainty about the true mean DVDs comes from the uncertainty about the true parameter 0. The confidence interval for true mean DVDs, when Gross 0, coincides with the confidence interval for the constant (in thousands): [ , ]. © 2016 kellogg school of management | managerial economics and decision sciences department | business analytics II assignment three | page 12
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.