Domain: Financial & Accounting

Using the full local dataset `Financials.csv`, compute the following structural diagnostics.

Use only this file.

Instructions:

1. Read `Financials.csv`.
2. Convert `Dividend Yield`, `Price/Sales`, and `Market Cap` to numeric.
3. Use the full dataset after those conversions succeed for the required columns.
4. Compute:
   - `total_observations`: total number of rows in the universe
   - `distinct_sectors`: total number of distinct `Sector` values
   - `median_dividend_yield`: the cross-sectional median of `Dividend Yield`
5. Construct the inverse valuation signal for each security as:

   \[
   \text{inverse\_ps} = \frac{1}{\text{Price/Sales}}
   \]

6. Standardize `Market Cap` cross-sectionally using the population standard deviation and compute its dispersion magnitude as the mean absolute deviation from the mean in standardized space.
7. Within each sector, neutralize the inverse valuation signal by subtracting the sector mean to obtain the sector-neutral projection.
8. Compute the Structural Distortion Intensity as:

   \[
   \frac{\operatorname{Var}(\text{sector-neutral projection})}{\operatorname{Var}(\text{inverse\_ps})}
   \]

   using population variance.

9. Construct the covariance matrix using the sector-neutral projection alone. Since this is a single variable, the covariance matrix is `1 x 1`, and its leading eigenvalue is that covariance value, using population covariance.
10. Among securities whose `Dividend Yield` is strictly above the cross-sectional median, identify the security with the largest absolute sector-neutral projection magnitude. If there is a tie, choose the lexicographically smallest `Symbol`.

Return only a single Python dictionary with exactly these keys:

```python
{
    "total_observations": ...,
    "distinct_sectors": ...,
    "median_dividend_yield": ...,
    "mean_market_cap_dispersion_mad_z": ...,
    "structural_distortion_intensity": ...,
    "leading_eigenvalue": ...,
    "selected_symbol": ...,
    "selected_sector": ...,
    "selected_sector_neutral_projection": ...,
    "selected_inverse_ps": ...,
    "selected_dividend_yield": ...,
}
```

Round all non-integer numeric outputs to exactly 6 decimal places using round-half-to-even.

Do not include any additional text.

Grading rubric:
criterion: The final answer is a Python dictionary with exactly 11 keys matching the required output schema.
weight: 5
criterion: The value of total_observations is exactly 505.
weight: 5
criterion: The value of distinct_sectors is exactly 11.
weight: 5
criterion: The value of median_dividend_yield is exactly 1.769255.
weight: 5
criterion: The value of mean_market_cap_dispersion_mad_z is exactly 0.509023.
weight: 5
criterion: The value of structural_distortion_intensity is exactly 0.926230.
weight: 5
criterion: The value of leading_eigenvalue is exactly 0.337192.
weight: 5
criterion: The selected security fields are exactly selected_symbol='CAH' and selected_sector='Health Care'.
weight: 5
criterion: The selected security metrics are exactly selected_sector_neutral_projection=4.060219, selected_inverse_ps=4.732349, and selected_dividend_yield=2.839423.
weight: 5
criterion: The inverse valuation signal is defined exactly as 1 / (Price/Sales), sector neutralization subtracts the sector mean, and the selected security is chosen by the largest absolute sector-neutral projection among rows with Dividend Yield strictly above the median.
weight: 5
criterion: All non-integer numeric outputs are rounded to exactly 6 decimal places using round-half-to-even.
weight: 5

Golden answer:
```python
import csv
import math
from collections import defaultdict
from pathlib import Path


def main() -> None:
    csv_path = Path(__file__).with_name("Financials.csv")
    records = []

    with csv_path.open(newline="", encoding="utf-8") as handle:
        reader = csv.DictReader(handle)
        for row in reader:
            dividend_yield = float(row["Dividend Yield"])
            price_to_sales = float(row["Price/Sales"])
            market_cap = float(row["Market Cap"])
            records.append(
                {
                    "Symbol": row["Symbol"],
                    "Sector": row["Sector"],
                    "Dividend Yield": dividend_yield,
                    "Inverse_PS": 1.0 / price_to_sales,
                    "Market Cap": market_cap,
                }
            )

    total_observations = len(records)
    distinct_sectors = len({record["Sector"] for record in records})

    dividend_yields = sorted(record["Dividend Yield"] for record in records)
    if total_observations % 2 == 1:
        median_dividend_yield = dividend_yields[total_observations // 2]
    else:
        median_dividend_yield = (
            dividend_yields[total_observations // 2 - 1] + dividend_yields[total_observations // 2]
        ) / 2

    market_caps = [record["Market Cap"] for record in records]
    mean_market_cap = sum(market_caps) / total_observations
    std_market_cap = math.sqrt(
        sum((market_cap - mean_market_cap) ** 2 for market_cap in market_caps) / total_observations
    )
    mean_market_cap_dispersion_mad_z = (
        sum(abs((market_cap - mean_market_cap) / std_market_cap) for market_cap in market_caps)
        / total_observations
    )

    sector_inverse_ps = defaultdict(list)
    for record in records:
        sector_inverse_ps[record["Sector"]].append(record["Inverse_PS"])
    sector_means = {
        sector: sum(values) / len(values) for sector, values in sector_inverse_ps.items()
    }

    for record in records:
        record["Sector_Neutral_Projection"] = record["Inverse_PS"] - sector_means[record["Sector"]]

    inverse_ps_values = [record["Inverse_PS"] for record in records]
    inverse_ps_mean = sum(inverse_ps_values) / total_observations
    inverse_ps_variance = (
        sum((value - inverse_ps_mean) ** 2 for value in inverse_ps_values) / total_observations
    )

    neutral_values = [record["Sector_Neutral_Projection"] for record in records]
    neutral_mean = sum(neutral_values) / total_observations
    neutral_variance = (
        sum((value - neutral_mean) ** 2 for value in neutral_values) / total_observations
    )

    structural_distortion_intensity = neutral_variance / inverse_ps_variance
    leading_eigenvalue = neutral_variance

    eligible = [
        record for record in records if record["Dividend Yield"] > median_dividend_yield
    ]
    max_abs_projection = max(abs(record["Sector_Neutral_Projection"]) for record in eligible)
    selected = sorted(
        [
            record
            for record in eligible
            if abs(record["Sector_Neutral_Projection"]) == max_abs_projection
        ],
        key=lambda record: record["Symbol"],
    )[0]

    result = {
        "total_observations": total_observations,
        "distinct_sectors": distinct_sectors,
        "median_dividend_yield": round(median_dividend_yield, 6),
        "mean_market_cap_dispersion_mad_z": round(mean_market_cap_dispersion_mad_z, 6),
        "structural_distortion_intensity": round(structural_distortion_intensity, 6),
        "leading_eigenvalue": round(leading_eigenvalue, 6),
        "selected_symbol": selected["Symbol"],
        "selected_sector": selected["Sector"],
        "selected_sector_neutral_projection": round(selected["Sector_Neutral_Projection"], 6),
        "selected_inverse_ps": round(selected["Inverse_PS"], 6),
        "selected_dividend_yield": round(selected["Dividend Yield"], 6),
    }
    print(result)


if __name__ == "__main__":
    main()
```

The original draft golden answer solved a different orthogonalized factor-model problem and did not match the prompt. This replacement solution follows the prompt directly on the local `Financials.csv` file: it computes the cross-sectional median dividend yield, builds the inverse valuation signal as `1 / (Price/Sales)`, standardizes market cap to get mean absolute deviation in z-score space, sector-neutralizes the inverse valuation signal, computes the variance ratio and the `1 x 1` covariance-matrix eigenvalue, and then selects the above-median-dividend security with the largest absolute sector-neutral projection. All non-integer outputs are rounded to 6 decimal places using round-half-to-even.

Verified result:

```python
{
    'total_observations': 505,
    'distinct_sectors': 11,
    'median_dividend_yield': 1.769255,
    'mean_market_cap_dispersion_mad_z': 0.509023,
    'structural_distortion_intensity': 0.92623,
    'leading_eigenvalue': 0.337192,
    'selected_symbol': 'CAH',
    'selected_sector': 'Health Care',
    'selected_sector_neutral_projection': 4.060219,
    'selected_inverse_ps': 4.732349,
    'selected_dividend_yield': 2.839423
}
```