Example #1
0
def test_calibration():
    year = 2006
    input_data_frame = get_input_data_frame(year)
    survey_scenario = SurveyScenario().init_from_data_frame(
        input_data_frame = input_data_frame,
        year = year,
        )
    survey_scenario.initialize_weights()
    calibration = Calibration()
    calibration.set_survey_scenario(survey_scenario)
    calibration.parameters['method'] = 'linear'
    print calibration.initial_total_population
    calibration.total_population = calibration.initial_total_population * 1.123
    print calibration.total_population

    filename = os.path.join(
        openfisca_france_data_location,
        "openfisca_france_data",
        "calibrations",
        "calib_2006.csv"
        )
    calibration.set_inputs_margins_from_file(filename, 2006)
    calibration.set_parameters('invlo', 3)
    calibration.set_parameters('up', 3)
    calibration.set_parameters('method', 'logit')
    calibration.calibrate()
def test_calibration():
    year = 2009
    input_data_frame = get_input_data_frame(year)
    survey_scenario = SurveyScenario().init_from_data_frame(
        input_data_frame = input_data_frame,
        year = year,
        )
    survey_scenario.initialize_weights()
    calibration = Calibration(survey_scenario)
    calibration.parameters['method'] = 'linear'
    print calibration.initial_total_population
    calibration.total_population = calibration.initial_total_population * 1.123
    print calibration.total_population

    filename = os.path.join(
        openfisca_france_data_location,
        "openfisca_france_data",
        "calibrations",
        "calib_2006.csv"
        )
    calibration.set_inputs_margins_from_file(filename, 2006)
    calibration.set_parameters('invlo', 3)
    calibration.set_parameters('up', 3)
    calibration.set_parameters('method', 'logit')
    calibration.calibrate()
def create_survey_scenario(year=None):
    assert year is not None
    input_data_frame = get_input_data_frame(year)
    survey_scenario = SurveyScenario().init_from_data_frame(
        input_data_frame=input_data_frame,
        year=year,
    )
    survey_scenario.initialize_weights()

    return survey_scenario