*definice rodinné a bytové domy gen RD = (eodumtyp == 1 | eodumtyp == 2 | eodumtyp == 5) gen BD = (eodumtyp == 3 | eodumtyp == 4) *jestli RD nebo BD mají hlavní vytápění plynem, elektřinou nebo teplem gen ERD=1 if RD==1 & ERVYTAPENI_01 == 1 gen EBD=1 if BD==1 & ERVYTAPENI_01 == 1 gen PRD=1 if RD==1 & ERVYTAPENI_02 == 1 gen PBD=1 if BD==1 & ERVYTAPENI_02 == 1 gen TRD=1 if RD==1 & ERVYTAPENI_15 == 1 gen TBD=1 if BD==1 & ERVYTAPENI_15 == 1 *jak reportují údaje *plyn, i ty, kteří udali údaje o spotřebě, ale netopí gen M3PRD=1 if RD==1 & ERVYTAPENI_02 == 1 & epspotrebazpmj == 2 & epspotrebazpmnoz !=. | RD==1 & ERVYTAPVEDL_02 == 1 & epspotrebazpmj == 2 & epspotrebazpmnoz !=. | RD==1 & ERVYTAPVEDL_02 == 2 & epspotrebazpmj == 2 & epspotrebazpmnoz !=. gen KWHPRD=1 if RD==1 & ERVYTAPENI_02 == 1 & epspotrebazpmj == 1 & epspotrebazpmnoz !=.| RD==1 & ERVYTAPVEDL_02 == 1 & epspotrebazpmj == 1 & epspotrebazpmnoz !=.| RD==1 & ERVYTAPVEDL_02 == 2 & epspotrebazpmj == 1 & epspotrebazpmnoz !=. gen M3PBD=1 if BD==1 & ERVYTAPENI_02 == 1 & epspotrebazpmj == 2 & epspotrebazpmnoz !=.| BD==1 & ERVYTAPVEDL_02 == 1 & epspotrebazpmj == 2 & epspotrebazpmnoz !=.| BD==1 & ERVYTAPVEDL_02 == 2 & epspotrebazpmj == 2 & epspotrebazpmnoz !=. gen KWHPBD=1 if BD==1 & ERVYTAPENI_02 == 1 & epspotrebazpmj == 1 & epspotrebazpmnoz !=. | BD==1 & ERVYTAPVEDL_02 == 1 & epspotrebazpmj == 1 & epspotrebazpmnoz !=. | BD==1 & ERVYTAPVEDL_02 == 2 & epspotrebazpmj == 1 & epspotrebazpmnoz !=. *předělat plyn m3 na kwh (avera) gen gas=epspotrebazpmnoz if KWHPBD==1 | KWHPRD==1 replace gas=epspotrebazpmnoz*10.55 if M3PBD==1 | M3PRD==1 *elektřina s vedlejším vytápěním, můžu uvést jenom kwh gen KWHERD=1 if RD==1 & ERVYTAPENI_01 == 1 & epelektrinavyuctovani != . | RD==1 & ERVYTAPVEDL_01 == 1 & epelektrinavyuctovani != . | RD==1 & ERVYTAPVEDL_01 == 2 & epelektrinavyuctovani != . *gen KCERD=1 if RD==1 & ERVYTAPENI_01 == 1 & epzalohyelektrina != . gen KWHEBD=1 if BD==1 & ERVYTAPENI_01 == 1 & epelektrinavyuctovani != . | BD==1 & ERVYTAPVEDL_01 == 1 & epelektrinavyuctovani != . | BD==1 & ERVYTAPVEDL_01 == 2 & epelektrinavyuctovani != . *gen KCEBD=1 if BD==1 & ERVYTAPENI_01 == 1 & epzalohyelektrina != . *elektřina gen elektrina = epelektrinavyuctovani rename epelektrinavyuctovani electricity replace electricity=. if electricity==0 *reportují teplo *gen GJTRD=1 if RD==1 & ERVYTAPENI_15 == 1 & EPSPOTRVYTTABGJ_01 != . & EPSPOTRVYTTABKC_01 == . *gen GJTBD=1 if BD==1 & ERVYTAPENI_15 == 1 & EPSPOTRVYTTABGJ_01 != . & EPSPOTRVYTTABKC_01 == . gen KCTRD=1 if RD==1 & ERVYTAPENI_15 == 1 & EPSPOTRVYTTABKC_01 != . | RD==1 & ERVYTAPVEDL_15 == 1 & EPSPOTRVYTTABKC_01 != . | RD==1 & ERVYTAPVEDL_15 == 2 & EPSPOTRVYTTABKC_01 != . gen KCTBD=1 if BD==1 & ERVYTAPENI_15 == 1 & EPSPOTRVYTTABKC_01 != . | BD==1 & ERVYTAPVEDL_15 == 1 & EPSPOTRVYTTABKC_01 != . | BD==1 & ERVYTAPVEDL_15 == 2 & EPSPOTRVYTTABKC_01 != . *zjištění kolik tepla používají na vytápění gen d_heat = EPSPOTRVYTTABKC_01*EPSPOTRVYTTABPOMER_02*0.01 *Jaká byla renovace provedena na tom baráku? replace EODUMZATEPLZPUSOB_01 = 0 if EODUMZATEPLZPUSOB_01 == . replace EODUMZATEPLZPUSOB_02 = 0 if EODUMZATEPLZPUSOB_02 == . replace EODUMZATEPLZPUSOB_03 = 0 if EODUMZATEPLZPUSOB_03 == . replace EODUMZATEPLZPUSOB_04 = 0 if EODUMZATEPLZPUSOB_04 == . replace EODUMZATEPLZPUSOB_05 = 0 if EODUMZATEPLZPUSOB_05 == . replace EODUMZATEPLZPUSOB_06 = 0 if EODUMZATEPLZPUSOB_06 == . *zateplení gen insulation=0 replace insulation=1 if EODUMZATEPLZPUSOB_01 >= 1 | EODUMZATEPLZPUSOB_02 >= 1 | EODUMZATEPLZPUSOB_03 >= 1 | EODUMZATEPLZPUSOB_04 >= 1 | EODUMZATEPLZPUSOB_05 >= 1 *definice renovace * HLUBOKA: steny+strecha+okna+dvere+(podlaha) gen renovace = 1 if (EODUMZATEPLZPUSOB_01 >= 1 & EODUMZATEPLZPUSOB_02 >= 1 & EODUMZATEPLZPUSOB_03 >= 1 & EODUMZATEPLZPUSOB_05 >= 1) * STREDNI: steny+strecha+okna replace renovace = 2 if (EODUMZATEPLZPUSOB_01 >= 1 & EODUMZATEPLZPUSOB_02 >= 1 & EODUMZATEPLZPUSOB_03 >= 1 & EODUMZATEPLZPUSOB_04 < 1 & EODUMZATEPLZPUSOB_05 < 1) * PLYTKA: steny+(strecha OR okna) replace renovace = 3 if (EODUMZATEPLZPUSOB_01 >= 1 & ((EODUMZATEPLZPUSOB_02 >= 1 & EODUMZATEPLZPUSOB_03 < 1) | (EODUMZATEPLZPUSOB_02 < 1 & EODUMZATEPLZPUSOB_03 >= 1)) & EODUMZATEPLZPUSOB_04 < 1 & EODUMZATEPLZPUSOB_05 < 1) * PLYTKA-JINE: zbytek replace renovace = 4 if renovace==. * bez renovace replace renovace = 0 if insulation==0 gen reno1 = (renovace==1) /* hluboka */ gen reno2 = (renovace==2) /* stredni */ gen reno3 = (renovace==3) /*plytka */ gen reno4 = (renovace==4) gen reno123 = (renovace==1 | renovace==2 | renovace==3) gen reno12 = (renovace==1 | renovace==2) * definice prijmu gen income = 0 replace income = ezdomprijemkc if ezdomprijemkc!=. replace income=5000 if ezdomodhadprijemkc==1 replace income=15000 if ezdomodhadprijemkc==2 replace income=25000 if ezdomodhadprijemkc==3 replace income=35000 if ezdomodhadprijemkc==4 replace income=45000 if ezdomodhadprijemkc==5 replace income=55000 if ezdomodhadprijemkc==6 replace income=65000 if ezdomodhadprijemkc==7 replace income=75000 if ezdomodhadprijemkc==8 replace income=85000 if ezdomodhadprijemkc==9 replace income=95000 if ezdomodhadprijemkc==10 replace income=105000 if ezdomodhadprijemkc==11 replace income=income*0.8 if ezdomprijemtyp==2 gen income_miss=1 if income==0 replace income_miss=0 if income_miss==. *plyn, ti kteří netopí, ale udali údaj gen gas_no_RD=0 replace gas_no_RD=1 if PRD!=1 & PBD!=1 & RD==1 gen gas_no_BD=0 replace gas_no_BD=1 if PRD!=1 & PBD!=1 & BD==1 *teplo, ti kteří netopí, ale udali údaj gen heat_no_RD=0 replace heat_no_RD=1 if TRD!=1 & TBD!=1 & RD==1 gen heat_no_BD=0 replace heat_no_BD=1 if TRD!=1 & TBD!=1 & BD==1 *elektřina, ti kteří netopí, ale udali údaj gen ele_no_RD=0 replace ele_no_RD=1 if ERD!=1 & EBD!=1 & RD==1 gen ele_no_BD=0 replace ele_no_BD=1 if ERD!=1 & EBD!=1 & BD==1 *definice roků výstavby gen year= 1910 if eodumobdobivystavby==1 replace year=1933 if eodumobdobivystavby==2 replace year=1957 if eodumobdobivystavby==3 | eodumobdobivystavby==4 replace year=1980 if eodumobdobivystavby==5 | eodumobdobivystavby==6 replace year=eodumrokvystavby if eodumobdobivystavby==7 sum year,d * definice interakci na zatepleni a obdobi vystavby gen insul_1910 = (year==1910 & insulation==1) gen insul_1933 = (year==1933 & insulation==1) gen insul_1957 = (year==1957 & insulation==1) gen insul_1980 = (year==1980 & insulation==1) gen insul_2005 = (year>=1991 & insulation==1) * definice interakci na reno123, i.e. hluboka, stredni, plytka renovace, a obdobi vystavby gen reno123_1910 = (year==1910 & reno123==1) gen reno123_1933 = (year==1933 & reno123==1) gen reno123_1957 = (year==1957 & reno123==1) gen reno123_1980 = (year==1980 & reno123==1) gen reno123_2005 = (year>=1991 & reno123==1) *dummy variable kombinace rekonstrukce a typ domu gen reno123_RD=reno123*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_BD=reno123*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 drop reno123_RD reno123_BD gen insulation_RD=insulation*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insulation_BD=insulation*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno1_BD = reno1*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno2_BD = reno2*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno3_BD = reno3*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno4_BD = reno4*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno1_RD = reno1*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno2_RD = reno2*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno3_RD = reno3*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno4_RD = reno4*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1910_BD = reno123_1910*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1933_BD = reno123_1933*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1957_BD = reno123_1957*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1980_BD = reno123_1980*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_2005_BD= reno123_2005*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1910_RD = reno123_1910*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1933_RD = reno123_1933*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1957_RD = reno123_1957*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_1980_RD = reno123_1980*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen reno123_2005_RD= reno123_2005*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1910_BD = insul_1910*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1933_BD = insul_1933*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1957_BD = insul_1957*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1980_BD = insul_1980*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_2005_BD= insul_2005*BD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1910_RD = insul_1910*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1933_RD = insul_1933*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1957_RD = insul_1957*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_1980_RD = insul_1980*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 gen insul_2005_RD= insul_2005*RD if TRD==1 | TBD==1 | PRD==1 | PBD==1 | ERD==1 | EBD==1 *remane rename EOBYTPLOCHA_02 heating_area rename etobydliteplota temperature vif estat hettest *modely, které budu používat regress gas heating_area income income_miss temperature insul_1910 insul_1933 insul_1957 insul_1980 insul_2005 year if PRD==1 | PBD==1 [aw=Vahy] regress gas heating_area income income_miss temperature reno1 reno2 reno3 year if PRD==1 [aw=Vahy] regress gas heating_area income income_miss temperature reno1 reno2 reno3 year if PBD==1 [aw=Vahy] regress gas heating_area income income_miss temperature reno123_RD reno123_BD year gas_no_RD gas_no_BD [aw=Vahy] *elektřina regress electricity heating_area income income_miss temperature insulation year if ERD==1 | EBD==1 [aw=Vahy] regress electricity heating_area income income_miss temperature insulation year if ERD==1 [aw=Vahy] regress electricity heating_area income income_miss temperature reno123_1910 reno123_1933 reno123_1957 reno123_1980 reno123_2005 if EBD==1 [aw=Vahy] regress electricity heating_area income income_miss temperature reno123_RD reno123_BD year ele_no_RD ele_no_BD [aw=Vahy] *teplo regress d_heat heating_area income income_miss temperature reno123 year if TRD==1 | TBD==1 [aw=Vahy] *regress d_heat heating_area income income_miss temperature insulation year if TRD==1 [aw=Vahy] regress d_heat heating_area income income_miss temperature reno1 reno2 reno3 year if TBD==1 [aw=Vahy] regress d_heat heating_area income income_miss temperature reno123_BD year heat_no_BD [aw=Vahy] *descriptive statistic tab BD if gas!=. | electricity!=. | d_heat!=. summarize gas summarize electricity summarize d_heat summarize heating_area if gas!=. | electricity!=. | d_heat!=. summarize temperature if gas!=. | electricity!=. | d_heat!=. summarize income if gas!=. | electricity!=. | d_heat!=. summarize year if gas!=. | electricity!=. | d_heat!=. tab insul_1933 if gas!=. tab insul_1933 if electricity!=. tab insul_1933 if d_heat!=. tab EODUMZATEPLZPUSOB_01 if gas!=. | electricity!=. | d_heat!=. tab EODUMZATEPLZPUSOB_02 if gas!=. | electricity!=. | d_heat!=. tab EODUMZATEPLZPUSOB_03 if gas!=. | electricity!=. | d_heat!=. tab EODUMZATEPLZPUSOB_04 if gas!=. | electricity!=. | d_heat!=. tab EODUMZATEPLZPUSOB_05 if gas!=. | electricity!=. | d_heat!=. tab EODUMZATEPLZPUSOB_06 if gas!=. | electricity!=. | d_heat!=. summarize heating_area if d_heat!=. & (TRD==1| TBD==1), d summarize temperature if d_heat!=. & (TRD==1| TBD==1), d summarize income if d_heat!=. & (TRD==1| TBD==1), d summarize year if d_heat!=. & (TRD==1| TBD==1), d summarize d_heat if d_heat!=. & reno123_2005==1 & TRD==1, summarize d_heat if d_heat!=. & reno123_2005==1 & TBD==1, tab EODUMZATEPLZPUSOB_01 EODUMZATEPLZPUSOB_02 if gas!=. | electricity!=. | d_heat!=. tab gas if gas!=. | electricity!=. | d_heat!=. tab TBD if insulation==1 testnl (_b[reno1] - _b[reno2]) = 0 testnl (_b[reno1] - _b[reno3]) = 0 testnl (_b[reno2] - _b[reno3]) = 0