In: Statistics and Probability
The table below lists weights (carats) and prices (dollars) of randomly selected diamonds. Find the (a) explained variation, (b) unexplained variation, and (c) indicated prediction interval. There is sufficient evidence to support a claim of a linear correlation, so it is reasonable to use the regression equation when making predictions. For the prediction interval, use a 95% confidence level with a diamond that weighs 0.8 carats.
Weight Price
0.3 520
0.4 1171
0.5 1336
0.5 1425
1.0 5671
0.7 2278
> weight = c(0.3,.4,.4,.5,1,.7) > price = c(520,1171,1336,1425,5671,2278) > cor(weight,price) [1] 0.9656554 # we see that there is high positive correlation between weight and price > mod = lm(price~weight) > summary(mod) Call: lm(formula = price ~ weight) Residuals: 1 2 3 4 5 6 181.8 141.3 306.3 -296.1 492.7 -826.0 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1736.1 556.8 -3.118 0.03560 * weight 6914.5 930.2 7.433 0.00175 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 538.4 on 4 degrees of freedom Multiple R-squared: 0.9325, Adjusted R-squared: 0.9156 F-statistic: 55.25 on 1 and 4 DF, p-value: 0.001749 Since R-squared: 0.9325, so the explained variation is 93.25% and unexplained variation is 1- 0.9325 = 0.0675, i,e 6.7% > df1 = data.frame(weight = 0.8) > predict(mod,df1, interval = "confidence") fit lwr upr 1 3795.453 2907.004 4683.902 |
|
|