persona_db/engines/socio.py
Socioeconomic engine — social class, education, salary, family influence.
Ownership: Agent 2. Sibling agents may import SocioeconomicEngine.
:::info Fonte
Módulo persona_db.engines.socio — 187 linhas · 1 classe(s) · 0 função(ões) pública(s). Ver no GitHub
:::
Classes
class SocioeconomicEngine
Deterministic socioeconomic attribute generator.
| Atributo de classe | Valor |
|---|---|
SOCIAL_CLASSES | ['A', 'B1', 'B2', 'C1', 'C2', 'D_E'] |
MOBILITY_MATRIX | [[0.62, 0.2, 0.1, 0.05, 0.02, 0.01], [0.08, 0.55, 0.22, 0.1, 0.03, 0.02], [0.03, 0.1, 0.58, 0.2, 0.06, 0.03],… |
SECTOR_SHIFT | {'aberto': 0.0, 'agro': -0.08, 'comercio': -0.02, 'construcao': -0.06, 'educacao': -0.04, 'saude': 0.03, 'ind… |
sample_class()
@classmethod
def sample_class(cls, rng: SeededRNG, parent_class: str | None) -> str
Sample a social class.
With a known parent class the intergenerational mobility matrix drives the draw; otherwise the marginal SOCIAL_CLASS_DIST applies.
persona_db/engines/socio.py:51
education_level()
@classmethod
def education_level(cls, rng: SeededRNG, parent_education: str | None, income_std: float, class_label: str) -> str
Sample attained education from ['fundamental','medio','superior','pos'].
A multinomial logit model where parent education, household income (per std, coefficient 0.23) and social-class premium shift the odds.
persona_db/engines/socio.py:69
salary()
@staticmethod
def salary(rng: SeededRNG, education: str, experience_years: float, sector: str, gender_female: bool, race_minority: bool, nepotism_log_bonus: float=0.0) -> float
Annual gross salary in BRL (log-normal model with covariates).
log(salary) = 5.2 + education_premium + 0.022exp - 0.0002exp**2 + sector_shift - 0.14 (female) - 0.11 (minority) + nepotism bonus + eps, eps ~ Normal(0, 0.35) Rounded to 2 decimals with a BRL 1200 floor.
persona_db/engines/socio.py:124
family_influence_weight()
@staticmethod
def family_influence_weight(rng: SeededRNG, sector_career: str, sector_parent: str | None) -> float
Multiplier in [1.0, 1.35] reflecting sector nepotism.
A parent already embedded in the chosen sector raises the child's odds/pull through connections; different or absent parent = 1.0.