inhabit_matrix

Combine dwellings and households function to inhabit matrix.

This module creates a cross-tabulated inhabit matrix by matching household demographics to dwelling characteristics. It processes SOEP (Socio-Economic Panel) survey data to model housing occupancy patterns over time.

To completely run this script, you need access to the SOEP Core panel data. Apply for data access here: https://www.diw.de/en/diw_01.c.601584.en/data_access.html

You can run the script without access to the SOEP Core panel data, relying on pre-computed data which you will find in data/evidence.

Functions

add_nans(inhabit_v, df_hh, nans_v, ip)

Add NaN handling to inhabit by upweighting records and including missing.

adjust_inhabit(ip, inhabit, dwell_stock, ...)

Synchronize inhabit matrix with household and dwelling stocks.

adjust_stocks(ip, inhabit, dwell_stock, ...)

Update stocks with external data and synchronize with inhabit matrix.

create_helping_csvs(ip)

Load SOEP-csvs and attach all variables needed to household/dwelling/wum.

create_hh_mask(hh_stock, ip, hh_key)

Create boolean mask for filtering household stock by characteristics.

dwelling_disagg(ip, df, year)

Create dataframe from dwelling data to be included in inhabit matrix.

get_full_inhabits(inhabit_v, inhabit_move_v, ...)

Expand sparse inhabit matrix to full dimensional space with aggregations.

get_hh_matches(inhabit, row)

Get matching households in inhabit for a given household segment.

household_disagg(ip, df, year)

Create dataframe from household data to be included in inhabit matrix.

inh_projection(ip, year)

Run yearly projection loop for housing market simulation.

main(*args, **flags)

Combine household and dwelling data into inhabit matrix.

run_model(ip)

Main model execution orchestrating inhabit matrix creation.

save_update_mean_ls(inhabit, ip, year)

Save and update weighted mean living space across stocks and inhabit.

set_occupation(dwell_row, new_occ, ...)

Set dwelling occupation value and calculate leftover occupancy.

update_mean_ls_inh(ip)

Update mean living space in inhabit matrix from household/dwelling stocks.

yearly_inhabit(ip, df_household, ...)

Process single year's household and dwelling data into inhabit matrix.