ehs-risk-sem
Back to ehs-risk-sem

measurement

FactorSolution

FactorSolution(name: 'str', indicators: 'List[str]', loadings: 'np.ndarray', uniquenesses: 'np.ndarray', communalities: 'np.ndarray', omega: 'float', alpha: 'float', ave: 'float', determinacy: 'float', guttman_bound: 'float', heywood: 'bool', converged: 'bool', n_iter: 'int', warnings: 'List[str]' = <factory>) -> None

Estimated single-factor (congeneric) measurement model for one block.

Attributes ---------- name Latent variable name. indicators Column names of the indicators, in the order the loadings are given. loadings Standardized loadings, one per indicator. The latent variable is scaled to unit variance, so these are correlations between indicator and factor under the model. uniquenesses Indicator error variances in the standardized metric, ``1 - loading^2`` under a congeneric model with unit-variance factor. communalities ``loading^2``: the share of each indicator's variance explained. omega Composite (congeneric) reliability of the unit-weighted sum. alpha Cronbach's alpha, reported alongside omega because alpha is a lower bound that only equals reliability under tau-equivalence. ave Average variance extracted, used for Fornell-Larcker discriminant validity. determinacy Correlation between the factor and its regression-method factor score. guttman_bound ``2 * determinacy^2 - 1``: the minimum correlation between two equally valid sets of factor scores. heywood True if any communality exceeded 1 during estimation and was capped -- a sign of an improper solution that must be reported, not hidden. converged, n_iter Convergence status of the communality iteration.

average_variance_extracted

average_variance_extracted(loadings: 'np.ndarray') -> 'float'

Mean squared standardized loading: the share of indicator variance the factor accounts for. Used for the Fornell-Larcker discriminant check.

composite_reliability

composite_reliability(loadings: 'np.ndarray', uniquenesses: 'np.ndarray') -> 'float'

Congeneric composite reliability (McDonald's omega) of a unit-weighted sum.

``omega = (sum lambda)^2 / ((sum lambda)^2 + sum theta)``

This is the quantity the observed composite correlations are divided by in order to recover the latent correlations, so any error in it propagates directly into the structural coefficients.

cronbach_alpha

cronbach_alpha(r: 'np.ndarray') -> 'float'

Cronbach's alpha computed from a correlation matrix (standardized alpha).

Reported next to omega only so a reader can see the gap. Alpha equals reliability only under tau-equivalence (all loadings equal); otherwise it is a lower bound and understates reliability, which would over-correct a disattenuated correlation.

factor_score_determinacy

factor_score_determinacy(loadings: 'np.ndarray', uniquenesses: 'np.ndarray') -> 'float'

Correlation between a factor and its regression-method factor score.

For a single factor with unit variance, ``rho = sqrt(sum(lambda_j^2 / theta_j) / (1 + sum(lambda_j^2 / theta_j)))``.

factor_scores

factor_scores(data: 'np.ndarray', loadings: 'np.ndarray', uniquenesses: 'np.ndarray', method: 'str' = 'regression') -> 'np.ndarray'

Compute factor scores for one factor.

Parameters ---------- data Indicator block, ``(n_obs, p)``. Standardized internally. loadings, uniquenesses From a fitted :class:`FactorSolution`. method ``"regression"`` (Thurstone/Thomson) or ``"bartlett"``. The two give different scores for the same fitted model; see :func:`guttman_indeterminacy_bound`.

Used by: study_04_coefficient_interpretation.py

fit_congeneric_block

fit_congeneric_block(data: 'np.ndarray', indicators: 'Sequence[str]', name: 'str', column_index: 'Optional[Sequence[int]]' = None) -> 'FactorSolution'

Fit a one-factor measurement model to a block of indicators.

Parameters ---------- data Observed data, ``(n_obs, n_vars)``. Standardized internally. indicators Names of the indicators in this block, for reporting. name Latent variable name. column_index Column positions of the indicators in ``data``. Defaults to the first ``len(indicators)`` columns, which is almost never what a caller wants, so :class:`ehs_risk_sem.model.ModelSpec` always supplies it explicitly.

Used by: study_04_coefficient_interpretation.py

fornell_larcker

fornell_larcker(ave_by_factor: 'Sequence[float]', phi: 'np.ndarray', names: 'Sequence[str]') -> 'List[Tuple[str, str, float, float, bool]]'

Fornell-Larcker discriminant validity check for every factor pair.

Returns tuples ``(factor_a, factor_b, sqrt_ave_min, |phi|, passes)`` where the criterion passes when the smaller of the two square-root AVEs exceeds the absolute latent correlation.

guttman_indeterminacy_bound

guttman_indeterminacy_bound(determinacy: 'float') -> 'float'

Minimum correlation between two equally valid sets of factor scores.

``2 * rho^2 - 1``. At ``rho = 0.90`` this is 0.62: two analysts can compute factor scores that are equally consistent with the same fitted model and correlate only 0.62 with each other. That is a property of the model, not of the estimation, and it is why a per-unit latent "risk score" cannot be treated as a determinate quantity.

htmt

htmt(data: 'np.ndarray', blocks: 'Sequence[Sequence[int]]', names: 'Sequence[str]') -> 'np.ndarray'

Heterotrait-monotrait ratio of correlations.

For each pair of factors, the mean absolute cross-block indicator correlation divided by the geometric mean of the two within-block mean absolute correlations. Values approaching 1 mean the two "constructs" are not empirically distinguishable, whatever they are called.

principal_axis_factor

principal_axis_factor(r: 'np.ndarray', n_factors: 'int' = 1, max_iter: 'int' = 200, tol: 'float' = 1e-08) -> 'Tuple[np.ndarray, np.ndarray, bool, int, bool]'

Extract factors from a correlation matrix by principal-axis factoring.

The diagonal of ``r`` is replaced by communality estimates (initialized at the squared multiple correlation of each variable with the others), the reduced matrix is eigendecomposed, loadings are read off the leading eigenvectors, and the communalities are updated. Iterate to convergence.

Parameters ---------- r Correlation matrix, ``(p, p)``. n_factors Number of factors to extract. max_iter, tol Controls on the communality iteration.

Returns ------- loadings ``(p, n_factors)`` loading matrix. communalities ``(p,)`` final communality estimates. converged Whether the communality iteration met ``tol``. n_iter Iterations used. heywood Whether any communality had to be capped at just under 1.