Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/statsmodels/datasets/macrodata/data.py : 72%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""United States Macroeconomic data"""
2from statsmodels.datasets import utils as du
4__docformat__ = 'restructuredtext'
6COPYRIGHT = """This is public domain."""
7TITLE = __doc__
8SOURCE = """
9Compiled by Skipper Seabold. All data are from the Federal Reserve Bank of St.
10Louis [1] except the unemployment rate which was taken from the National
11Bureau of Labor Statistics [2]. ::
13 [1] Data Source: FRED, Federal Reserve Economic Data, Federal Reserve Bank of
14 St. Louis; http://research.stlouisfed.org/fred2/; accessed December 15,
15 2009.
17 [2] Data Source: Bureau of Labor Statistics, U.S. Department of Labor;
18 http://www.bls.gov/data/; accessed December 15, 2009.
19"""
21DESCRSHORT = """US Macroeconomic Data for 1959Q1 - 2009Q3"""
23DESCRLONG = DESCRSHORT
25NOTE = """::
26 Number of Observations - 203
28 Number of Variables - 14
30 Variable name definitions::
32 year - 1959q1 - 2009q3
33 quarter - 1-4
34 realgdp - Real gross domestic product (Bil. of chained 2005 US$,
35 seasonally adjusted annual rate)
36 realcons - Real personal consumption expenditures (Bil. of chained
37 2005 US$, seasonally adjusted annual rate)
38 realinv - Real gross private domestic investment (Bil. of chained
39 2005 US$, seasonally adjusted annual rate)
40 realgovt - Real federal consumption expenditures & gross investment
41 (Bil. of chained 2005 US$, seasonally adjusted annual rate)
42 realdpi - Real private disposable income (Bil. of chained 2005
43 US$, seasonally adjusted annual rate)
44 cpi - End of the quarter consumer price index for all urban
45 consumers: all items (1982-84 = 100, seasonally adjusted).
46 m1 - End of the quarter M1 nominal money stock (Seasonally
47 adjusted)
48 tbilrate - Quarterly monthly average of the monthly 3-month
49 treasury bill: secondary market rate
50 unemp - Seasonally adjusted unemployment rate (%)
51 pop - End of the quarter total population: all ages incl. armed
52 forces over seas
53 infl - Inflation rate (ln(cpi_{t}/cpi_{t-1}) * 400)
54 realint - Real interest rate (tbilrate - infl)
55"""
58def load_pandas():
59 data = _get_data()
60 return du.Dataset(data=data, names=list(data.columns))
63def load(as_pandas=None):
64 """
65 Load the US macro data and return a Dataset class.
67 Parameters
68 ----------
69 as_pandas : bool
70 Flag indicating whether to return pandas DataFrames and Series
71 or numpy recarrays and arrays. If True, returns pandas.
73 Returns
74 -------
75 Dataset instance:
76 See DATASET_PROPOSAL.txt for more information.
78 Notes
79 -----
80 The macrodata Dataset instance does not contain endog and exog attributes.
81 """
82 return du.as_numpy_dataset(load_pandas(), as_pandas=as_pandas)
85def _get_data():
86 return du.load_csv(__file__, 'macrodata.csv').astype(float)
89variable_names = ["realcons", "realgdp", "realinv"]
92def __str__():
93 return "macrodata"