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

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"""Taxation Powers Vote for the Scottish Parliament 1997 dataset."""
2from statsmodels.datasets import utils as du
4__docformat__ = 'restructuredtext'
6COPYRIGHT = """Used with express permission from the original author,
7who retains all rights."""
8TITLE = "Taxation Powers Vote for the Scottish Parliament 1997"
9SOURCE = """
10Jeff Gill's `Generalized Linear Models: A Unified Approach`
12http://jgill.wustl.edu/research/books.html
13"""
14DESCRSHORT = """Taxation Powers' Yes Vote for Scottish Parliamanet-1997"""
16DESCRLONG = """
17This data is based on the example in Gill and describes the proportion of
18voters who voted Yes to grant the Scottish Parliament taxation powers.
19The data are divided into 32 council districts. This example's explanatory
20variables include the amount of council tax collected in pounds sterling as
21of April 1997 per two adults before adjustments, the female percentage of
22total claims for unemployment benefits as of January, 1998, the standardized
23mortality rate (UK is 100), the percentage of labor force participation,
24regional GDP, the percentage of children aged 5 to 15, and an interaction term
25between female unemployment and the council tax.
27The original source files and variable information are included in
28/scotland/src/
29"""
31NOTE = """::
33 Number of Observations - 32 (1 for each Scottish district)
35 Number of Variables - 8
37 Variable name definitions::
39 YES - Proportion voting yes to granting taxation powers to the
40 Scottish parliament.
41 COUTAX - Amount of council tax collected in pounds steling as of
42 April '97
43 UNEMPF - Female percentage of total unemployment benefits claims as of
44 January 1998
45 MOR - The standardized mortality rate (UK is 100)
46 ACT - Labor force participation (Short for active)
47 GDP - GDP per county
48 AGE - Percentage of children aged 5 to 15 in the county
49 COUTAX_FEMALEUNEMP - Interaction between COUTAX and UNEMPF
51 Council district names are included in the data file, though are not
52 returned by load.
53"""
56def load(as_pandas=None):
57 """
58 Load the Scotvote data and returns a Dataset instance.
60 Parameters
61 ----------
62 as_pandas : bool
63 Flag indicating whether to return pandas DataFrames and Series
64 or numpy recarrays and arrays. If True, returns pandas.
66 Returns
67 -------
68 Dataset instance:
69 See DATASET_PROPOSAL.txt for more information.
70 """
71 return du.as_numpy_dataset(load_pandas(), as_pandas=as_pandas)
74def load_pandas():
75 """
76 Load the Scotvote data and returns a Dataset instance.
78 Returns
79 -------
80 Dataset instance:
81 See DATASET_PROPOSAL.txt for more information.
82 """
83 data = _get_data()
84 return du.process_pandas(data, endog_idx=0)
87def _get_data():
88 data = du.load_csv(__file__, 'scotvote.csv')
89 data = data.iloc[:, 1:9]
90 return data.astype(float)