Commit b58c11e0 authored by Ben Anderson's avatar Ben Anderson
Browse files

updated descriptives to test panel transitions for 'valid'

parent 9613cb4f
......@@ -28,7 +28,7 @@ local rpath "`proot'/results/NEED"
local version "v1.1"
* quick tests for 2012
local do_2012_desc = 1
local do_2012_desc = 0
* tests for all years using long file - takes a while
local do_long_desc = 1
......@@ -60,7 +60,7 @@ if `do_2012_desc' {
tabstat `v', by(`v'Valid) s(n mean semean min max)
foreach tv of local tvars {
di "***************"
di "* Testing `tv'"
di "* Testing `v' by `tv' for `s'% sample"
* test values for `tv' - check for 0s for example
tabstat `v' if `v'Valid == "V", by(`tv') s(n mean semean min max)
tab `v' if `v' < 1000
......@@ -78,7 +78,8 @@ if `do_2012_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
* do this for each random sample of differening sizes as a check
local samples "10 20 30 40 50 100"
* local samples "10 20 30 40 50 100"
local samples "50"
foreach s of local samples {
di "************************"
di "* Using `s'% sample"
......@@ -93,6 +94,9 @@ if `do_long_desc' {
* distributions for valid obs
local vars "Econs Gcons"
foreach v of local vars {
di "***************"
di "* Testing `v' for `s'% sample"
* overall
xtsum `v' if `v'Valid == "V"
* test values for valid - check for valid 0s for example. This only happens for gas where:
......@@ -101,7 +105,7 @@ if `do_long_desc' {
* elec always rounded to nearest 50 so min shoudl always be 100
tabstat `v', by(`v'Valid) s(n mean semean min max)
* by year
* check for 0s
di "* check `v' for 0s (`s'% sample)"
table `v' year if `v' < 1000
table `v'Valid year, c(count `v' min `v' mean `v' max `v')
......@@ -111,9 +115,13 @@ if `do_long_desc' {
graph box `v' if `v'Valid == "V", over(year) name(box_`s'pc_`v')
graph export "`rpath'/NEED-EULF-2014-`s'pc-box_`v'_by_year_valid.png", replace
}
* check the panel transitions for each valid
recode `v'Valid (V = 1) (O = 2) (L = 3) (G = 4) (M = 5), gen(EconsValidr)
lab var `v'Validr "Recoded `v'Valid"
lab def `v'Validr 1 "V" 2 "O" 3 "L" 4 "G" 5 "M"
lab val `v'Validr `v'Validr
xttrans `v'Validr
}
* check the years where gas = valid but consumption = 0
* Presumably in these cases gas > 100 but < 249 ?
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment