def get_table8(df, reg_sens2, iv_sens2):

    # Put coefficients, standard errors and stars for significance level in a table
    regs = (reg_sens2, iv_sens2)
    table_string = outreg(regs, [
        'flyktingandel', 'nonOECDshare_diff', 'mean_hvac_share', 'mean_unempl',
        'munempldiff', 'mskattekrdiff', 'mbefdiff', 'ekbistandpc_diff',
        'dsmastad', 'dstorstad', 'dsv_maj_1', 'dseatsmp_1', 'dseatsop_1',
        'panel8891', 'const'
    ], [
        'Refugee inflow', 'Change in share of immigrants',
        'Vacant housing rate', 'Unemployment rate',
        'Change in unemployment rate', 'Change in tax base',
        'Change in population size', 'Change in welfare spending',
        'Small-sized population', 'Large-sized population',
        'Socialist majority', 'Green Party', 'New Democrats', 'Panel 1988/91',
        'Constant'
    ],
                          digits=4,
                          stars=True)

    # Save the table string to a file
    results_path = 'Tables/table8_aux.tex'
    with open(results_path, 'w') as f:
        f.write(table_string)

    # Save separate file with table notes
    notes = "Sample size is {}.".format(reg_sens2.N)
    write_notes(notes, results_path)
def get_table6(df, reg1, reg2, reg3, iv):

    # Put coefficients, standard errors and stars for significance level in a table
    regs = (reg1, reg2, reg3, iv)
    table_string = outreg(regs, [
        'flyktingandel_tplus1', 'flyktingandel_tplus2', 'flyktingandel_tplus3',
        'nonOECDshare_diff_tplus1', 'nonOECDshare_diff_tplus2',
        'nonOECDshare_diff_tplus3'
    ], [
        'Refugee inflow 85/88', 'Refugee inflow 88/91', 'Refugee inflow 91/94',
        'Change in share of immigrants 85/88',
        'Change in share of immigrants 88/91',
        'Change in share of immigrants 91/94'
    ],
                          digits=4,
                          stars=True)

    # Save the table string to a file
    results_path = 'Tables/table6_aux.tex'
    with open(results_path, 'w') as f:
        f.write(table_string)

    # Save separate file with table notes
    notes = "Sample size is {}.".format(reg1.N)
    write_notes(notes, results_path)
def get_table5(df, result):

    regs = (result['arbetare_t_1'], result['tjman_t_1'])

    # Put coefficients, standard errors and stars for significance level in a table
    table_string = outreg(
        regs, ['nonOECDshare_diff', 'regressor', 'interaction_second'],
        ['Change in share of immigrants', 'Dummy', 'Interaction term'],
        digits=4,
        stars=True)

    # Save the table string to a file
    results_path = 'Tables/table5_aux.tex'
    with open(results_path, 'w') as f:
        f.write(table_string)