Answer To: ESYE501 Optional Final Problem Set Problem 1: Below is the USD/TRY conversion rates for April and...
Pooja answered on May 23 2020
1)
a)
> x <- c(2,3,4,5,6,9,10,11,12,13,16,17,18,19,20,23,24,25,26,27,30,31,32,33,34,37,38,39,40,41,44,45,46,47,48,51)
>
> y <- c(3.9735, 3.9887,3.9991, 4.0515, 4.0449, 4.0737, 4.1121, 4.136, 4.1102, 4.0969, 4.0963, 4.0963, 4.0086, 4.0403, 4.0766,
+ 4.1079, 4.086, 4.0809, 4.0664, 4.0422, 4.0617, 4.103, 4.1771, 4.2131, 4.226, 4.2669,
+ 4.3327, 4.2876, 4.2352, 4.3136, 4.3674, 4.445, 4.4139, 4.4606, 4.4917, 4.5774)
>
> z <- data.frame(x)
> z$y <- y
> z
x y
1 2 3.9735
2 3 3.9887
3 4 3.9991
4 5 4.0515
5 6 4.0449
6 9 4.0737
7 10 4.1121
8 11 4.1360
9 12 4.1102
10 13 4.0969
11 16 4.0963
12 17 4.0963
13 18 4.0086
14 19 4.0403
15 20 4.0766
16 23 4.1079
17 24 4.0860
18 25 4.0809
19 26 4.0664
20 27 4.0422
21 30 4.0617
22 31 4.1030
23 32 4.1771
24 33 4.2131
25 34 4.2260
26 37 4.2669
27 38 4.3327
28 39 4.2876
29 40 4.2352
30 41 4.3136
31 44 4.3674
32 45 4.4450
33 46 4.4139
34 47 4.4606
35 48 4.4917
36 51 4.5774
>
b)
> library(Publish)
> library(dplyr)
> plot(x, y,
+ xlab="day",
+ ylab="price", main="Scatter Plot")
There is a fluctuating trend from day 2 corresponding to 02-Apr-18 till day 30 corresponding to 30-Apr-18. After day 30 which corresponds to date 30-Apr-18, there is a continuous rising trend in the price till day 51 corresponding to date 21-May-18.
c)
> model <- lm(y ~ x, data=z)
> summary(model)
Call:
lm(formula = y ~ x, data = z)
Residuals:
Min 1Q Median 3Q Max
-0.152626 -0.059618 ...