Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interval Estimation of mean response

Similar presentations


Presentation on theme: "Interval Estimation of mean response "β€” Presentation transcript:

1 Interval Estimation of mean response 𝑬 𝒀 𝒉 , 𝒐𝒓 𝒀 𝒉
and single response 𝒀 𝒉 (new) when 𝑋= 𝑋 β„Ž A common objective in regression analysis is to estimate the mean of response variable Y for a given independent variable X. Let Xh denote the level of X that we are interested. The mean response is denoted by E(Yh) or Yh hat, and the single response is denoted by Yh-hat (new)

2 Mean response vs. single response
π‘Œ 1 for a given 𝑋 1 = mean + random error π‘Œ 2 for a given 𝑋 2 = mean + random error The mean interval single Y Β±π’Žπ’‚π’“π’ˆπ’Šπ’ 𝒆𝒓𝒓𝒐𝒓 is larger than The mean interval πΒ±π’Žπ’‚π’“π’ˆπ’Šπ’ 𝒆𝒓𝒓𝒐𝒓 𝑋 1 𝑋 2 Here is a picture displaying both mean response and the single response variables. Recall that in topic1 when talk about two ingredients in regression model, we referred to regression model as a β€œsubsampling model” because the data set of response variable Y consists of many subsamples (or slices), one subsample per each given value of X. The mean of Y are linearly related to X, while single Y randomly varies around its mean. The mean value of Yh, or E(Yh) given X=Xh, is expected to be on the line, and can be estimated with a linear function b0+b1Xh. The actual value of a single response variable Y is the value scattering around the mean, and can be represented as mean + random error. The variance of the single response variable is then variance of the mean + the variance of the random error. [B] As a result, the confidence interval of the single response should be larger than of the mean response. Predict the mean response of Y on X Predict the single response of Y on X 𝑬 𝒀 𝒉 π‘œπ‘Ÿ πœ‡ 𝒉 Predict in the same manner, Same value; But different precision. 𝒀 𝒉

3 The best estimates of Ξ²1 and Ξ²0 given the data (X, Y ) are:
Recall again from topic 1 that, the formula of parameter beta1 estimator b1 is a linear combination of Y. So b1 follows normal distribution. Similarly, b0 is a linear combination of Y and also follows normal distribution. As a result, the estimate of Y when X=Xh, denoted by Yh-hat, is bo+b1Xh is a linear combination of Y. Question1: Does Yh_hat follow normal distribution? Quesiton2: are b0 and b1 independent two independent variables? Recall that The best estimates of Ξ²1 and Ξ²0 given the data (X, Y ) are: 𝑏 1 = Ξ£(π‘‹βˆ’ 𝑋 )(π‘Œβˆ’ π‘Œ ) Ξ£ π‘‹βˆ’ 𝑋 2 = SS XY SS X 𝐸 𝑏 1 = 𝛽 1 π‘Žπ‘›π‘‘ π‘‰π‘Žπ‘Ÿ 𝑏 1 = 𝜎 2 1 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 = 𝛴 𝑐 𝑖 π‘Œ 𝑖 𝑏 0 = π‘Œ βˆ’ 𝑏 1 𝑋 = Ξ£ Y i n βˆ’π›΄ 𝑐 𝑖 𝑋 π‘Œ 𝑖 =Ξ£ 𝑑 𝑖 π‘Œ 𝑖 𝐸 𝑏 0 = 𝛽 0 π‘Žπ‘›π‘‘ π‘‰π‘Žπ‘Ÿ 𝑏 0 = 𝜎 2 [ 1 𝑛 + 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 ] Hence, π‘Œ β„Ž = 𝑏 0 + 𝑏 1 𝑋 β„Ž is a linear combination of the observations π‘Œ 𝑖 Question1: Does π‘Œ β„Ž follow normal distribution? Question2: are 𝑏 0 π‘Žπ‘›π‘‘ 𝑏 1 independent?

