Hide keyboard shortcuts

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"""Name of dataset.""" 

2from statsmodels.datasets import utils as du 

3 

4__docformat__ = 'restructuredtext' 

5 

6COPYRIGHT = """This is public domain.""" 

7TITLE = """Engel (1857) food expenditure data""" 

8SOURCE = """ 

9This dataset was used in Koenker and Bassett (1982) and distributed alongside 

10the ``quantreg`` package for R. 

11 

12Koenker, R. and Bassett, G (1982) Robust Tests of Heteroscedasticity based on 

13Regression Quantiles; Econometrica 50, 43-61. 

14 

15Roger Koenker (2012). quantreg: Quantile Regression. R package version 4.94. 

16http://CRAN.R-project.org/package=quantreg 

17""" 

18 

19DESCRSHORT = """Engel food expenditure data.""" 

20 

21DESCRLONG = """Data on income and food expenditure for 235 working class households in 1857 Belgium.""" 

22 

23#suggested notes 

24NOTE = """:: 

25 

26 Number of observations: 235 

27 Number of variables: 2 

28 Variable name definitions: 

29 income - annual household income (Belgian francs) 

30 foodexp - annual household food expenditure (Belgian francs) 

31""" 

32 

33def load(as_pandas=None): 

34 """ 

35 Load the data and return a Dataset class instance. 

36 

37 Parameters 

38 ---------- 

39 as_pandas : bool 

40 Flag indicating whether to return pandas DataFrames and Series 

41 or numpy recarrays and arrays. If True, returns pandas. 

42 

43 Returns 

44 ------- 

45 Dataset instance: 

46 See DATASET_PROPOSAL.txt for more information. 

47 """ 

48 return du.as_numpy_dataset(load_pandas(), as_pandas=as_pandas) 

49 

50 

51def load_pandas(): 

52 data = _get_data() 

53 return du.process_pandas(data, endog_idx=0, exog_idx=None) 

54 

55 

56def _get_data(): 

57 return du.load_csv(__file__, 'engel.csv')