\(d\): -2, 1,-1, 3, 0,-1,-1,-2, 1, 2
\(d^2\): 4, 1, 1, 9, 0, 1, 1, 4, 1, 4
\(\sum {d^2 } = 26\)
Correlation of Spearman: \(r_s = 1 - \frac{{6\sum {d^2 } }}{{n(n^2 - 1)}} = 1 - \frac{{6*26}}{{10(100 - 1)}} = 1 - \frac{{156}}{{990}} = 0.84\)
We see that the coefficient is high b/n students’ midterm and final ranks in statistics. There is a direct relationship b/n them.
a)The value of intercept = 6,68 means that if the X (ratio of the U.S. CPI to German CPI) is 0,a dollar’d exchange on 6,68 German marks. We see in this case there is no economic sense. \(R^2\) shows how variation in index of CPI US to CPI German explain the exchange rate of the German mark to the U.S. dollar.As for the value of slope = -4,31 with an increas on 1 unit in relative prices the Y exchange rate decline on 4,31 units.
\(R^2\) shows to us that variability of values of relative prices explaine variability of values of nominale exchange only on 52,3%. there are some other unreported factors.
b)The negative value of \(X_t\) makes economic sense, i.e. prices of US increase and become bigger than German ones. So people begin to buy German good and products that strengthen German mark.
table3.6 <- read.table("C:/Users/HOME/Documents/Table3.6.txt", header=TRUE)
attach(table3.6)
plot(X1~Y1,main="Business sector", xlab= "output per hour, business sector", ylab="compensation per hour, business sector", pch =20)
plot(X2~Y2,main="Nonfarm business sector", xlab= "output per hour, nonfarm business sector", ylab="compensation per hour, nonfarm business sector", pch=20)
lm <- lm( X1~Y1)
summary(lm)
##
## Call:
## lm(formula = X1 ~ Y1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.721 -8.337 -0.158 9.852 21.288
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -109.383 9.712 -11.3 1.6e-13 ***
## Y1 2.004 0.118 17.0 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.5 on 37 degrees of freedom
## Multiple R-squared: 0.887, Adjusted R-squared: 0.884
## F-statistic: 290 on 1 and 37 DF, p-value: <2e-16
lm2 <- lm(X2~Y2)
summary(lm2)
##
## Call:
## lm(formula = X2 ~ Y2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.784 -8.399 -0.392 10.499 21.388
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -123.600 11.020 -11.2 1.8e-13 ***
## Y2 2.139 0.131 16.3 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.9 on 37 degrees of freedom
## Multiple R-squared: 0.878, Adjusted R-squared: 0.874
## F-statistic: 266 on 1 and 37 DF, p-value: <2e-16
\(\sum {Y_i } = 1110\),
\(\sum {X_i } = 1700 - (110 + 210) + (120 + 220) = 1680\),
\(\sum {X_i } Y_i = 20550 - (90*120 + 140*220) + (80*110 + 150*210) = 204200\),
\(\sum {X_i } ^2 = 322000 - (120^2 + 220^2 ) + (110^2 + 210^2 ) = 315400\),
\(\sum {Y_i } ^2 = 132100 - (90^2 + 140^2 ) + (80^2 + 150^2 ) = 133300\),
Coeff. of corr = \(\frac{{n\sum {X_i Y_i - (\sum {X_i )(} } \sum {Y_i )} }}{{\sqrt {[n\sum {X_i^2 - (\sum {X_i )^2 ][n\sum {Y_i^2 - (\sum {Y_i )^2 ]} } } } } }}=\frac{{177200}}{{182916,483}} = 0,9687 = 96,87\%\)
table3.7 <- read.table("C:/Users/HOME/Documents/Table3.7.txt", header=TRUE)
attach(table3.7)
plot(YEAR,CPI,type="l",col="green", lwd=6, main="CPI and the NYSE Index")
lines(YEAR,PRICE,col="red", lwd=6)
lines(YEAR,NYSE,col="red", lwd=6)
gold <-lm(PRICE~CPI)
summary(gold)
##
## Call:
## lm(formula = PRICE ~ CPI)
##
## Residuals:
## Min 1Q Median 3Q Max
## -149.8 -55.0 -17.3 42.0 274.6
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 186.18 125.40 1.48 0.16
## CPI 1.84 1.22 1.52 0.15
##
## Residual standard error: 105 on 13 degrees of freedom
## Multiple R-squared: 0.15, Adjusted R-squared: 0.0849
## F-statistic: 2.3 on 1 and 13 DF, p-value: 0.153
nyse<-lm(NYSE~CPI)
summary(nyse)
##
## Call:
## lm(formula = NYSE ~ CPI)
##
## Residuals:
## Min 1Q Median 3Q Max
## -34.50 -17.44 4.67 17.48 26.71
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -102.06 23.77 -4.29 0.00087 ***
## CPI 2.13 0.23 9.25 4.4e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.8 on 13 degrees of freedom
## Multiple R-squared: 0.868, Adjusted R-squared: 0.858
## F-statistic: 85.5 on 1 and 13 DF, p-value: 4.43e-07
We can see that New York Stock Exchange is better than Price of gold react to inflation.
data3.8 <- read.table("C:/Users/HOME/Documents/Table3.8.txt", header=TRUE)
attach(data3.8)
par(mfrow=c(1,2))
plot(RGDP~Year, type="l", col="blue", lwd=5, lty=7)
plot(NGDP~Year, type="l", col="blue", lwd=5, lty=7)
curr <- lm(NGDP~Year)
summary(curr)
##
## Call:
## lm(formula = NGDP ~ Year)
##
## Residuals:
## Min 1Q Median 3Q Max
## -830 -576 -123 456 1292
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.96e+05 1.83e+04 -21.6 <2e-16 ***
## Year 2.02e+02 9.27e+00 21.8 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 651 on 37 degrees of freedom
## Multiple R-squared: 0.928, Adjusted R-squared: 0.926
## F-statistic: 475 on 1 and 37 DF, p-value: <2e-16
cons <-lm(RGDP~Year)
summary(cons)
##
## Call:
## lm(formula = RGDP ~ Year)
##
## Residuals:
## Min 1Q Median 3Q Max
## -378.2 -74.5 18.5 84.8 339.6
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.50e+05 3.89e+03 -64.3 <2e-16 ***
## Year 1.29e+02 1.97e+00 65.5 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 138 on 37 degrees of freedom
## Multiple R-squared: 0.991, Adjusted R-squared: 0.991
## F-statistic: 4.29e+03 on 1 and 37 DF, p-value: <2e-16
In current-dollar GDP model:
\(\beta _1 = {\rm 396500}\),
\(\beta _2 = 202\)
Un constant-dollar GDP model:
\(\beta _1 = {\rm - 250200}\)
\(\beta _2 = 128,8\)
The slope shows the rate of change of GDP (curr. and const.) per year
we can make a conclusion that nominal GDP increses faster than real GDP. ###Ex. \(3.24\)
dataI.1 <- read.table("C:/Users/HOME/Documents/TableI.1.txt", header=TRUE)
attach(dataI.1)
## The following object is masked from data3.8:
##
## Year
mod_GDP <- lm(PCE~GDP)
summary(mod_GDP)
##
## Call:
## lm(formula = PCE ~ GDP)
##
## Residuals:
## Min 1Q Median 3Q Max
## -39.33 -8.60 1.76 14.77 31.31
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.84e+02 4.63e+01 -3.98 0.0016 **
## GDP 7.06e-01 7.83e-03 90.25 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.3 on 13 degrees of freedom
## Multiple R-squared: 0.998, Adjusted R-squared: 0.998
## F-statistic: 8.14e+03 on 1 and 13 DF, p-value: <2e-16
So, we verified the equation given in Introduction.
\(\beta _1 = - 181\),
\(\beta _2 = 0,7064\),
\(\R^2 = 99,84\%\)
data2.9 <- read.table("C:/Users/HOME/Documents/Table2.9.txt", header=TRUE)
attach(data2.9)
## The following object is masked from dataI.1:
##
## Year
##
## The following object is masked from data3.8:
##
## Year
par(mfrow=c(1,2))
plot(Fem_v~Year, xlab="Year", ylab="Female verbal score", pch=20, col="red", type="l")
plot(Mal_v~Year, xlab="Year", ylab="Male verbal score", pch=20, col="red",type="l")
fem<-lm(Fem_v~Mal_v)
summary(fem)
##
## Call:
## lm(formula = Fem_v ~ Mal_v)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.719 -2.103 0.245 1.562 6.153
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -198.1258 25.2112 -7.86 7.9e-08 ***
## Mal_v 1.4364 0.0572 25.10 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.27 on 22 degrees of freedom
## Multiple R-squared: 0.966, Adjusted R-squared: 0.965
## F-statistic: 630 on 1 and 22 DF, p-value: <2e-16
So, in our regression model (where dependent variable is femal verbal score and independent variable is male verbal score) we get next values of parameters:
\(\beta _1 = {\rm - 198}{\rm ,13}\),
\(\beta _2 = {\rm 1}{\rm ,44}\),
\(\R^2 = 96,63\%\)
As for causality we cannot establish it.
par(mfrow=c(1,2))
plot(Fem_m~Year, xlab="Year", ylab="Female math score", pch=20, col="purple", type="l")
plot(Mal_m~Year, xlab="Year", ylab="Male math score", pch=20, col="purple",type="l")
mal<-lm(Fem_m~Mal_m)
summary(mal)
##
## Call:
## lm(formula = Fem_m ~ Mal_m)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.810 -1.669 0.048 1.761 4.048
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -189.0572 40.9270 -4.62 0.00013 ***
## Mal_m 1.2854 0.0818 15.71 1.9e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.68 on 22 degrees of freedom
## Multiple R-squared: 0.918, Adjusted R-squared: 0.914
## F-statistic: 247 on 1 and 22 DF, p-value: 1.94e-13
So, in our regression model (where dependent variable is femal math score and independent variable is male math score) we get next values of parameters:
\(\beta _1 = {\rm - 189}{\rm ,057}\),
\(\beta _2 = {\rm 1}{\rm ,285}\),
\(R^2 = 91,81\%\)