4 The best estimates of Ξ²1 and Ξ²0 given the data (X, Y ) are:
Since Yh-hat is linear combination of some independent and Normal variables Yi. Yh_hat follows normal distribution. For question2, because b0 and b1 are each based on the linear combination of the same Yi, they are not independent. In fact, one can derive bo from b1, or vise versa. Recall that The best estimates of Ξ²1 and Ξ²0 given the data (X, Y ) are: 𝑏 1 = Ξ£(π‘‹βˆ’ 𝑋 )(π‘Œβˆ’ π‘Œ ) Ξ£ π‘‹βˆ’ 𝑋 2 = SS XY SS X 𝐸 𝑏 1 = 𝛽 1 π‘Žπ‘›π‘‘ π‘‰π‘Žπ‘Ÿ 𝑏 1 = 𝜎 2 1 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 = 𝛴 𝑐 𝑖 π‘Œ 𝑖 𝑏 0 = π‘Œ βˆ’ 𝑏 1 𝑋 = Ξ£ Y i n βˆ’π›΄ 𝑐 𝑖 𝑋 π‘Œ 𝑖 =Ξ£ 𝑑 𝑖 π‘Œ 𝑖 𝐸 𝑏 0 = 𝛽 0 π‘Žπ‘›π‘‘ π‘‰π‘Žπ‘Ÿ 𝑏 0 = 𝜎 2 [ 1 𝑛 + 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 ] Hence, π‘Œ β„Ž = 𝑏 0 + 𝑏 1 𝑋 β„Ž is a linear combination of the observations π‘Œ 𝑖 Question1: Does π‘Œ β„Ž follow normal distribution? Yes Question2: are 𝑏 0 π‘Žπ‘›π‘‘ 𝑏 1 independent? No

5 Prediction of the mean response
The mean estimate, defined by E(Yh) or Yh_hat, can be obtained from the linear function, b0+b1Xh. This estimate is an unbiased estimator of E{Yh}. The variability of the sampling distribution of Yh-hat is affected by how far Xh is from X-bar, through the term (Xh-Xbar)^2. The further from Xbar is Xh, the greater is the quality (Xh-Xbar)^2 and the larger is the variance of this estimation Yh hat. An intuitive explanation of this effect can be found in the picture with two sample regression lines, based on two samples for the same set of X values. The two regression lines are assumed to go though the same (Xhar, Ybar) point. Note that at X1, near Xbar, the fitted values yhat1 for the two sample regression lines are close to each other. At a far away point X2, the fitted values Yhat2 differ substantially. Thus, the variation in the Yhat valules from sample to sample will be greater when Xh is far from the mean than near the mean. Prediction of the mean response π‘Œ β„Ž = 𝑏 0 + 𝑏 1 𝑋 β„Ž For normal error (πœ€) regression model, π‘Œ β„Ž ~ π‘π‘œπ‘Ÿπ‘šπ‘Žπ‘™, with mean and variance: 𝐸 π‘Œ β„Ž =𝐸 π‘Œ β„Ž = πœ‡ β„Ž 𝜎 2 π‘Œ β„Ž = 𝜎 2 [ 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 ] = 𝛽 0 + 𝛽 1 𝑋 β„Ž π‘Œ β„Ž is normal because b0 + b1Xh is a linear combination of independent, normal Yi’s. Its variance is affected by how far 𝑋 β„Ž is from 𝑋 , through the term 𝑋 β„Ž βˆ’ 𝑋 2 . Estimation is more precise near XΒ― . π‘Œ 2 π‘Œ 1 𝑋 1 𝑋 𝑋 2

6 Prediction of the mean response
When replacing sigma^2 with MSE, the t statistic follows t(n-2 ) distribution. All inferences concerning the mean response estimate, E(Yh) are carried out the usual fashion with the t distribution. Thus, we are using the T method to study the mean response estimate. Prediction of the mean response π‘Œ β„Ž = 𝑏 0 + 𝑏 1 𝑋 β„Ž For normal error (πœ€) regression model, π‘Œ β„Ž ~ π‘π‘œπ‘Ÿπ‘šπ‘Žπ‘™, with mean and variance: 𝐸 π‘Œ β„Ž =𝐸 π‘Œ β„Ž = πœ‡ β„Ž 𝜎 2 π‘Œ β„Ž = 𝜎 2 [ 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 ] When replace 𝜎 2 with MSE, 𝑠 2 π‘Œ β„Ž =𝑀𝑆𝐸 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 = s 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 Therefore, it follows that π‘Œ β„Ž βˆ’πΈ π‘Œ β„Ž 𝑠 π‘Œ ~ 𝑑 π‘›βˆ’2

