Skip to content
Snippets Groups Projects
Commit fa061d69 authored by Ben Anderson's avatar Ben Anderson
Browse files

loops over subsamples of long form file

parent 1f32b90e
No related branches found
No related tags found
No related merge requests found
......@@ -27,8 +27,8 @@ local rpath "`proot'/results/NEED"
local version "v1.1"
local do_2014_desc 1 /// quick tests for 2014
local do_long_dec 0 /// tests for all years using long file - takes a while
local do_2014_desc 0 /// quick tests for 2014
local do_long_dec 1 /// tests for all years using long file - takes a while
set more off
......@@ -55,27 +55,33 @@ if `do_2014_desc' {
if `do_long_desc' {
* Now use the pre-processed long form file which contains all years of consumption data but not the constant values (housing charactersitics etc) which are in the xwave file
use "`dpath'/need_eul_may2014_longfile.dta", clear
* do this for each random sample of differening sizes as a check
local samples "10 20 130 40 50 100"
foreach s of local samples {
di "************************"
di "* Using `s'% sample"
use "`dpath'/need_eul_may2014_longfile_`s'pc.dta", clear
* set as panel
xtset HH_ID year, delta(1 year)
* set as panel
xtset HH_ID year, delta(1 year)
xtdescribe
xtdescribe
xtsum Econs Gcons
xtsum Econs Gcons
* summarise Electricity
table EconsValid year, c(count Econs min Econs mean Econs max Econs)
* summarise Gas
table GconsValid year, c(count Gcons min Gcons mean Gcons max Gcons)
* summarise Electricity
table EconsValid year, c(count Econs min Econs mean Econs max Econs)
* summarise Gas
table GconsValid year, c(count Gcons min Gcons mean Gcons max Gcons)
* distributions by year
local vars "Econs Gcons"
foreach v of local vars {
histogram `v', by(year) name(histo_`v')
graph export "`rpath'/NEED-EULF-2014-histo_`v'_by_year.png", replace
graph box `v', over(year) name(box_`v')
graph export "`rpath'/NEED-EULF-2014-box_`v'_by_year.png", replace
* distributions by year
local vars "Econs Gcons"
foreach v of local vars {
histogram `v', by(year) name(histo_`s'pc_`v')
graph export "`rpath'/NEED-EULF-2014-`s'pc-histo_`v'_by_year.png", replace
graph box `v', over(year) name(box_`s'pc_`v')
graph export "`rpath'/NEED-EULF-2014-`s'pc-box_`v'_by_year.png", replace
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment