Hello, Quarto

Polars version: 1.31.0

polars

shape: (4_320,)
Series: 'strata' [enum]
[
    "[0.00, 0.10)"
    "[0.00, 0.10)"
    "[0.00, 0.10)"
    "[0.00, 0.10)"
    "[0.10, 0.20)"
    …
    "0.9"
    "1.0"
    "1.0"
    "1.0"
    "1.0"
]

try polars

create list data to adjust polars

create adjusted data list polars

New extract aj estimate by assumptions polars

Create aj_estimates_data

Assumption: censoring=adjusted, competing=adjusted_as_negative, rows=60
Assumption: censoring=excluded, competing=adjusted_as_negative, rows=57
Assumption: censoring=adjusted, competing=adjusted_as_censored, rows=60
Assumption: censoring=excluded, competing=adjusted_as_censored, rows=57
Assumption: censoring=adjusted, competing=excluded, rows=44
Exploded data: shape: (4_500, 4)
┌──────────────┬───────┬───────────┬────────────────────┐
│ strata       ┆ reals ┆ times     ┆ fixed_time_horizon │
│ ---          ┆ ---   ┆ ---       ┆ ---                │
│ str          ┆ i64   ┆ f64       ┆ f64                │
╞══════════════╪═══════╪═══════════╪════════════════════╡
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 1.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 3.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 5.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 1.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 3.0                │
│ …            ┆ …     ┆ …         ┆ …                  │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 5.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 1.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 5.0                │
└──────────────┴───────┴───────────┴────────────────────┘
AJ estimates per strata censored: shape: (60, 3)
┌──────────────┬────────────────────┬───────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_censored_est │
│ ---          ┆ ---                ┆ ---               │
│ str          ┆ f64                ┆ f64               │
╞══════════════╪════════════════════╪═══════════════════╡
│ 0.1          ┆ 5.0                ┆ 33.0              │
│ 1.0          ┆ 5.0                ┆ 1.0               │
│ 0.8          ┆ 5.0                ┆ 82.0              │
│ [0.70, 0.80) ┆ 1.0                ┆ 9.0               │
│ 0.5          ┆ 5.0                ┆ 80.0              │
│ …            ┆ …                  ┆ …                 │
│ [0.10, 0.20) ┆ 5.0                ┆ 113.0             │
│ [0.30, 0.40) ┆ 1.0                ┆ 39.0              │
│ 0.2          ┆ 1.0                ┆ 72.0              │
│ 0.3          ┆ 3.0                ┆ 75.0              │
│ [0.20, 0.30) ┆ 5.0                ┆ 64.0              │
└──────────────┴────────────────────┴───────────────────┘
AJ estimates per strata competing: shape: (44, 3)
┌──────────────┬────────────────────┬────────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_competing_est │
│ ---          ┆ ---                ┆ ---                │
│ str          ┆ f64                ┆ f64                │
╞══════════════╪════════════════════╪════════════════════╡
│ [0.00, 0.10) ┆ 3.0                ┆ 33.0               │
│ 0.6          ┆ 1.0                ┆ 2.0                │
│ 0.2          ┆ 1.0                ┆ 2.0                │
│ [0.30, 0.40) ┆ 3.0                ┆ 6.0                │
│ 0.5          ┆ 5.0                ┆ 9.0                │
│ …            ┆ …                  ┆ …                  │
│ 0.8          ┆ 5.0                ┆ 8.0                │
│ 0.3          ┆ 3.0                ┆ 10.0               │
│ 0.8          ┆ 3.0                ┆ 8.0                │
│ [0.10, 0.20) ┆ 5.0                ┆ 11.0               │
│ 0.6          ┆ 3.0                ┆ 5.0                │
└──────────────┴────────────────────┴────────────────────┘
Assumption: censoring=excluded, competing=excluded, rows=43
Assumption: censoring=adjusted, competing=adjusted_as_negative, rows=60
Assumption: censoring=excluded, competing=adjusted_as_negative, rows=57
Assumption: censoring=adjusted, competing=adjusted_as_censored, rows=60
Assumption: censoring=excluded, competing=adjusted_as_censored, rows=57
Assumption: censoring=adjusted, competing=excluded, rows=44
Exploded data: shape: (4_500, 4)
┌──────────────┬───────┬───────────┬────────────────────┐
│ strata       ┆ reals ┆ times     ┆ fixed_time_horizon │
│ ---          ┆ ---   ┆ ---       ┆ ---                │
│ str          ┆ i64   ┆ f64       ┆ f64                │
╞══════════════╪═══════╪═══════════╪════════════════════╡
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 1.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 3.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 5.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 1.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 3.0                │
│ …            ┆ …     ┆ …         ┆ …                  │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 5.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 1.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 5.0                │
└──────────────┴───────┴───────────┴────────────────────┘
AJ estimates per strata censored: shape: (60, 3)
┌──────────────┬────────────────────┬───────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_censored_est │
│ ---          ┆ ---                ┆ ---               │
│ str          ┆ f64                ┆ f64               │
╞══════════════╪════════════════════╪═══════════════════╡
│ 0.3          ┆ 3.0                ┆ 75.0              │
│ 0.9          ┆ 1.0                ┆ 83.0              │
│ [0.20, 0.30) ┆ 1.0                ┆ 70.0              │
│ [0.50, 0.60) ┆ 1.0                ┆ 19.0              │
│ [0.60, 0.70) ┆ 3.0                ┆ 11.0              │
│ …            ┆ …                  ┆ …                 │
│ [0.00, 0.10) ┆ 3.0                ┆ 345.0             │
│ 0.3          ┆ 1.0                ┆ 78.0              │
│ [0.90, 1.00] ┆ 1.0                ┆ 7.0               │
│ [0.40, 0.50) ┆ 1.0                ┆ 34.0              │
│ [0.10, 0.20) ┆ 5.0                ┆ 137.0             │
└──────────────┴────────────────────┴───────────────────┘
AJ estimates per strata competing: shape: (44, 3)
┌──────────────┬────────────────────┬────────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_competing_est │
│ ---          ┆ ---                ┆ ---                │
│ str          ┆ f64                ┆ f64                │
╞══════════════╪════════════════════╪════════════════════╡
│ 0.5          ┆ 5.0                ┆ 11.0               │
│ [0.90, 1.00] ┆ 3.0                ┆ 1.0                │
│ 0.1          ┆ 3.0                ┆ 1.0                │
│ 0.5          ┆ 3.0                ┆ 10.0               │
│ 0.6          ┆ 3.0                ┆ 4.0                │
│ …            ┆ …                  ┆ …                  │
│ [0.20, 0.30) ┆ 1.0                ┆ 5.0                │
│ [0.40, 0.50) ┆ 3.0                ┆ 2.0                │
│ 0.9          ┆ 1.0                ┆ 6.0                │
│ [0.30, 0.40) ┆ 5.0                ┆ 4.0                │
│ 0.9          ┆ 5.0                ┆ 7.0                │
└──────────────┴────────────────────┴────────────────────┘
Assumption: censoring=excluded, competing=excluded, rows=43
Assumption: censoring=adjusted, competing=adjusted_as_negative, rows=60
Assumption: censoring=excluded, competing=adjusted_as_negative, rows=57
Assumption: censoring=adjusted, competing=adjusted_as_censored, rows=60
Assumption: censoring=excluded, competing=adjusted_as_censored, rows=57
Assumption: censoring=adjusted, competing=excluded, rows=44
Exploded data: shape: (4_500, 4)
┌──────────────┬───────┬───────────┬────────────────────┐
│ strata       ┆ reals ┆ times     ┆ fixed_time_horizon │
│ ---          ┆ ---   ┆ ---       ┆ ---                │
│ str          ┆ i64   ┆ f64       ┆ f64                │
╞══════════════╪═══════╪═══════════╪════════════════════╡
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 1.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 3.0                │
│ [0.00, 0.10) ┆ 0     ┆ 3.008686  ┆ 5.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 1.0                │
│ [0.80, 0.90) ┆ 0     ┆ 0.2491345 ┆ 3.0                │
│ …            ┆ …     ┆ …         ┆ …                  │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.3059905 ┆ 5.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 1.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 3.0                │
│ 0.8          ┆ 0     ┆ 0.8083693 ┆ 5.0                │
└──────────────┴───────┴───────────┴────────────────────┘
AJ estimates per strata censored: shape: (60, 3)
┌──────────────┬────────────────────┬───────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_censored_est │
│ ---          ┆ ---                ┆ ---               │
│ str          ┆ f64                ┆ f64               │
╞══════════════╪════════════════════╪═══════════════════╡
│ [0.20, 0.30) ┆ 5.0                ┆ 63.0              │
│ 0.5          ┆ 3.0                ┆ 80.0              │
│ 0.1          ┆ 5.0                ┆ 36.0              │
│ [0.10, 0.20) ┆ 5.0                ┆ 139.0             │
│ [0.70, 0.80) ┆ 1.0                ┆ 9.0               │
│ …            ┆ …                  ┆ …                 │
│ [0.90, 1.00] ┆ 3.0                ┆ 5.0               │
│ [0.20, 0.30) ┆ 1.0                ┆ 67.0              │
│ [0.40, 0.50) ┆ 1.0                ┆ 32.0              │
│ 0.7          ┆ 3.0                ┆ 81.0              │
│ [0.30, 0.40) ┆ 5.0                ┆ 27.0              │
└──────────────┴────────────────────┴───────────────────┘
AJ estimates per strata competing: shape: (44, 3)
┌──────────────┬────────────────────┬────────────────────┐
│ strata       ┆ fixed_time_horizon ┆ real_competing_est │
│ ---          ┆ ---                ┆ ---                │
│ str          ┆ f64                ┆ f64                │
╞══════════════╪════════════════════╪════════════════════╡
│ 0.5          ┆ 3.0                ┆ 10.0               │
│ [0.30, 0.40) ┆ 3.0                ┆ 4.0                │
│ 0.3          ┆ 1.0                ┆ 5.0                │
│ 0.1          ┆ 5.0                ┆ 1.0                │
│ 0.7          ┆ 5.0                ┆ 9.0                │
│ …            ┆ …                  ┆ …                  │
│ 0.7          ┆ 3.0                ┆ 7.0                │
│ [0.20, 0.30) ┆ 1.0                ┆ 5.0                │
│ 0.1          ┆ 3.0                ┆ 1.0                │
│ [0.40, 0.50) ┆ 5.0                ┆ 2.0                │
│ [0.10, 0.20) ┆ 1.0                ┆ 13.0               │
└──────────────┴────────────────────┴────────────────────┘
Assumption: censoring=excluded, competing=excluded, rows=43

Check strata values

shape: (4_320, 2)
┌──────────────┬───────────┐
│ strata       ┆ is_in_df2 │
│ ---          ┆ ---       │
│ str          ┆ bool      │
╞══════════════╪═══════════╡
│ [0.00, 0.10) ┆ true      │
│ [0.00, 0.10) ┆ true      │
│ [0.00, 0.10) ┆ true      │
│ [0.00, 0.10) ┆ true      │
│ [0.10, 0.20) ┆ true      │
│ …            ┆ …         │
│ 0.9          ┆ true      │
│ 1.0          ┆ true      │
│ 1.0          ┆ true      │
│ 1.0          ┆ true      │
│ 1.0          ┆ true      │
└──────────────┴───────────┘
shape: (0, 2)
┌────────┬───────────┐
│ strata ┆ is_in_df2 │
│ ---    ┆ ---       │
│ str    ┆ bool      │
╞════════╪═══════════╡
└────────┴───────────┘

Cast varibles with hacks

Observable stuff