7 Prediction confidence interval of mean response, 𝑬 𝒀 𝒉
The confidence interval in the form of estimate plus or minus margin error, or t times standard error of the estimate Where the standard error can be computed with the equation given. s of yh-hat is the standard error of the mean response at Xh, and s is the standard error of the residuals. Prediction confidence interval of mean response, 𝑬 𝒀 𝒉 π‘Œ β„Ž βˆ’πΈ π‘Œ β„Ž 𝑠 π‘Œ β„Ž ~ 𝑑 π‘›βˆ’2 The confidence interval of 𝐸 π‘Œ β„Ž π‘Œ β„Ž ±𝑑 1βˆ’ 𝛼 2 ;π‘›βˆ’2 𝑠{ π‘Œ β„Ž } π‘€β„Žπ‘’π‘Ÿπ‘’ 𝑠 π‘Œ β„Ž =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 𝑠{ π‘Œ β„Ž } is the β€œstandard error of the mean response value at 𝑋= 𝑋 β„Ž ” 𝑠 is the β€œstandard error of the residuals”

8 Prediction of single response 𝒀 𝒉 π’π’†π’˜
The confidence interval of the estimated mean response E(Yh), given Xh, gives a upper and lower bound of the mean response. The single response Yh is based on the mean, and predicted as mean+a random error. The prediction of single response value is denoted as Yh hat (new). As shown in the picture, from the mean corresponding to the upper and lower limit of the confidence interval, there comes two probability distribution of Y, corresponding to lowest and highest possible value of mean. Any distribution between the left and right normal distribution is possible. The variance of the means is denoted by sigma^2 of the Yh hat. Suppose we now locate a distribution by fixing the mean, a single value still varies within that whole distribution. It could be here, here, here, etc, this part of variation is denoted by sigma^2. We say that the variance of predicting a single value comes from the variance in predicting the mean or predicting one distritbution, and then the variance of predicting a single value which that distribution. Prediction of single response 𝒀 𝒉 π’π’†π’˜ π‘Œ β„Ž βˆ’π‘‘ 𝑠{ π‘Œ β„Ž } π‘Œ β„Ž +𝑑 𝑠{ π‘Œ β„Ž } 𝜎 2 Y β„Ž 𝑛𝑒𝑀 = 𝜎 2 π‘Œ β„Ž + 𝜎 2 The variance of prediction = variance in possible location of the distribution + variance within the distribution

9 We estimate the prediction variance Οƒ2
The variance of predicting the single value can be estimated using the sample standard error, denoted by s{pred} The test statistic has a t distribution. We estimate the prediction variance Οƒ2 as: {Yh(new)} 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 𝑠 2 =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 For normal error regression model Yh(new) βˆ’ YΛ†h ∼ t (n-2) s{pred} 𝑠{π‘π‘Ÿπ‘’π‘‘} is the β€œstandard error for predicting one new response value at 𝑋 β„Ž .”

10 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 2 + 𝑠 2 =𝑠 2 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 +1
The prediction interval of single response is sensitive if the error terms is not normal, meaning we cannot use the t method when the random error or the response variable Y is not normally distributed. Predictions are more precise near mean Xbar because the variance decreases with the deviation, Xh and Xbar. Prediction made near X=Xbar is more reliable because Xh-Xbar is smaller and the standard error is smaller. That is why that confidence interval are not always the same width for all Xh levels. It should be the narrowest when Xh is near the Xbar, and wider further apart. Prediction interval of single response 𝒀 𝒉 π’π’†π’˜ π‘Œ β„Ž ±𝑑 1βˆ’ 𝛼 2 ;π‘›βˆ’2 𝑠{π‘π‘Ÿπ‘’π‘‘} 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 𝑠 2 =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 More sensitive to departure of normal in error terms distribution. Predictions are more precise near XΒ― because Οƒ2 decreases with |Xh βˆ’ XΒ― |. {YΛ†h}

