Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

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

added linearity tests to all households model

parent 20c0ba61
......@@ -54,15 +54,15 @@ local rpath "`proot'/results/NEED"
* restricted analysis to households where gas is main heat source as it is better predicted by variables included & is more relevant to EPC (heat)
* uses 1% sample (c 30k) making sure keep proportions of property type and EE_Band to see if linktest fails with smaller n
*local version "v2_10pc"
*local sample 10
*local sampleby "EE_BAND PROP_TYPE"
local version "v2_10pc"
local sample 10
local sampleby "EE_BAND PROP_TYPE"
* uses 10% sample (c 300k) making sure keep proportions of property type and EE_Band to see if margin plots and co-efficients are the same
* (linktest etc will probably now fail due to larger n)
local version "v2_100pc"
local sample 100
local sampleby "EE_BAND PROP_TYPE"
*local version "v2_100pc"
*local sample 100
*local sampleby "EE_BAND PROP_TYPE"
* uses full sample (c 3m) to see if margin plots and co-efficients are the same
* (linktest etc will probably now fail due to larger n)
......@@ -145,7 +145,11 @@ destring BOILER, force replace
replace BOILER = 0 if BOILER == .
* household level vars
* for models
local generic_hvars "i.BOILER_YEAR i.MAIN_HEAT_FUEL i.LI_YEAR i.LOFT_DEPTH i.FLOOR_AREA_BAND WALL_CONS i.CWI_YEAR i.PROP_TYPE i.PROP_AGE i.EE_BAND"
* for graphs
local generic_hvarsg "BOILER_YEAR MAIN_HEAT_FUEL LI_YEAR LOFT_DEPTH FLOOR_AREA_BAND WALL_CONS CWI_YEAR PROP_TYPE PROP_AGE EE_BAND"
* for models by type
local generic_hvarsnp "i.BOILER_YEAR i.MAIN_HEAT_FUEL i.LI_YEAR i.LOFT_DEPTH i.FLOOR_AREA_BAND WALL_CONS i.CWI_YEAR i.PROP_AGE i.EE_BAND"
* area level vars
......@@ -177,6 +181,17 @@ foreach v of local vars {
i.BOILER_YEAR
est store `v'
* test a variable
predict r, resid
foreach testv of local generic_hvarsg {
di "Testing residuals against `v'"
* based on http://www.ats.ucla.edu/stat/stata/webbooks/reg/chapter2/statareg2.htm
* can't use factor variables in acprplot...
graph box r, over(`testv') name(rtest_`testv')
graph export "`rpath'/graphs/rplot_`v'_`testv'-`version'.png", replace
}
di "* -> `v' estat to test for heteroskedasticity & omitted vars"
estat ovtest
estat hettest
......@@ -189,7 +204,7 @@ foreach v of local vars {
di "* test EPC margins for `v'"
margins EE_BAND
marginsplot, name(mplot_`v'_EE_BAND)
marginsplot, name(mplot_`v'_EE_BAND) note("All dwellings")
graph export "`rpath'/graphs/mplot_`v'_EE_BAND-`version'.png", replace
* models by property type - to see if rsq & coefficients vary
......@@ -212,7 +227,7 @@ foreach v of local vars {
linktest
di "* test EPC margins for `v' (`pt`p'')"
margins EE_BAND
marginsplot, name(mplot_`v'_EE_BAND_`pt`p'')
marginsplot, name(mplot_`v'_EE_BAND_`pt`p'') note("Type: `pt`p''")
graph export "`rpath'/graphs/mplot_`v'_EE_BAND_`pt`p''-`version'.png", replace
}
......
Markdown is supported
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