-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdpdata.r
120 lines (95 loc) · 2.59 KB
/
gdpdata.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Federico Vicentini
# 01 - 05 - 2023
# Download Code RA Data
setwd(C:\Users\feder\OneDrive\Documenti Fede\Scuola\Università\MSc in
Economics\Research Assistantship\R Codes\RA-Codes)
library(fredr)
fredr_set_key("5946a6a1c79f3fe49bea4be0ef8e82e8")
gdp = fredr(
series_id = "GDP",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("2020-12-31"),
frequency = "a",
units = "pc1",
aggregation_method = "eop"
)
gdp1 = fredr(
series_id = "GDP",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("1990-12-31"),
frequency = "a",
units = "pc1",
aggregation_method = "eop"
)
gdp2 = fredr(
series_id = "GDP",
observation_start = as.Date("2011-01-01"),
observation_end = as.Date("2019-12-31"),
frequency = "a",
units = "pc1",
aggregation_method = "eop"
)
gdp = data.frame(gdp)
gdp1 = data.frame(gdp1)
gdp2 = data.frame(gdp2)
deflator = fredr(
series_id = "A191RI1Q225SBEA",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("2020-12-31"),
frequency = "a",
units="lin",
aggregation_method = "eop"
)
deflator1 = fredr(
series_id = "A191RI1Q225SBEA",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("1990-12-31"),
frequency = "a",
units="lin",
aggregation_method = "eop"
)
deflator2 = fredr(
series_id = "A191RI1Q225SBEA",
observation_start = as.Date("2011-01-01"),
observation_end = as.Date("2019-12-31"),
frequency = "a",
units="lin",
aggregation_method = "eop"
)
deflator = data.frame(deflator)
deflator1 = data.frame(deflator1)
deflator2 = data.frame(deflator2)
realgdp = gdp
realgdp$value = realgdp$value - deflator$value
mean(realgdp$value)
realgdp1 = gdp1
realgdp1$value = realgdp1$value - deflator1$value
mean(realgdp1$value)
realgdp2 = gdp2
realgdp2$value = realgdp2$value - deflator2$value
mean(realgdp2$value)
plot(realgdp$date, realgdp$value, type="h")
plot(realgdp1$date, realgdp1$value, type="h")
plot(realgdp2$date, realgdp2$value, type="h")
#census=read.csv("economicensus.csv", sep=",")
labshare = fredr(
series_id = "LABSHPUSA156NRUG",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("2020-12-31"),
frequency = "a"
)
labshare1 = fredr(
series_id = "LABSHPUSA156NRUG",
observation_start = as.Date("1981-01-01"),
observation_end = as.Date("1990-12-31"),
frequency = "a"
)
labshare2 = fredr(
series_id = "LABSHPUSA156NRUG",
observation_start = as.Date("2011-01-01"),
observation_end = as.Date("2019-12-31"),
frequency = "a"
)
labshare = data.frame(labshare)
labshare1 = data.frame(labshare1)
labshare2 = data.frame(labshare2)