11 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›} is the β€œstandard error for predicting the mean of m
Occasionally, we would like to predict the mean of m new observations on Y for a given Xh value. The notation, Yh bar new, is easily confused with the previous two, Yh hat for the mean response prediction and Yh hat for the single response response. s{predmean} is the standard error for predicting the mean of m new response values. Predicting the mean of m new response values is easier (less variation) than predicting a single value, but harder (more variation) than predicting the mean response. Similar with the single response, the standard error of the mean of m responses consist of the variance between the distribution (color coded in purple), and the variance within a distribution (color coded by green). Prediction interval of mean of π’Ž new response 𝒀 𝒉{π’π’†π’˜ } not π‘Œ β„Ž , π‘œπ‘Ÿ π‘Œ β„Ž {𝑛𝑒𝑀} π‘Œ β„Ž ±𝑑 1βˆ’ 𝛼 2 ;π‘›βˆ’2 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›} Where: 𝑠 2 π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘› = 𝑀𝑆𝐸 π‘š + 𝑠 2 π‘Œ β„Ž =𝑀𝑆𝐸[ 1 π‘š + 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 ] Predict the mean of π‘š new observations on Y for a given level of the predictor variables. The variance 𝑠 2 π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘› has two components: variance between the distribution and variance within a distribution. 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›} is the β€œstandard error for predicting the mean of m new response value.”

12 The Diamond example, if 𝑋 β„Ž =0.43 , compute
1. The confidence interval for the mean predicted value 𝐸 π‘Œ β„Ž Where 𝑠 π‘Œ β„Ž =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 YΛ†h Β± 𝑑 𝑐 𝑠 π‘Œ β„Ž 2. The confidence interval for the single predicted value π‘Œ β„Ž Where 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 𝑠 2 =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 YΛ†h Β± 𝑑 𝑐 𝑠 π‘π‘Ÿπ‘’π‘‘ Now let’s see how to compute three prediction confidence interval by hand and by R. In the diamond ring example, at X=0.43, find the confidence interval for the mean predicted value, single predicted value and the mean predicted value of three diamond rings with the same weight. 3. The confidence interval for the mean price π‘Œ β„Ž 𝑛𝑒𝑀 of three diamonds with the same weight (0.43) Where: 𝑠 2 π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘› = 𝑀𝑆𝐸 π‘š + 𝑠 2 π‘Œ β„Ž =𝑀𝑆𝐸[ 1 π‘š + 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 ] π‘Œ β„Ž Β± 𝑑 𝑐 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›}

13 Recall that in the Diamond example
The lm output Recall that in the diamond example, the lm output gives a residual standard error to be 31.84, and degree of freedom of 46. Compute MSE to be the squared of the residual standard error, or The sample mean of the weight is computed as 0.204, sample standard deviation is , and the sample size is 48. 𝑴𝑺𝑬= 𝒔 𝟐 = πŸ‘πŸ.πŸ–πŸ’ 𝟐 =πŸπŸŽπŸπŸ‘.πŸ– 𝑋 =0.204, 𝑠 𝑋 =0.0568, n=48

14 Recall that in the diamond example
Where 𝛼=0.05, 𝑛=48, 𝑑𝑓=46 π‘Ÿπ‘œπ‘’π‘›π‘‘ π‘‘π‘œπ‘€π‘› π‘‘π‘œ 40 Also recall that in the diamond example, in order to estimate the parameter beta1, we have found the t value both using t table and R. When using the t table, we round down the df to 40 from 46, and get the value of 2.021, at 95% confidence level. In general, the notation of the t value is t(1-alpha over 2 and n-2), in the case of 95% level, alpha is 5%, and the t value is denoted by t(0.975, 46). And the estimation is using the t able or using R. The qt function in R gives the exact value, where qt mean to the quantile value in a t distribution. Both values are Okay to use. 𝑑 1βˆ’ 𝛼 2 , π‘›βˆ’2 =𝑑 0.975, 46 Or use R = (estimation using the t table) = (exact value using R)

