(Round all intermediato calculations to at loast 4 doclmal places.) Professor Or
ID: 3227505 • Letter: #
Question
(Round all intermediato calculations to at loast 4 doclmal places.) Professor Orley Ashenfelter of Princeton University is a pioneer in the field of wine economics. He claims that, contrary to old orthodoxy, the quality of wine can be explained mostly in terms of weather conditions. Wine romantics accuse him of undermining the whole wine-tasting culture. In an interesting co-authored paper that appeared in Chance magazine in 1995, he ran a multiple regression model where quality, measured by the prices that wines fetch at auctions, is used as the response variable y, The explanatory variables used in the analysis were the average temperature in Celsius x1, the amount of winter rain x2. the amount of harvest rain x3, and the years sinoe vintage x4. The data are shown in the accompanying table. Price Tem Winter Rain Harvest Rain Mintage 1.4448 17.12 160 31 1.8870 16.73 1.5621 17.15 1.2473 16,13 130 420 110 1.1972 16.42 187 25 1.9309 17.48 24 1.1491 16,42 2.7183 17.33 23 1.3924 16.30 697 21 1.1829 15.72 17.27 402 19 1.1118 15.37 18 16.53 819 1.2105 16.23 118 16 1.1107 16.20 610 15 16.55 1.1241 244 14 1.4978 16.67 1.3126 16.77 13 112 12 1.1063 14,98 11 1.1688 17.07 10 1.1174 16.30 574 1.3512 16.95 1.2879 17.65 418 247 1.1129 15,58 1.3100 15.82 51 16.17 1.1457 16.00 74 SOURCE: http:/www.liquidasset com Click here for the Excel Data File a-1. Use the above data to estimate a linear model, y s Bo Bxi B2x2 Baxa Bax4 MacBookExplanation / Answer
I am using R software to solve this problem.
First we need to load the data into R environment as below:
Price <- c(1.4448,1.8870,1.5621,1.2473,1.1972,1.9309,1.1491,2.7183,1.3924,
1.1829,1.3580,1.1118,1.6048,1.2105,1.1107,1.1241,1.4978,1.3126,
1.1063,1.1688,1.1174,1.3512,1.2879,1.1129,1.3100,1.2386,1.1457)
Temp <- c(17.12,16.73,17.15,16.13,16.42,17.48,16.42,17.33,16.30,15.72,17.27,
15.37,16.53,16.23,16.20,16.55,16.67,16.77,14.98,17.07,16.30,16.95,
17.65,15.58,15.82,16.17,16.00)
WinterRain <- c(600,690,502,420,582,485,763,830,697,608,402,602,819,
714,610,575,622,551,536,376,574,572,418,821,763,717,578)
HarvestRain <- c(160,80,130,110,187,187,290,38,52,155,96,267,86,118,292,244,
89,112,158,123,184,171,247,87,51,122,74)
Vintage <- c(31,30,28,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,
9,8,7,6,5,4,3)
#Create an input data frame
InputData <- data.frame(Price,Temp,WinterRain,HarvestRain,Vintage)
#Fit linear model
fit <- lm(Price ~ ., data = InputData)
#Print summary
summary(fit)
Call:
lm(formula = Price ~ ., data = InputData)
Residuals:
Min 1Q Median 3Q Max
-0.26561 -0.12005 -0.02391 0.02859 0.62916
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4.2173746 1.2893015 -3.271 0.003494 **
Temp 0.3022981 0.0726825 4.159 0.000409 ***
WinterRain 0.0010306 0.0003682 2.799 0.010463 *
HarvestRain -0.0015504 0.0006167 -2.514 0.019748 *
Vintage 0.0123267 0.0054725 2.252 0.034605 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2188 on 22 degrees of freedom
Multiple R-squared: 0.6692, Adjusted R-squared: 0.609
F-statistic: 11.12 on 4 and 22 DF, p-value: 4.344e-05
a1) So the linear model is as below:
y = -4.2173746 + 0.3022981 * x1 + 0.0010306 * x2 - 0.0015504 * x3 + 0.0123267 * x4
a2) Create a data frame for new data:
NewData <- data.frame(Temp=16,WinterRain=600,HarvestRain=120,Vintage=20)
#Use predict() function to predict the price as below:
predict(fit,NewData)
= 1.298255
b1) #Fit exponential model
fit1 <- lm(log(Price) ~ ., data = InputData)
#Print summary
summary(fit1)
Call:
lm(formula = log(Price) ~ ., data = InputData)
Residuals:
Min 1Q Median 3Q Max
-0.14074 -0.08771 -0.01073 0.03410 0.26783
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.1716354 0.6928978 -4.577 0.000147 ***
Temp 0.1903118 0.0390611 4.872 7.18e-05 ***
WinterRain 0.0005638 0.0001979 2.849 0.009340 **
HarvestRain -0.0010352 0.0003314 -3.124 0.004944 **
Vintage 0.0080514 0.0029411 2.738 0.012018 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.1176 on 22 degrees of freedom
Multiple R-squared: 0.7356, Adjusted R-squared: 0.6875
F-statistic: 15.3 on 4 and 22 DF, p-value: 4.017e-06
So the exponential model equation is as below:
log(y) = -3.1716354 + 0.1903118 * x1 + 0.0005638 * x2 - -0.0010352 * x3 + 0.0080514 * x4
b2) Predicting on new data
predict(fit1,NewData)
= 0.2484051
c) R^2 for the linear model is 0.6692. And R^2 for the exponential model is 0.7356.
So based on R^2 value exponential model is performing better.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.