"category": {
             "ratios": {
                 "PC": 0.05,
                 "PN": 0.05,
                 "PS": 0.05,
                 "U": 0.85,
             },
         },
     },
 ),
 hh_id=patients.household_as_of(
     "2020-02-01",
     returning="pseudo_id",
     return_expectations={
         "int": {
             "distribution": "normal",
             "mean": 1000,
             "stddev": 200
         },
         "incidence": 1,
     },
 ),
 hh_size=patients.household_as_of("2020-02-01",
                                  returning="household_size",
                                  return_expectations={
                                      "int": {
                                          "distribution": "normal",
                                          "mean": 8,
                                          "stddev": 1
                                      },
                                      "incidence": 1,
                                  }),
                    "1": 0.8,
                    "5": 0.1,
                    "3": 0.1
                }
            },
            "incidence": 0.75,
        },
    ),

    # HOUSEHOLD INFORMATION
    household_id=patients.household_as_of(
        "2020-02-01",
        returning="pseudo_id",
        return_expectations={
            "int": {
                "distribution": "normal",
                "mean": 1000,
                "stddev": 200
            },
            "incidence": 1,
        },
    ),
    household_size=patients.household_as_of(
        "2020-02-01",
        returning="household_size",
        return_expectations={
            "int": {
                "distribution": "normal",
                "mean": 3,
                "stddev": 1
            },
            "incidence": 1,
Пример #3
0
    ),
    
    #primis codes within past year 
    primis_carehome_pastyear=patients.with_these_clinical_events(
        primis_codes,
        between=["index_date - 1 year", "index_date"], 
        returning="binary_flag",
        return_expectations={"incidence": 0.1},
    ),

    # HOUSEHOLD RELATED VARIABLES 
    ## household ID  
    household_id=patients.household_as_of(
        "index_date",
        returning="pseudo_id",
        return_expectations={
            "int": {"distribution": "normal", "mean": 1000, "stddev": 200},
            "incidence": 1,
        },
    ),
    ## household size   
    household_size=patients.household_as_of(
        "index_date",
        returning="household_size",
        return_expectations={
            "int": {"distribution": "normal", "mean": 3, "stddev": 1},
            "incidence": 1,
        },
    ),
    # mixed household flag 
    nontpp_household=patients.household_as_of(
        "index_date",