*################################################################### * Autor: Marcel Weschke * E-Mail: marcel.weschke@directbox.de * * Seminar Thema: Regionale Unterschiede in der Mietpreisentwicklung. * Regressionsanalyse - Stadt- / Landregion - Modell 1 *################################################################### * Loading the zh dataset *use "K:\Wissenschaftlicher Mitarbeiter\Lehre\Empirisches Seminar\SOEP 50\zh.dta", clear use "/home/marcel/Desktop/SOEP-CORE.v37_data/Stata/raw/zh.dta", clear * Load and append the beh dataset *append using "K:\Wissenschaftlicher Mitarbeiter\Lehre\Empirisches Seminar\SOEP 50\beh.dta" append using "/home/marcel/Desktop/SOEP-CORE.v37_data/Stata/raw/beh.dta" * ################################ * Pre-code - adjust for inflation: * ################################ * Quelle: https://www-genesis.destatis.de/genesis/online * Verbraucherpreisindex (CPI) für 2009, 2014, 2020 und 2022 gen cpi_2009 = 87.2 / 100 // CPI für 2009 als Bruchteil gen cpi_2014 = 94.0 / 100 // CPI für 2014 als Bruchteil gen cpi_2020 = 100.0 / 100 // CPI für 2020 als Bruchteil -> Basisjahr gen cpi_2022 = 110.2 / 100 // CPI für 2022 als Bruchteil -> Betrachtungsjahr * Inflationsfaktoren zu den Jahren 2009 und 2014 mit Basisjahr 2020 und Betrachtungsjahr 2022: bysort hid (syear): gen inflationsfaktor_2009 = cpi_2022 / cpi_2009 bysort hid (syear): gen inflationsfaktor_2014 = cpi_2022 / cpi_2014 * Setting up the regression variables * #################### * NUMERIC VARIABLES: * #################### * Generate the "miete" variable: gen miete = . replace miete = zh2301 if syear == 2009 replace miete = beh2401 if syear == 2014 * Display the sum of miete values less than or equal to 0 *tab miete if miete <= 100 sum miete if miete <= 0 * So there are 6990 observations with -2 drop if miete == -2 * Next: Nominal price data in Euro converted to real Euro term * Anpassung der Einkommenswerte von 2009 und 2014 auf 2022: bysort hid (syear): replace miete = miete * inflationsfaktor_2009 if syear == 2009 bysort hid (syear): replace miete = miete * inflationsfaktor_2014 if syear == 2014 * Generate the "wohnfläche" variable gen wohnfläche = . replace wohnfläche = zh10 if syear == 2009 replace wohnfläche = beh07 if syear == 2014 sum wohnfläche if wohnfläche <= 0 * So there are 12 observations with -1 drop if wohnfläche == -1 * PLOT: Wohnfläche VS Quadratmeterpreis: graph twoway (scatter Quadratmeterpreis wohnfläche, mfcolor(gray) mlcolor(gray) title("Direktbeziehung zwischen der Wohnfläche und dem Quadratmeterpreis", size(small)) xtitle("Wohnfläche in qm", size(small)) ytitle("Quadratmeterpreis in EUR", size(small))) (lfit Quadratmeterpreis wohnfläche) * Generate the "HH_nettoeinkommen" variable gen HH_nettoeinkommen = . replace HH_nettoeinkommen = zh5201 if syear == 2009 replace HH_nettoeinkommen = beh5401 if syear == 2014 sum HH_nettoeinkommen if HH_nettoeinkommen <= 0 sum HH_nettoeinkommen if HH_nettoeinkommen == -3 * So there are 41 observations with -3 drop if HH_nettoeinkommen == -3 sum HH_nettoeinkommen if HH_nettoeinkommen == -1 * So there are 203 observations with -1 drop if HH_nettoeinkommen == -1 * Rescale HH_nettoeinkommen / 1000 to make it better interpretable: replace HH_nettoeinkommen = (HH_nettoeinkommen/1000) * Next: Nominal price data in Euro converted to real Euro term * Anpassung der Einkommenswerte von 2009 und 2014 auf 2022: bysort hid (syear): replace HH_nettoeinkommen = HH_nettoeinkommen * inflationsfaktor_2009 if syear == 2009 bysort hid (syear): replace HH_nettoeinkommen = HH_nettoeinkommen * inflationsfaktor_2014 if syear == 2014 * PLOT: Nettohaushaltseinkommen VS Quadratmeterpreis: graph twoway (scatter Quadratmeterpreis HH_nettoeinkommen, mfcolor(gray) mlcolor(gray) title("Direktbeziehung zwischen dem Nettohaushaltseinkommen und dem Quadratmeterpreis", size(small)) xtitle("Nettohaushaltseinkommen in EUR", size(small)) ytitle("Quadratmeterpreis in EUR", size(small))) (lfit Quadratmeterpreis HH_nettoeinkommen) * Generate the "Quadratmeterpreis" variable gen Quadratmeterpreis = miete / wohnfläche * Generate the "ln(Quadratmeterpreis)" variable gen ln_Quadratmeterpreis = log(Quadratmeterpreis) * #################### * FACTOR VARIABLES: * #################### * Generate the "ortschaft" variable, where: * Stadt: ortschaft==1 ("Entfernung z. Zentrum d.n. Grossstadt") <= 10km * Land: ortschaft==0 ("Entfernung z. Zentrum d.n. Grossstadt") > 10km gen ortschaft = . replace ortschaft = zh54 if syear == 2009 replace ortschaft = beh57 if syear == 2014 sum ortschaft if ortschaft <= 0 *tab ortschaft if ortschaft == -1 * So there are 28 observations with -1 drop if ortschaft == -1 replace ortschaft = 1 if ortschaft == 1 | ortschaft == 2 replace ortschaft = 0 if ortschaft == 3 | ortschaft == 4 | ortschaft == 5 | ortschaft == 6 tab ortschaft * 3539 observations in the rural area * 3164 observations in the city area * Generate the "räume" variable gen räume = . replace räume = zh11 if syear == 2009 replace räume = beh08 if syear == 2014 sum räume if räume <= 0 * So there are 3 observations with -1 *replace räume = . if räume == -1 drop if räume == -1 *tab räume if räume == -1 *drop if räume == -1 tab räume * Generate the "mietertyp" variable (to filter out Eigentümer) gen mietertyp = . replace mietertyp = zh20 if syear == 2009 replace mietertyp = beh21 if syear == 2014 tab mietertyp * Note: "3" would represents Eigentümer. * I don't have any here but if: *drop if mietertyp == 3 * Generate the terasse_balkon variable gen terasse_balkon = . replace terasse_balkon = zh1406 if syear == 2009 replace terasse_balkon = beh1104 if syear == 2014 tab terasse_balkon * So there are 27 observations with -1 drop if terasse_balkon == -1 * value 1: [1] Ja * value 2: [2] Nein * Generate the keller variable gen keller = . replace keller = zh1407 if syear == 2009 replace keller = beh1105 if syear == 2014 tab keller * So there are 9 observations with -1 drop if keller == -1 * Create the garten variable gen garten = . replace garten = zh1408 if syear == 2009 replace garten = beh1106 if syear == 2014 tab garten * So there are 26 observations with -1 drop if garten == -1 * Identify households surveyed in both years bysort hid (syear): gen tag = _N tab tag * So there are 4202 unique observations with just 1 year of data drop if tag == 1 * ######################### * Check for missing values: * ######################### sum ln_Quadratmeterpreis Quadratmeterpreis miete wohnfläche HH_nettoeinkommen räume ortschaft terasse_balkon keller garten if missing(ln_Quadratmeterpreis) | missing(Quadratmeterpreis) | missing(miete) | missing(wohnfläche) | missing(HH_nettoeinkommen) | missing(räume) | missing(ortschaft) | missing(terasse_balkon) | missing(keller) | missing(garten) * Remove rows with missing values *drop if missing(ln_Quadratmeterpreis) | missing(Quadratmeterpreis) | missing(miete) | missing(wohnfläche) | missing(HH_nettoeinkommen) | missing(räume) | missing(ortschaft) | missing(terasse_balkon) | missing(keller) | missing(garten) * #################################### * Setting up the panel data structure: * #################################### gen period = 1 if syear == 2009 replace period = 2 if syear == 2014 xtset hid period // deklariere Identifier und Zeitvariable * ############################ * CHECK FOR MOVED household's: * ############################ * Create a new variable moved * Create the dummy variable which indicates whether a household moved and its location (+origion information) or not. *gen move_dummy = . bysort hid (syear): gen region_moved_dummy = 1 if ortschaft[1] != ortschaft[_N] & syear[1] == 2009 & syear[_N] == 2014 * Recode move_dummy based on the specific conditions bysort hid (syear): replace region_moved_dummy = 0 if ortschaft[1] == ortschaft[_N] bysort hid (syear): replace region_moved_dummy = 1 if ortschaft[1] == 0 & ortschaft[_N] == 1 bysort hid (syear): replace region_moved_dummy = 2 if ortschaft[1] == 1 & ortschaft[_N] == 0 bysort hid (syear): replace region_moved_dummy = 3 if ortschaft[1] == 0 & ortschaft[_N] == 0 tab region_moved_dummy *gen diff_move_dummy = d.move_dummy *Ziel dieser zusätzlichen Variable: -> Aussage über die Änderung durch Ausgangsmiete, wie im Paper. bysort hid (syear): gen apartment_moved_dummy = 0 if wohnfläche[1] == wohnfläche[_N] & syear[1] == 2009 & syear[_N] == 2014 bysort hid (syear): replace apartment_moved_dummy = 1 if wohnfläche[1] != wohnfläche[_N] & syear[1] == 2009 & syear[_N] == 2014 tab apartment_moved_dummy * 1178 sind in ihrer Wohnung geblieben * 1258 sind umgezogen im laufe der Zeit * REMINDER: ! ************************************************** * Variable: ortschaft * 0: Land * 1: Stadt * Variable: region_moved_dummy * 0: in Stadt-Region geblieben * 1: Stadt zu Land gezogen * 2: Land zu Stadt gezogen * 3: in Land-Region geblieben * Variable: apartment_moved_dummy * 0: Wöhnungsgröße hat sich nicht verändert * 1: Wohnungsgröße hat sich verändert ************************************************** * ############################ * Generating diff_Variable's : * ############################ bysort hid (syear): gen diff_ortschaft = ortschaft - ortschaft[_n-1] bysort hid (syear): replace diff_ortschaft = 2 if diff_ortschaft == -1 graph bar (count), over(diff_ortschaft) bysort hid (syear): gen diff_räume = räume - räume[_n-1] *gen diff_räume = räume - räume[_n-1] graph bar (count), over(diff_räume) * 0 = Anzahl unverändert * 1 = Anzahl hat zugenommen * 2 = Anzahl hat abgenommen * Erklärung der Werte: * 0 Nullwert: * Dies würde bedeuten, dass die Anzahl der Räume im Haushalt zwischen 2009 und 2014 unverändert geblieben ist. * 1,... Positive Werte: * Dies würde bedeuten, dass die Anzahl der Räume im Haushalt im Jahr 2014 im Vergleich zu 2009 zugenommen hat. * -1,... Negativer Werte: * Dies würde bedeuten, dass die Anzahl der Räume im Haushalt im Jahr 2014 im Vergleich zu 2009 abgenommen hat. -> Wobei ich diesen Wert zu "2" umkodiere, da keine negativen Werte erlaubt sind !! ******** BRAUCHE ICH ************ * Plot Ortschaft-Verteilung (Land und Stadt) graph bar, over(räume) over(ortschaft, relabel(1 "Land" 2 "Stadt")) /// title("Anzahl der Räume je Wohneinheit und Ortschaft:", size(small)) /// ytitle("Prozent der Wohneinheiten", size(small)) /// bar(1, color(gray) fcolor(gray)) * Als Tabelle: table (räume) (ortschaft) table (räume) (ortschaft), statistic(frequency) statistic(percent) ********************************* ******** BRAUCHE ICH ************ * Plot Ortschaft-Verteilung (Land und Stadt) graph bar, over(diff_räume) over(ortschaft, relabel(1 "Land" 2 "Stadt")) /// title("{&Delta} Anzahl der Räume je Wohneinheit und Ortschaft:", size(small)) /// ytitle("Prozent der Wohneinheiten", size(small)) /// bar(1, color(gray) fcolor(gray)) * Als Tabelle: table (diff_räume) (ortschaft) table (diff_räume) (ortschaft), statistic(frequency) statistic(percent) ********************************* bysort hid (syear): gen diff_terasse_balkon = terasse_balkon - terasse_balkon[_n-1] bysort hid (syear): replace diff_terasse_balkon = 2 if diff_terasse_balkon == -1 *gen diff_terasse_balkon = terasse_balkon - terasse_balkon[_n-1] *graph bar (count), over(diff_terasse_balkon) graph bar, over(diff_terasse_balkon ) over(ortschaft, relabel(1 "Land" 2 "Stadt")) /// title("Änderung nach Umzug, Terasse/Balkon je Wohneinheit und Ortschaft:", size(small)) /// ytitle("Prozent der Wohneinheiten", size(small)) /// bar(1, color(gray) fcolor(gray)) * Erklärung der Werte: * 0 Nullwert: * Dies würde bedeuten, dass "terasse_balkon" im Haushalt zwischen 2009 und 2014 unverändert geblieben ist. * 1 Positive Werte: * Dies würde bedeuten, dass "terasse_balkon" im Haushalt im Jahr 2014 im Vergleich zu 2009 zugenommen hat. (neue Wohnung MIT Terasse/Balkon) * -1 Negativer Werte: * Dies würde bedeuten, dass die Anzahl der Räume im Haushalt im Jahr 2014 im Vergleich zu 2009 abgenommen hat. (neue Wohnung OHNE Terasse/Balkon) -> Wobei ich diesen Wert zu "2" umkodiere, da keine negativen Werte erlaubt sind !! bysort hid (syear): gen diff_keller = keller - keller[_n-1] bysort hid (syear): replace diff_keller = 2 if diff_keller == -1 *gen diff_keller = keller - keller[_n-1] *graph bar (count), over(diff_keller) bysort hid (syear): gen diff_garten = garten - garten[_n-1] bysort hid (syear): replace diff_garten = 2 if diff_garten == -1 *gen diff_garten = garten - garten[_n-1] *graph bar (count), over(diff_garten) bysort hid (syear): gen diff_HH_nettoeinkommen = 0 if HH_nettoeinkommen[1] == HH_nettoeinkommen[_N] & syear[1] == 2009 & syear[_N] == 2014 bysort hid (syear): replace diff_HH_nettoeinkommen = 1 if HH_nettoeinkommen[1] != HH_nettoeinkommen[_N] & syear[1] == 2009 & syear[_N] == 2014 tab diff_HH_nettoeinkommen * Before "Inflationsanpassung": * ... households had no change in the netto_household_income over time. * ... households had a change in the netto_household_income over time. *Question? / Reminder: * ALLE Haushalte hatten eine monatliche Nettohaushaltseinkommen-Änderung zwischen 2009 und 2014 ! * Is this based on my "Inflationsanpassung"? bysort hid (syear): gen diff_Quadratmeterpreis = Quadratmeterpreis - Quadratmeterpreis[_n-1] *gen diff_Quadratmeterpreis = Quadratmeterpreis - Quadratmeterpreis[_n-1] sum diff_Quadratmeterpreis if diff_Quadratmeterpreis <= 0 * 227 had 0 or even a negative change in qmp since 2009 sum diff_Quadratmeterpreis if diff_Quadratmeterpreis > 0 * 991 had an increase in qmp since 2009 * Generate the absolute value of the difference -> Brauche ich nicht, da schon gleich diff_ln_Quadratmeterpreis gen log_diff_QMP = log(diff_Quadratmeterpreis) bysort hid (syear): gen diff_ln_Quadratmeterpreis = ln_Quadratmeterpreis - ln_Quadratmeterpreis[_n-1] *tab diff_Quadratmeterpreis *graph bar (count), over(diff_Quadratmeterpreis, label(labsize(vsmall))) scale(*.6) * xlabel(#10) * We can see, that more people did change to a higher Quadratmeterpreis * Generiere Kategoriale Variable * * 0 = nicht umgezogen auf dem Land * 1 = nicht umgezogen in der Stadt * 2 = umgezogen innerhalb Land * 3 = umgezogen innerhalb Stadt * 4 = umgezogen von Stadt aufs Land * 5 = umgezogen von Land auf Stadt * gen umzug_cat = . bysort hid (syear): replace umzug_cat = 0 if apartment_moved_dummy == 0 & ortschaft == 0 & ortschaft[_n-1] == 0 bysort hid (syear): replace umzug_cat = 1 if apartment_moved_dummy == 0 & ortschaft == 1 & ortschaft[_n-1] == 1 bysort hid (syear): replace umzug_cat = 2 if apartment_moved_dummy == 1 & ortschaft == 0 & ortschaft[_n-1] == 0 bysort hid (syear): replace umzug_cat = 3 if apartment_moved_dummy == 1 & ortschaft == 1 & ortschaft[_n-1] == 1 bysort hid (syear): replace umzug_cat = 4 if apartment_moved_dummy == 1 & ortschaft == 1 & ortschaft[_n-1] == 0 bysort hid (syear): replace umzug_cat = 5 if apartment_moved_dummy == 1 & ortschaft == 0 & ortschaft[_n-1] == 1 * PLOT the bars of occurance by region: graph bar, over(umzug_cat) over(ortschaft, relabel(1 "Land" 2 "Stadt")) title("Kategorie: Umzug (2009 - 2014) in Bezug auf Region Stadt/Land:", size(small)) ytitle("Prozent der Wohneinheiten", size(small)) bar(1, color(gray) fcolor(gray)) * ################################## * remove all other/unused variables: * ################################## keep hid syear miete wohnfläche HH_nettoeinkommen Quadratmeterpreis ln_Quadratmeterpreis ortschaft räume mietertyp terasse_balkon keller garten tag period region_moved_dummy apartment_moved_dummy diff_ortschaft diff_räume diff_terasse_balkon diff_keller diff_garten diff_HH_nettoeinkommen diff_Quadratmeterpreis log_diff_QMP diff_ln_Quadratmeterpreis umzug_cat ******** FINALE AUSWERTUNG - MARCEL ******** * ## * ######################## * Model 2: West/Ost MLR: Regressionsgleichung 1) * ######################## * ## regress ln_Quadratmeterpreis i.umzug_cat i.räume i.umzug_cat#i.diff_terasse_balkon i.umzug_cat#i.diff_keller i.umzug_cat#i.diff_garten diff_räume HH_nettoeinkommen wohnfläche, robust *################################ *################################ *Aussage des Modells: Es ist zu beobachten, dass die Quadratmeterpreise in der Stadt im Durchschnitt höher sind als wie auf dem Land. * estat ic *------------------------------------------------------------------------------------------------------------------ * Model | N log likelihood (full model) df R2 AIC BIC RMSE *-------------+---------------------------------------------------------------------------------------------------- * QMP_SL *[Lin-Lin] | 1,109 -2599.913 53 0.2370 5305.826 5571.421 2.5867 *------------------------------------------------------------------------------------------------------------------ * ln(QMP)_SL *[Log-Lin] | 1,109 -149.1316 53 0.2348 404.2631 669.8575 0.28379 *------------------------------------------------------------------------------------------------------------------ * * -> Based on these results, we prefere the Log-Lin Model !!! Better values ! outreg2 using ~/Desktop/outreg2_StadtLandWestOst.tex, tex replace ctitle(ln(QMP) Stadt/Land) * ## * ######################## * Model 2: West/Ost MLR: Regressionsgleichung 2) * ######################## * ## regress diff_ln_Quadratmeterpreis i.umzug_cat i.räume i.umzug_cat#i.diff_terasse_balkon i.umzug_cat#i.diff_keller i.umzug_cat#i.diff_garten diff_räume HH_nettoeinkommen wohnfläche, robust outreg2 using ~/Desktop/outreg2_StadtLandWestOst.tex, tex append ctitle(diff_ln(QMP) Stadt/Land) * Results - COEFPLOT: coefplot, drop(_cons) mcolor(black) msize(0.5) xline(0) mlabposition(6) mlabsize(vsmall) mlabgap(-1.8) mlabformat("%5.3f") mlabcolor(red) ciopts(color(navy)) /// mlabel(cond(@pval<0.01, "***", /// cond(@pval<0.05, "**", /// cond(@pval<0.10, "*", "")))) /// ylabel(,labsize(1.4)) xlabel(,labsize(2)) /// ysize(12) /// xsize(8) /// headings(2.räume = "{bf:Anzahl der Räume}" /// 1.umzug_cat = "{bf:Kategorie: Umzug}" /// 1.umzug_cat#2.terasse_balkon = "{bf:Kategorie: Umzug#Ausstattung}" /// 1.umzug_cat#1.diff_terasse_balkon = "{bf:Kategorie: {&Delta}-Ausstattung - Umzug#Terasse/Balkon}" /// 1.umzug_cat#1.diff_keller = "{bf:Kategorie: {&Delta}-Ausstattung - Umzug#Keller}" /// 1.umzug_cat#1.diff_garten = "{bf:Kategorie: {&Delta}-Ausstattung - Umzug#Garten}" /// 0.umzug_cat = "{bf:Kategorie: Umzug}" /// diff_räume = "{bf:Kategorie: Weitere}",labsize(1.5)) /// coeflabels(2.räume = "2 Zimmer Wohnung" /// 3.räume = "3 Zimmer Wohnung" /// 4.räume = "4 Zimmer Wohnung" /// 5.räume = "5 Zimmer Wohnung" /// 6.räume = "6 Zimmer Wohnung" /// 7.räume = "7 Zimmer Wohnung" /// 8.räume = "8 Zimmer Wohnung" /// 9.räume = "9 Zimmer Wohnung" /// 11.räume = "11 Zimmer Wohnung" /// 0.umzug_cat = "Nicht umgezogen auf dem Land" /// 1.umzug_cat = "Nicht umgezogen in der Stadt" /// 2.umzug_cat = "Umgezogen innerhalb Land" /// 3.umzug_cat = "Umgezogen innerhalb Stadt" /// 4.umzug_cat = "Umgezogen von Stadt aufs Land" /// 5.umzug_cat = "Umgezogen von Land auf Stadt" /// 0.umzug_cat#1.räume = "Land: Nicht umgezogen - 1 Zimmer Wohnung" /// 0.umzug_cat#2.räume = "Land: Nicht umgezogen - 2 Zimmer Wohnung" /// 0.umzug_cat#3.räume = "Land: Nicht umgezogen - 3 Zimmer Wohnung" /// 0.umzug_cat#4.räume = "Land: Nicht umgezogen - 4 Zimmer Wohnung" /// 0.umzug_cat#5.räume = "Land: Nicht umgezogen - 5 Zimmer Wohnung" /// 0.umzug_cat#6.räume = "Land: Nicht umgezogen - 6 Zimmer Wohnung" /// 0.umzug_cat#7.räume = "Land: Nicht umgezogen - 7 Zimmer Wohnung" /// 0.umzug_cat#8.räume = "Land: Nicht umgezogen - 8 Zimmer Wohnung" /// 0.umzug_cat#9.räume = "Land: Nicht umgezogen - 9 Zimmer Wohnung" /// 0.umzug_cat#11.räume = "Land: Nicht umgezogen - 11 Zimmer Wohnung" /// 1.umzug_cat#1.räume = "Stadt: Nicht umgezogen - 1 Zimmer Wohnung" /// 1.umzug_cat#2.räume = "Stadt: Nicht umgezogen - 2 Zimmer Wohnung" /// 1.umzug_cat#3.räume = "Stadt: Nicht umgezogen - 3 Zimmer Wohnung" /// 1.umzug_cat#4.räume = "Stadt: Nicht umgezogen - 4 Zimmer Wohnung" /// 1.umzug_cat#5.räume = "Stadt: Nicht umgezogen - 5 Zimmer Wohnung" /// 1.umzug_cat#6.räume = "Stadt: Nicht umgezogen - 6 Zimmer Wohnung" /// 1.umzug_cat#7.räume = "Stadt: Nicht umgezogen - 7 Zimmer Wohnung" /// 1.umzug_cat#8.räume = "Stadt: Nicht umgezogen - 8 Zimmer Wohnung" /// 1.umzug_cat#9.räume = "Stadt: Nicht umgezogen - 9 Zimmer Wohnung" /// 1.umzug_cat#11.räume = "Stadt: Nicht umgezogen - 11 Zimmer Wohnung" /// 2.umzug_cat#1.räume = "Land: innerhalb umgezogen - 1 Zimmer Wohnung" /// 2.umzug_cat#2.räume = "Land: innerhalb umgezogen - 2 Zimmer Wohnung" /// 2.umzug_cat#3.räume = "Land: innerhalb umgezogen - 3 Zimmer Wohnung" /// 2.umzug_cat#4.räume = "Land: innerhalb umgezogen - 4 Zimmer Wohnung" /// 2.umzug_cat#5.räume = "Land: innerhalb umgezogen - 5 Zimmer Wohnung" /// 2.umzug_cat#6.räume = "Land: innerhalb umgezogen - 6 Zimmer Wohnung" /// 2.umzug_cat#7.räume = "Land: innerhalb umgezogen - 7 Zimmer Wohnung" /// 2.umzug_cat#8.räume = "Land: innerhalb umgezogen - 8 Zimmer Wohnung" /// 2.umzug_cat#9.räume = "Land: innerhalb umgezogen - 9 Zimmer Wohnung" /// 2.umzug_cat#11.räume = "Land: innerhalb umgezogen - 11 Zimmer Wohnung" /// 3.umzug_cat#1.räume = "Stadt: innerhalb umgezogen - 1 Zimmer Wohnung" /// 3.umzug_cat#2.räume = "Stadt: innerhalb umgezogen - 2 Zimmer Wohnung" /// 3.umzug_cat#3.räume = "Stadt: innerhalb umgezogen - 3 Zimmer Wohnung" /// 3.umzug_cat#4.räume = "Stadt: innerhalb umgezogen - 4 Zimmer Wohnung" /// 3.umzug_cat#9.räume = "Stadt: innerhalb umgezogen - 9 Zimmer Wohnung" /// 3.umzug_cat#11.räume = "Stadt: innerhalb umgezogen - 11 Zimmer Wohnung" /// 4.umzug_cat#1.räume = "Von Stadt aufs Land gezogen - 1 Zimmer Wohnung" /// 4.umzug_cat#2.räume = "Von Stadt aufs Land gezogen - 2 Zimmer Wohnung" /// 4.umzug_cat#3.räume = "Von Stadt aufs Land gezogen - 3 Zimmer Wohnung" /// 4.umzug_cat#4.räume = "Von Stadt aufs Land gezogen - 4 Zimmer Wohnung" /// 4.umzug_cat#5.räume = "Von Stadt aufs Land gezogen - 5 Zimmer Wohnung" /// 4.umzug_cat#6.räume = "Von Stadt aufs Land gezogen - 6 Zimmer Wohnung" /// 4.umzug_cat#7.räume = "Von Stadt aufs Land gezogen - 7 Zimmer Wohnung" /// 4.umzug_cat#8.räume = "Von Stadt aufs Land gezogen - 8 Zimmer Wohnung" /// 4.umzug_cat#9.räume = "Von Stadt aufs Land gezogen - 9 Zimmer Wohnung" /// 4.umzug_cat#11.räume = "Von Stadt aufs Land gezogen - 11 Zimmer Wohnung" /// 5.umzug_cat#1.räume = "Vom Land in die Stadt gezogen - 1 Zimmer Wohnung" /// 5.umzug_cat#2.räume = "Vom Land in die Stadt gezogen - 2 Zimmer Wohnung" /// 5.umzug_cat#3.räume = "Vom Land in die Stadt gezogen - 3 Zimmer Wohnung" /// 5.umzug_cat#4.räume = "Vom Land in die Stadt gezogen - 4 Zimmer Wohnung" /// 5.umzug_cat#5.räume = "Vom Land in die Stadt gezogen - 5 Zimmer Wohnung" /// 5.umzug_cat#6.räume = "Vom Land in die Stadt gezogen - 6 Zimmer Wohnung" /// 5.umzug_cat#7.räume = "Vom Land in die Stadt gezogen - 7 Zimmer Wohnung" /// 5.umzug_cat#8.räume = "Vom Land in die Stadt gezogen - 8 Zimmer Wohnung" /// 5.umzug_cat#9.räume = "Vom Land in die Stadt gezogen - 9 Zimmer Wohnung" /// 5.umzug_cat#11.räume = "Vom Land in die Stadt gezogen - 11 Zimmer Wohnung" /// 0.umzug_cat#1.terasse_balkon = "Land: Nicht umgezogen - mit Terasse/Balkon" /// 0.umzug_cat#2.terasse_balkon = "Land: Nicht umgezogen - ohne Terasse/Balkon" /// 1.umzug_cat#1.terasse_balkon = "Stadt: Nicht umgezogen - mit Terasse/Balkon" /// 1.umzug_cat#2.terasse_balkon = "Stadt: Nicht umgezogen - ohne Terasse/Balkon" /// 2.umzug_cat#1.terasse_balkon = "Land: innerhalb umgezogen - mit Terasse/Balkon" /// 2.umzug_cat#2.terasse_balkon = "Land: innerhalb umgezogen - ohne Terasse/Balkon" /// 3.umzug_cat#1.terasse_balkon = "Stadt: innerhalb umgezogen - mit Terasse/Balkon" /// 3.umzug_cat#2.terasse_balkon = "Stadt: innerhalb umgezogen - ohne Terasse/Balkon" /// 4.umzug_cat#1.terasse_balkon = "Von Stadt aufs Land gezogen - mit Terasse/Balkon" /// 4.umzug_cat#2.terasse_balkon = "Von Stadt aufs Land gezogen - ohne Terasse/Balkon" /// 5.umzug_cat#1.terasse_balkon = "Vom Land in die Stadt gezogen - mit Terasse/Balkon" /// 5.umzug_cat#2.terasse_balkon = "Vom Land in die Stadt gezogen - ohne Terasse/Balkon" /// 0.umzug_cat#1.keller = "Land: Nicht umgezogen - mit Keller" /// 0.umzug_cat#2.keller = "Land: Nicht umgezogen - ohne Keller" /// 1.umzug_cat#1.keller = "Stadt: Nicht umgezogen - mit Keller" /// 1.umzug_cat#2.keller = "Stadt: Nicht umgezogen - ohne Keller" /// 2.umzug_cat#1.keller = "Land: innerhalb umgezogen - mit Keller" /// 2.umzug_cat#2.keller = "Land: innerhalb umgezogen - ohne Keller" /// 3.umzug_cat#1.keller = "Stadt: innerhalb umgezogen - mit Keller" /// 3.umzug_cat#2.keller = "Stadt: innerhalb umgezogen - ohne Keller" /// 4.umzug_cat#1.keller = "Von Stadt aufs Land gezogen - mit Keller" /// 4.umzug_cat#2.keller = "Von Stadt aufs Land gezogen - ohne Keller" /// 5.umzug_cat#1.keller = "Vom Land in die Stadt gezogen - mit Keller" /// 5.umzug_cat#2.keller = "Vom Land in die Stadt gezogen - ohne Keller" /// 0.umzug_cat#1.garten = "Land: Nicht umgezogen - mit Garten" /// 0.umzug_cat#2.garten = "Land: Nicht umgezogen - ohne Garten" /// 1.umzug_cat#1.garten = "Stadt: Nicht umgezogen - mit Garten" /// 1.umzug_cat#2.garten = "Stadt: Nicht umgezogen - ohne Garten" /// 2.umzug_cat#1.garten = "Land: innerhalb umgezogen - mit Garten" /// 2.umzug_cat#2.garten = "Land: innerhalb umgezogen - ohne Garten" /// 3.umzug_cat#1.garten = "Stadt: innerhalb umgezogen - mit Garten" /// 3.umzug_cat#2.garten = "Stadt: innerhalb umgezogen - ohne Garten" /// 4.umzug_cat#1.garten = "Von Stadt aufs Land gezogen - mit Garten" /// 4.umzug_cat#2.garten = "Von Stadt aufs Land gezogen - ohne Garten" /// 5.umzug_cat#1.garten = "Vom Land in die Stadt gezogen - mit Garten" /// 5.umzug_cat#2.garten = "Vom Land in die Stadt gezogen - ohne Garten" /// 1.umzug_cat#1.diff_terasse_balkon = "Stadt: Nicht umgezogen - neu mit Terasse/Balkon" /// 1.umzug_cat#2.diff_terasse_balkon = "Stadt: Nicht umgezogen - neu ohne Terasse/Balkon" /// 2.umzug_cat#1.diff_terasse_balkon = "Land: innerhalb umgezogen - neu mit Terasse/Balkon" /// 2.umzug_cat#2.diff_terasse_balkon = "Land: innerhalb umgezogen - neu ohne Terasse/Balkon" /// 3.umzug_cat#1.diff_terasse_balkon = "Stadt: innerhalb umgezogen - neu mit Terasse/Balkon" /// 3.umzug_cat#2.diff_terasse_balkon = "Stadt: innerhalb umgezogen - neu ohne Terasse/Balkon" /// 4.umzug_cat#1.diff_terasse_balkon = "Von Stadt aufs Land gezogen - neu mit Terasse/Balkon" /// 4.umzug_cat#2.diff_terasse_balkon = "Von Stadt aufs Land gezogen - neu ohne Terasse/Balkon" /// 5.umzug_cat#1.diff_terasse_balkon = "Vom Land in die Stadt gezogen - neu mit Terasse/Balkon" /// 5.umzug_cat#2.diff_terasse_balkon = "Vom Land in die Stadt gezogen - neu ohne Terasse/Balkon" /// 1.umzug_cat#1.diff_keller = "Stadt: Nicht umgezogen - neu mit Keller" /// 1.umzug_cat#2.diff_keller = "Stadt: Nicht umgezogen - neu ohne Keller" /// 2.umzug_cat#1.diff_keller = "Land: innerhalb umgezogen - neu mit Keller" /// 2.umzug_cat#2.diff_keller = "Land: innerhalb umgezogen - neu ohne Keller" /// 3.umzug_cat#1.diff_keller = "Stadt: innerhalb umgezogen - neu mit Keller" /// 3.umzug_cat#2.diff_keller = "Stadt: innerhalb umgezogen - neu ohne Keller" /// 4.umzug_cat#1.diff_keller = "Von Stadt aufs Land gezogen - neu mit Keller" /// 4.umzug_cat#2.diff_keller = "Von Stadt aufs Land gezogen - neu ohne Keller" /// 5.umzug_cat#1.diff_keller = "Vom Land in die Stadt gezogen - neu mit Keller" /// 5.umzug_cat#2.diff_keller = "Vom Land in die Stadt gezogen - neu ohne Keller" /// 1.umzug_cat#1.diff_garten = "Stadt: Nicht umgezogen - neu mit Garten" /// 1.umzug_cat#2.diff_garten = "Stadt: Nicht umgezogen - neu ohne Garten" /// 2.umzug_cat#1.diff_garten = "Land: innerhalb umgezogen - neu mit Garten" /// 2.umzug_cat#2.diff_garten = "Land: innerhalb umgezogen - neu ohne Garten" /// 3.umzug_cat#1.diff_garten = "Stadt: innerhalb umgezogen - neu mit Garten" /// 3.umzug_cat#2.diff_garten = "Stadt: innerhalb umgezogen - neu ohne Garten" /// 4.umzug_cat#1.diff_garten = "Von Stadt aufs Land gezogen - neu mit Garten" /// 4.umzug_cat#2.diff_garten = "Von Stadt aufs Land gezogen - neu ohne Garten" /// 5.umzug_cat#1.diff_garten = "Vom Land in die Stadt gezogen - neu mit Garten" /// 5.umzug_cat#2.diff_garten = "Vom Land in die Stadt gezogen - neu ohne Garten" /// diff_räume = "{&Delta} Anzahl der Räume" /// diff_terasse_balkon = "{&Delta} Terasse/Balkon" /// diff_keller = "{&Delta} Keller" /// diff_garten = "{&Delta} Garten" /// HH_nettoeinkommen = "Nettohaushaltseinkommen" /// wohnfläche = "Wohnfläche") * mlabel(cond(@pval<.001, "***", /// * cond(@pval<.01, "**", /// * cond(@pval<.05, "*", "")))) /// * If I want to see the omitted factor levels: *omitted baselevels ******************* DESCRIPTIVE STATISTICS TABLE !!! ***************************** summarize Quadratmeterpreis miete wohnfläche i.ortschaft i.räume i.terasse_balkon i.keller i.garten HH_nettoeinkommen ********************************************************************************** asdoc sum Quadratmeterpreis miete wohnfläche ortschaft räume terasse_balkon keller garten HH_nettoeinkommen, stat(N mean sd min p25 p75 max) replace *Tables of factor variables: tab1 ortschaft räume terasse_balkon keller garten *** PLOT Corr: graph matrix ln_Quadratmeterpreis miete wohnfläche ortschaft räume terasse_balkon keller garten HH_nettoeinkommen, half xla(, ang(90)) plotregion(margin(medium)) * OR in numbers!!!!: pwcorr ln_Quadratmeterpreis miete wohnfläche ortschaft räume terasse_balkon keller garten HH_nettoeinkommen, sig *VIF: estat vif su * ##### * Note: Mein Panel-Datensatz besitzt nun 1218 verschiedene Haushalte (über zwei Jahren also: n=2436) * ##### * Save the resulting dataset * save "/home/marcel/Desktop/Stadt_Land_paneldata.dta", replace ****************************** EXTRA NOTES AND TEST - for curiosity: *********** ******************************************************************************** ***** FRAGE AN MICH SELBST: Wenn ich aber sehen will, Unterschied Wohnnung mit je Räume im vergleich je Region? * Bsp. Ist der Quadratmeterpreis einer 1.Zimmer Wohnung auf dem Land teurer oder günstiger als in der Stadt? regress ln_Quadratmeterpreis i.umzug_cat i.räume i.räume#ortschaft i.umzug_cat#i.diff_terasse_balkon i.umzug_cat#i.diff_keller i.umzug_cat#i.diff_garten diff_räume HH_nettoeinkommen wohnfläche, robust *Andere Versionen: (hier würde zumindest noch eine "F-statistic" herauskommen... sonst missing values in interaction categorie -> F-statistic drop !!) regress ln_Quadratmeterpreis i.umzug_cat i.umzug_cat#i.diff_terasse_balkon i.umzug_cat#i.diff_keller i.umzug_cat#i.diff_garten diff_räume HH_nettoeinkommen wohnfläche, robust ************ ************ * Ansatz: Termin - Absprachen mit Stefan: ************ *Regressionsgleichung 1.1) regress diff_Quadratmeterpreis i.ortschaft i.apartment_moved_dummy diff_räume diff_terasse_balkon diff_keller diff_garten HH_nettoeinkommen wohnfläche, robust *Regressionsgleichung 1.2) regress log_diff_QMP i.ortschaft i.apartment_moved_dummy diff_räume i.diff_terasse_balkon i.diff_keller i.diff_garten HH_nettoeinkommen wohnfläche, robust ************ **** Kleine Extra Rechnung: *** wieviel günstiger wäre durchschnittlich der QMP wirklich zwischen einer 2-Zimmer-Wohnung und einer 1-Zimmer-Wohnung? mean Quadratmeterpreis if ortschaft == 0 & räume == 1 mean Quadratmeterpreis if ortschaft == 0 & räume == 2 mean Quadratmeterpreis if ortschaft == 1 & räume == 1 mean Quadratmeterpreis if ortschaft == 1 & räume == 2 * Das Ergebnis wäre approximantiv: 13,73% günstiger wäre der durchschnittliche QMP, wenn man in einer 2-Zimmer-Wohnung lebt * anstatt in einer 1-Zimmer-Wohnung * Meine Regressionsgleichung hat mir prognostiziert: beta = -0.1178283 * (exp(-0.1178283)-1 ) * 100 = - 11,11 % ********TODO??????: -8 bis 6 ich muss aber -8 zu 0 umkodieren usw, es sind keine negativen values erlaubt! * i.umzug_cat#diff_räume * diff_räume | Freq. Percent Cum. *------------+----------------------------------- * -8 | 1 0.08 0.08 * -5 | 1 0.08 0.16 * -4 | 2 0.16 0.33 * -3 | 11 0.90 1.23 * -2 | 34 2.79 4.02 * -1 | 101 8.29 12.32 * 0 | 889 72.99 85.30 * 1 | 134 11.00 96.31 * 2 | 31 2.55 98.85 * 3 | 9 0.74 99.59 * 4 | 4 0.33 99.92 * 6 | 1 0.08 100.00 *log the results to a text file *log using "/home/marcel/Desktop/ln_Quadratmeterpreis_SL_Modell.txt", text replace *so the output just keeps going *set more off *Marginsplot ZU alter Regressionsgleichung 1) * OLD but GOOD ... not in use anymore... !! regress ln_Quadratmeterpreis i.apartment_moved_dummy#i.region_moved_dummy i.ortschaft margins region_moved_dummy, over(apartment_moved_dummy) *marginsplot, noci marginsplot, x(apartment_moved_dummy) noci *marginsplot, x(apartment_moved_dummy) noci plot1opts(lcolor(red) fcolor(red*0.2)) plot2opts(lcolor(blue) fcolor(blue*0.2)) marginsplot, recast(connected) x(ortschaft) noci /// title("Interaktionsplot: Modell 1 - Stadt/Land)", size(*0.8)) /// subtitle("Geschätzter Quadratmeterpreis zwischen 2009 und 2014", size(*0.8)) /// ylabel(,labsize(small)) /// xlabel(,labsize(small)) /// xtitle("Land/Stadt [0=Land ; 1=Stadt]") /// ytitle("Pr(log(Quadratmeterpreis))") /// legend(on order(1 "Stadt-Region geblieben" 2 "Stadt zu Land gezogen" 3 "Land zu Stadt gezogen" 4 "Land-Region geblieben") pos(11) col(2) ring(0) size(vsmall))