structural
PathEstimates
Standardized structural coefficients for one endogenous latent variable.
Attributes ---------- outcome Name of the endogenous latent variable. predictors Names of its direct predictors, matching the order of ``beta``. beta Standardized path coefficients. These apply to z-scores of the latent variables, not to raw indicator values. se Analytic standard errors conditional on ``Phi``. Understated; see the module docstring. r_squared Proportion of the endogenous latent's variance explained. disturbance_variance ``1 - r_squared`` in the standardized metric. vif Variance inflation factor per predictor. n_obs Sample size used.
disattenuate
Correct an observed correlation for attenuation due to measurement error.
``rho = r / sqrt(rel_x * rel_y)``
The correction can push the estimate outside [-1, 1] when the observed correlation is high relative to the reliabilities. That is not a numerical artefact to be clipped away quietly: it means the congeneric measurement model is inconsistent with the observed data, usually because two "constructs" are not distinct. The value is returned uncapped and the caller decides what to say about it.
effect_decomposition
Decompose a recursive path model into direct, total and indirect effects.
``beta_matrix[i, j]`` is the direct effect of latent ``j`` on latent ``i``. For a recursive (acyclic) system the total effects are ``(I - B)^-1 - I`` and the indirect effects are total minus direct.
This matters for interpretation. A coefficient in a model that also contains a mediator is a direct effect with the mediated pathway conditioned away. Reporting four such coefficients side by side as though they were comparable "contributions to risk" is the Table 2 fallacy (Westreich & Greenland 2013), and total effects are usually the quantity a reader has in mind.
indirect_effect_delta_se
Delta-method standard error of the product ``a * b``.
``SE = sqrt(b^2 * SE_a^2 + a^2 * SE_b^2)``
Provided for completeness, with a warning attached: the sampling distribution of a product is skewed, so a symmetric Wald interval built from this quantity has poor coverage in small samples. More importantly, a mediation coefficient estimated this way is not a causal mechanism estimate without assumptions that observational data cannot check (Bullock, Green & Ha 2010).
latent_correlations
Disattenuate a composite correlation matrix into a latent correlation matrix.
Returns the matrix and a list of warning strings. Off-diagonal entries whose absolute value exceeds 1 after correction are reported by name and left in place; :func:`ehs_risk_sem.model.fit` decides whether to repair the matrix and says so in its output when it does.
solve_paths
Solve the standardized normal equations for one endogenous latent variable.
``beta = R_xx^-1 r_xy`` where ``R_xx`` is the predictor block of ``Phi`` and ``r_xy`` the predictor-outcome column.
Standard errors use ``SE(b_j) = sqrt((1 - R^2) * (R_xx^-1)_jj / (n - k - 1))``, the usual standardized-regression expression. It conditions on ``Phi``.