15 The Diamond example, if 𝑋 β„Ž =0.43 , compute
1. The confidence interval for the mean predicted value 𝐸 π‘Œ β„Ž Where 𝑠 π‘Œ β„Ž =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 2 YΛ†h Β± 𝑑 𝑐 𝑠 π‘Œ β„Ž 𝑆 𝑆 𝑋 = 𝑠 𝑋 2 π‘›βˆ’1 = βˆ’1 =0.152 𝑑 1βˆ’ 𝛼 2 , π‘›βˆ’2 =𝑑 0.975, 46 = estimation from Tβˆ’table or (exact value from R) 2.021 Now we are ready to make prediction on the average price of a diamond ring of 0.43 carat. The confidence interval for the mean prediction is Yh hat plus or minus t times standard error. The sum of squares of x, or SSx is 0.152, the t value is using the t table, or using R. The variance of mean prediction is computed with the formula as , then take the square root to get the standard error to be Last, we have the confidence interval, and conclude that we are 95% confidence to predict the average price of a 0.43 carat diamond ring is at least dollar and at most dollar. In R, the ci.reg function compute all three kinds of predicting confidence intervals. The first parameter is the regression model, the second parameter, β€œnew” is a data frame specify the Xh value , or 0.43 in example, type of m specify this is a prediction for the mean response value E(Yh hat), and alpha is the significant level or 0.05. To compute the different confidence intervals, we can change the β€œtype” in the ci.reg function, shown next. 𝑠 π‘Œ β„Ž =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 = βˆ’ =362.14 𝑠 π‘Œ β„Ž = =19.03 YΛ†h Β± 𝑑 𝑐 𝑠 π‘Œ β„Ž = Β± =1302.1,

16 The Diamond example, if 𝑋 β„Ž =0.43 , compute
2. The confidence interval for the single predicted value π‘Œ β„Ž Where 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 𝑠 2 =𝑠 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 YΛ†h Β± 𝑑 𝑐 𝑠 π‘π‘Ÿπ‘’π‘‘ Next let’s predict the price of a single diamond ring of 0.43 carat. The confidence interval is similar, except we have a larger standard error for single value prediction. The variance of single value prediction, s^2 pred = , hence the standard error is , and the price of the (next) diamond ring of 0.43 carat is at least and at most dollar. The ci.reg function sets the type of n for single value prediction. 𝑠 π‘π‘Ÿπ‘’π‘‘ 2 = 𝑠 π‘Œ β„Ž 𝑠 2 = = YΛ†h Β± 𝑑 𝑐 𝑠 π‘π‘Ÿπ‘’π‘‘ = Β± = ,

17 The Diamond example, if 𝑋 β„Ž =0.43 , compute
3. The confidence interval for the mean price π‘Œ β„Ž 𝑛𝑒𝑀 of three diamonds with the same weight (0.43) Where: 𝑠 2 π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘› = 𝑀𝑆𝐸 π‘š + 𝑠 2 π‘Œ β„Ž =𝑀𝑆𝐸[ 1 π‘š + 1 𝑛 + 𝑋 β„Ž βˆ’ 𝑋 2 Ξ£ 𝑋 𝑖 βˆ’ 𝑋 ] π‘Œ β„Ž Β± 𝑑 𝑐 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›} The last example in this topic is to make prediction of the mean of next three diamonds, all has the weight of 0.43 carat. The variance of the mean of 3 prediction can be calculated as as shown here. The standard error is 26.46, this is value that is smaller than single value prediction but bigger than the mean prediction. The average mean of 3 diamond ring is at least 1287 and at most 1394 dollars. And to compute this in R, set the ci.reg function with type = nm, and m=3. 𝑠 2 π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘› = 𝑀𝑆𝐸 π‘š + 𝑠 2 π‘Œ β„Ž = π‘Œ β„Ž Β± 𝑑 𝑐 𝑠{π‘π‘Ÿπ‘’π‘‘π‘šπ‘’π‘Žπ‘›}= Β± =( , ) =


Download ppt "Interval Estimation of mean response "

Similar presentations


Ads by Google