powermean 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powermean-0.1.0a1/.gitignore +9 -0
- powermean-0.1.0a1/CHANGELOG.md +17 -0
- powermean-0.1.0a1/LICENSE +28 -0
- powermean-0.1.0a1/PKG-INFO +151 -0
- powermean-0.1.0a1/README.md +121 -0
- powermean-0.1.0a1/pyproject.toml +52 -0
- powermean-0.1.0a1/src/powermean/__init__.py +93 -0
- powermean-0.1.0a1/src/powermean/_native/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/_native/basis/__init__.py +14 -0
- powermean-0.1.0a1/src/powermean/_native/iols/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/_prepare/__init__.py +14 -0
- powermean-0.1.0a1/src/powermean/_prepare/compose.py +337 -0
- powermean-0.1.0a1/src/powermean/_prepare/dependence.py +498 -0
- powermean-0.1.0a1/src/powermean/_prepare/effects.py +129 -0
- powermean-0.1.0a1/src/powermean/_prepare/inputs.py +171 -0
- powermean-0.1.0a1/src/powermean/_prepare/owned.py +151 -0
- powermean-0.1.0a1/src/powermean/_vendor/SKLEARN_COPYING +319 -0
- powermean-0.1.0a1/src/powermean/_vendor/__init__.py +16 -0
- powermean-0.1.0a1/src/powermean/_vendor/_compat.py +192 -0
- powermean-0.1.0a1/src/powermean/_vendor/_scipy.py +98 -0
- powermean-0.1.0a1/src/powermean/_vendor/_typing.py +143 -0
- powermean-0.1.0a1/src/powermean/_vendor/vendor_linear_loss.py +877 -0
- powermean-0.1.0a1/src/powermean/_vendor/vendor_newton.py +737 -0
- powermean-0.1.0a1/src/powermean/api.py +408 -0
- powermean-0.1.0a1/src/powermean/data/__init__.py +12 -0
- powermean-0.1.0a1/src/powermean/data/_arrays.py +52 -0
- powermean-0.1.0a1/src/powermean/data/accounting.py +146 -0
- powermean-0.1.0a1/src/powermean/data/collinearity.py +344 -0
- powermean-0.1.0a1/src/powermean/data/collinearity_geometry.py +441 -0
- powermean-0.1.0a1/src/powermean/data/collinearity_numeric.py +423 -0
- powermean-0.1.0a1/src/powermean/data/collinearity_records.py +433 -0
- powermean-0.1.0a1/src/powermean/data/computation.py +179 -0
- powermean-0.1.0a1/src/powermean/data/design.py +203 -0
- powermean-0.1.0a1/src/powermean/data/fe_component_storage.py +366 -0
- powermean-0.1.0a1/src/powermean/data/fingerprint.py +183 -0
- powermean-0.1.0a1/src/powermean/data/inference_conventions.py +175 -0
- powermean-0.1.0a1/src/powermean/data/inference_requests.py +350 -0
- powermean-0.1.0a1/src/powermean/data/inputs.py +239 -0
- powermean-0.1.0a1/src/powermean/data/numeric_fit.py +165 -0
- powermean-0.1.0a1/src/powermean/data/raw.py +675 -0
- powermean-0.1.0a1/src/powermean/data/request_values.py +196 -0
- powermean-0.1.0a1/src/powermean/data/retained.py +450 -0
- powermean-0.1.0a1/src/powermean/data/sample.py +291 -0
- powermean-0.1.0a1/src/powermean/data/sample_fe.py +530 -0
- powermean-0.1.0a1/src/powermean/data/sample_fe_source.py +562 -0
- powermean-0.1.0a1/src/powermean/data/sample_fe_state.py +582 -0
- powermean-0.1.0a1/src/powermean/data/specs.py +515 -0
- powermean-0.1.0a1/src/powermean/data/weights.py +196 -0
- powermean-0.1.0a1/src/powermean/effects/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/effects/targets.py +249 -0
- powermean-0.1.0a1/src/powermean/errors.py +229 -0
- powermean-0.1.0a1/src/powermean/fe/__init__.py +17 -0
- powermean-0.1.0a1/src/powermean/fe/_cancel_storage.py +102 -0
- powermean-0.1.0a1/src/powermean/fe/absorb.py +512 -0
- powermean-0.1.0a1/src/powermean/fe/absorb_acceleration.py +554 -0
- powermean-0.1.0a1/src/powermean/fe/absorb_numeric.py +717 -0
- powermean-0.1.0a1/src/powermean/fe/admission.py +240 -0
- powermean-0.1.0a1/src/powermean/fe/admission_budget.py +75 -0
- powermean-0.1.0a1/src/powermean/fe/admission_incidence.py +137 -0
- powermean-0.1.0a1/src/powermean/fe/admission_records.py +124 -0
- powermean-0.1.0a1/src/powermean/fe/admission_slopes.py +163 -0
- powermean-0.1.0a1/src/powermean/fe/cancel.py +214 -0
- powermean-0.1.0a1/src/powermean/fe/certificate_basis.py +3246 -0
- powermean-0.1.0a1/src/powermean/fe/certificate_coordinates.py +504 -0
- powermean-0.1.0a1/src/powermean/fe/certificate_witness.py +426 -0
- powermean-0.1.0a1/src/powermean/fe/connectivity.py +348 -0
- powermean-0.1.0a1/src/powermean/fe/geometry.py +261 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_checks.py +214 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_design.py +314 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_eigh.py +44 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_errors.py +67 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_gram.py +309 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_rank.py +392 -0
- powermean-0.1.0a1/src/powermean/fe/geometry_storage.py +35 -0
- powermean-0.1.0a1/src/powermean/fe/groups.py +556 -0
- powermean-0.1.0a1/src/powermean/fe/primitive_codes.py +189 -0
- powermean-0.1.0a1/src/powermean/fe/profile.py +605 -0
- powermean-0.1.0a1/src/powermean/fe/profile_arithmetic.py +970 -0
- powermean-0.1.0a1/src/powermean/fe/profile_nb2.py +521 -0
- powermean-0.1.0a1/src/powermean/fe/profile_nb2_scalar.py +480 -0
- powermean-0.1.0a1/src/powermean/fe/reductions.py +356 -0
- powermean-0.1.0a1/src/powermean/fe/retained.py +147 -0
- powermean-0.1.0a1/src/powermean/formula/__init__.py +11 -0
- powermean-0.1.0a1/src/powermean/formula/formulaic_api.py +234 -0
- powermean-0.1.0a1/src/powermean/formula/frame.py +299 -0
- powermean-0.1.0a1/src/powermean/formula/grammar.py +236 -0
- powermean-0.1.0a1/src/powermean/formula/materialization.py +182 -0
- powermean-0.1.0a1/src/powermean/formula/names.py +271 -0
- powermean-0.1.0a1/src/powermean/formula/validity.py +104 -0
- powermean-0.1.0a1/src/powermean/inference/__init__.py +12 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed.py +201 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_adjusted.py +133 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_code_tuples.py +60 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_composition.py +176 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_constant.py +201 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_details.py +92 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_hc_scale.py +102 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_preflight.py +378 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_rank.py +390 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_rows.py +23 -0
- powermean-0.1.0a1/src/powermean/inference/absorbed_warnings.py +39 -0
- powermean-0.1.0a1/src/powermean/inference/bread.py +214 -0
- powermean-0.1.0a1/src/powermean/inference/cancelled.py +174 -0
- powermean-0.1.0a1/src/powermean/inference/coefficient_combinations.py +304 -0
- powermean-0.1.0a1/src/powermean/inference/coefficient_expressions.py +230 -0
- powermean-0.1.0a1/src/powermean/inference/contributions.py +282 -0
- powermean-0.1.0a1/src/powermean/inference/convention.py +360 -0
- powermean-0.1.0a1/src/powermean/inference/correction/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/inference/correction/_cancelled_operator.py +178 -0
- powermean-0.1.0a1/src/powermean/inference/correction/_inputs.py +141 -0
- powermean-0.1.0a1/src/powermean/inference/correction/_row_derivatives.py +178 -0
- powermean-0.1.0a1/src/powermean/inference/correction/budget.py +167 -0
- powermean-0.1.0a1/src/powermean/inference/correction/cell.py +253 -0
- powermean-0.1.0a1/src/powermean/inference/correction/operator.py +267 -0
- powermean-0.1.0a1/src/powermean/inference/correction/pairs.py +137 -0
- powermean-0.1.0a1/src/powermean/inference/correction/selector.py +348 -0
- powermean-0.1.0a1/src/powermean/inference/correction/short_group.py +299 -0
- powermean-0.1.0a1/src/powermean/inference/hc.py +1239 -0
- powermean-0.1.0a1/src/powermean/inference/hc_provider.py +251 -0
- powermean-0.1.0a1/src/powermean/inference/influence.py +185 -0
- powermean-0.1.0a1/src/powermean/inference/leverage.py +791 -0
- powermean-0.1.0a1/src/powermean/inference/linear_provider.py +172 -0
- powermean-0.1.0a1/src/powermean/inference/multiway.py +367 -0
- powermean-0.1.0a1/src/powermean/inference/numeric.py +112 -0
- powermean-0.1.0a1/src/powermean/inference/provider.py +174 -0
- powermean-0.1.0a1/src/powermean/inference/psd.py +564 -0
- powermean-0.1.0a1/src/powermean/inference/restriction_rank.py +195 -0
- powermean-0.1.0a1/src/powermean/inference/ssc.py +818 -0
- powermean-0.1.0a1/src/powermean/inference/vcov.py +469 -0
- powermean-0.1.0a1/src/powermean/inference/wz_absorbed.py +122 -0
- powermean-0.1.0a1/src/powermean/inference/wz_binding.py +312 -0
- powermean-0.1.0a1/src/powermean/inference/wz_coefficient.py +183 -0
- powermean-0.1.0a1/src/powermean/inference/wz_covariance.py +263 -0
- powermean-0.1.0a1/src/powermean/inference/wz_operator.py +374 -0
- powermean-0.1.0a1/src/powermean/inference/wz_resources.py +39 -0
- powermean-0.1.0a1/src/powermean/interface/__init__.py +17 -0
- powermean-0.1.0a1/src/powermean/interface/cancelled_fit.py +497 -0
- powermean-0.1.0a1/src/powermean/interface/cancelled_selection.py +368 -0
- powermean-0.1.0a1/src/powermean/interface/cancelled_tau1_origin.py +138 -0
- powermean-0.1.0a1/src/powermean/interface/dispatch.py +489 -0
- powermean-0.1.0a1/src/powermean/interface/expressions.py +197 -0
- powermean-0.1.0a1/src/powermean/interface/fe_bias.py +456 -0
- powermean-0.1.0a1/src/powermean/interface/fe_bias_options.py +30 -0
- powermean-0.1.0a1/src/powermean/interface/fe_cancelled_result.py +579 -0
- powermean-0.1.0a1/src/powermean/interface/fe_dispatch.py +1059 -0
- powermean-0.1.0a1/src/powermean/interface/fe_joint_result.py +751 -0
- powermean-0.1.0a1/src/powermean/interface/fe_options.py +452 -0
- powermean-0.1.0a1/src/powermean/interface/fe_result_backends.py +446 -0
- powermean-0.1.0a1/src/powermean/interface/fe_root.py +191 -0
- powermean-0.1.0a1/src/powermean/interface/numeric_execution.py +489 -0
- powermean-0.1.0a1/src/powermean/interface/options.py +1431 -0
- powermean-0.1.0a1/src/powermean/interface/owned_fit_state.py +306 -0
- powermean-0.1.0a1/src/powermean/interface/ppml_audit.py +1099 -0
- powermean-0.1.0a1/src/powermean/interface/preparation.py +416 -0
- powermean-0.1.0a1/src/powermean/interface/retained_admission.py +483 -0
- powermean-0.1.0a1/src/powermean/interface/retained_binding.py +515 -0
- powermean-0.1.0a1/src/powermean/interface/retained_context.py +760 -0
- powermean-0.1.0a1/src/powermean/interface/retained_covariance.py +204 -0
- powermean-0.1.0a1/src/powermean/interface/retained_metadata.py +482 -0
- powermean-0.1.0a1/src/powermean/interface/retained_outcomes.py +371 -0
- powermean-0.1.0a1/src/powermean/interface/retained_postfit.py +237 -0
- powermean-0.1.0a1/src/powermean/interface/retained_preparation.py +280 -0
- powermean-0.1.0a1/src/powermean/interface/retained_result.py +266 -0
- powermean-0.1.0a1/src/powermean/interface/retained_space.py +396 -0
- powermean-0.1.0a1/src/powermean/interface/retained_time.py +393 -0
- powermean-0.1.0a1/src/powermean/interface/retained_traces.py +295 -0
- powermean-0.1.0a1/src/powermean/interface/retention.py +313 -0
- powermean-0.1.0a1/src/powermean/interface/sample.py +749 -0
- powermean-0.1.0a1/src/powermean/interface/sample_encoding.py +57 -0
- powermean-0.1.0a1/src/powermean/interface/sample_evidence.py +357 -0
- powermean-0.1.0a1/src/powermean/interface/sample_records.py +834 -0
- powermean-0.1.0a1/src/powermean/messages.py +386 -0
- powermean-0.1.0a1/src/powermean/model/__init__.py +4 -0
- powermean-0.1.0a1/src/powermean/model/order.py +331 -0
- powermean-0.1.0a1/src/powermean/model/order_scale.py +413 -0
- powermean-0.1.0a1/src/powermean/model/rows.py +514 -0
- powermean-0.1.0a1/src/powermean/model/variance.py +231 -0
- powermean-0.1.0a1/src/powermean/py.typed +0 -0
- powermean-0.1.0a1/src/powermean/results/__init__.py +28 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_assessment_binding.py +237 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_assessment_capture.py +466 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_assessment_handoff.py +441 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_attempts.py +390 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_binding.py +578 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_checks.py +297 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_geometry.py +332 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_geometry_records.py +449 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_groupings.py +521 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_handoff.py +528 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_history.py +432 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_linear_history.py +220 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_outcome_records.py +375 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_owned.py +536 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_partitions.py +565 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_point_records.py +273 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_points.py +409 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_retained.py +409 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_root.py +235 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_root_binding.py +166 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_root_records.py +198 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_sample.py +702 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_sample_binding.py +778 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_scale_cache.py +315 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_state_records.py +393 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_states.py +391 -0
- powermean-0.1.0a1/src/powermean/results/absorbed_trace.py +351 -0
- powermean-0.1.0a1/src/powermean/results/active_covariance.py +241 -0
- powermean-0.1.0a1/src/powermean/results/binding.py +292 -0
- powermean-0.1.0a1/src/powermean/results/cancelled_bias.py +71 -0
- powermean-0.1.0a1/src/powermean/results/cancelled_inference.py +191 -0
- powermean-0.1.0a1/src/powermean/results/cancelled_provenance.py +129 -0
- powermean-0.1.0a1/src/powermean/results/cancelled_recovery.py +216 -0
- powermean-0.1.0a1/src/powermean/results/cancelled_retained.py +405 -0
- powermean-0.1.0a1/src/powermean/results/citations.py +101 -0
- powermean-0.1.0a1/src/powermean/results/cluster_covariance.py +369 -0
- powermean-0.1.0a1/src/powermean/results/contrast_reporting.py +214 -0
- powermean-0.1.0a1/src/powermean/results/covariance.py +657 -0
- powermean-0.1.0a1/src/powermean/results/effect_design.py +198 -0
- powermean-0.1.0a1/src/powermean/results/effect_reporting.py +305 -0
- powermean-0.1.0a1/src/powermean/results/fe_helpers.py +161 -0
- powermean-0.1.0a1/src/powermean/results/fe_result_backends.py +93 -0
- powermean-0.1.0a1/src/powermean/results/fe_sample.py +337 -0
- powermean-0.1.0a1/src/powermean/results/handoff.py +1438 -0
- powermean-0.1.0a1/src/powermean/results/naming.py +139 -0
- powermean-0.1.0a1/src/powermean/results/numeric_assessment.py +98 -0
- powermean-0.1.0a1/src/powermean/results/owned.py +520 -0
- powermean-0.1.0a1/src/powermean/results/point.py +365 -0
- powermean-0.1.0a1/src/powermean/results/ppml_residualized_inference.py +931 -0
- powermean-0.1.0a1/src/powermean/results/ppml_residualized_map.py +208 -0
- powermean-0.1.0a1/src/powermean/results/ppml_standard_assessment.py +694 -0
- powermean-0.1.0a1/src/powermean/results/ppml_standard_inference.py +348 -0
- powermean-0.1.0a1/src/powermean/results/ppml_standard_records.py +941 -0
- powermean-0.1.0a1/src/powermean/results/ppml_standard_retained.py +834 -0
- powermean-0.1.0a1/src/powermean/results/prediction.py +208 -0
- powermean-0.1.0a1/src/powermean/results/primitive_compact.py +230 -0
- powermean-0.1.0a1/src/powermean/results/primitive_parts.py +155 -0
- powermean-0.1.0a1/src/powermean/results/primitive_sample_check.py +432 -0
- powermean-0.1.0a1/src/powermean/results/primitive_snapshot.py +1371 -0
- powermean-0.1.0a1/src/powermean/results/provenance.py +572 -0
- powermean-0.1.0a1/src/powermean/results/restriction_reporting.py +239 -0
- powermean-0.1.0a1/src/powermean/results/result.py +887 -0
- powermean-0.1.0a1/src/powermean/results/retained.py +350 -0
- powermean-0.1.0a1/src/powermean/results/retained_collinearity.py +214 -0
- powermean-0.1.0a1/src/powermean/results/retained_collinearity_geometry.py +275 -0
- powermean-0.1.0a1/src/powermean/results/retained_diagnostic_problems.py +372 -0
- powermean-0.1.0a1/src/powermean/results/retained_gamma.py +262 -0
- powermean-0.1.0a1/src/powermean/results/retained_gamma_witnesses.py +394 -0
- powermean-0.1.0a1/src/powermean/results/retained_hc.py +649 -0
- powermean-0.1.0a1/src/powermean/results/retained_hc_records.py +405 -0
- powermean-0.1.0a1/src/powermean/results/retained_index_values.py +78 -0
- powermean-0.1.0a1/src/powermean/results/retained_inference.py +1571 -0
- powermean-0.1.0a1/src/powermean/results/retained_input_values.py +531 -0
- powermean-0.1.0a1/src/powermean/results/retained_inputs.py +222 -0
- powermean-0.1.0a1/src/powermean/results/retained_labels.py +526 -0
- powermean-0.1.0a1/src/powermean/results/retained_rectifier.py +364 -0
- powermean-0.1.0a1/src/powermean/results/retained_support.py +371 -0
- powermean-0.1.0a1/src/powermean/results/retained_support_lp.py +200 -0
- powermean-0.1.0a1/src/powermean/results/retained_support_witnesses.py +341 -0
- powermean-0.1.0a1/src/powermean/results/sample.py +180 -0
- powermean-0.1.0a1/src/powermean/results/summary.py +329 -0
- powermean-0.1.0a1/src/powermean/results/wz_bias.py +93 -0
- powermean-0.1.0a1/src/powermean/results/wz_inference.py +186 -0
- powermean-0.1.0a1/src/powermean/solve/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed.py +214 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate.py +668 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_block.py +521 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_factor.py +389 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_final.py +360 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_final_parts.py +138 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_geometry.py +714 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_history.py +645 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_inner.py +440 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_point.py +629 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_scale.py +312 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_certificate_sparse.py +340 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_dense_factor.py +319 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_direction.py +987 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_loss.py +922 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_pair_layout.py +79 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_rhs.py +1037 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_root.py +944 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_root_records.py +438 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_scale_admission.py +452 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_scale_details.py +124 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_scale_records.py +188 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_scale_request.py +285 -0
- powermean-0.1.0a1/src/powermean/solve/absorbed_start.py +477 -0
- powermean-0.1.0a1/src/powermean/solve/assessment.py +183 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_attempt.py +72 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_certificate.py +404 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_loss.py +198 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_operator.py +293 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_records.py +418 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_root.py +308 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_root_attempt.py +111 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_tau1.py +317 -0
- powermean-0.1.0a1/src/powermean/solve/cancelled_tau1_bridge.py +240 -0
- powermean-0.1.0a1/src/powermean/solve/certificate.py +616 -0
- powermean-0.1.0a1/src/powermean/solve/compact_assembly.py +456 -0
- powermean-0.1.0a1/src/powermean/solve/compact_matrix.py +199 -0
- powermean-0.1.0a1/src/powermean/solve/compact_scaling.py +249 -0
- powermean-0.1.0a1/src/powermean/solve/factorization.py +277 -0
- powermean-0.1.0a1/src/powermean/solve/iols/__init__.py +101 -0
- powermean-0.1.0a1/src/powermean/solve/iols/_numeric.py +29 -0
- powermean-0.1.0a1/src/powermean/solve/iols/adapter.py +371 -0
- powermean-0.1.0a1/src/powermean/solve/iols/candidate.py +290 -0
- powermean-0.1.0a1/src/powermean/solve/iols/direct_route.py +451 -0
- powermean-0.1.0a1/src/powermean/solve/iols/fe.py +287 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel.py +405 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_attempt.py +388 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_grid.py +401 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_loop.py +363 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_phase.py +411 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_records.py +362 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_state.py +333 -0
- powermean-0.1.0a1/src/powermean/solve/iols/kernel_step.py +321 -0
- powermean-0.1.0a1/src/powermean/solve/iols/normalization.py +146 -0
- powermean-0.1.0a1/src/powermean/solve/iols/options.py +309 -0
- powermean-0.1.0a1/src/powermean/solve/iols/records.py +33 -0
- powermean-0.1.0a1/src/powermean/solve/iols/reference.py +61 -0
- powermean-0.1.0a1/src/powermean/solve/iols/source.py +75 -0
- powermean-0.1.0a1/src/powermean/solve/joint_root.py +614 -0
- powermean-0.1.0a1/src/powermean/solve/joint_root_records.py +203 -0
- powermean-0.1.0a1/src/powermean/solve/line_search.py +197 -0
- powermean-0.1.0a1/src/powermean/solve/linear.py +387 -0
- powermean-0.1.0a1/src/powermean/solve/linear_absorbed.py +338 -0
- powermean-0.1.0a1/src/powermean/solve/linear_absorbed_numeric.py +361 -0
- powermean-0.1.0a1/src/powermean/solve/linear_absorbed_point.py +380 -0
- powermean-0.1.0a1/src/powermean/solve/linear_absorbed_state.py +378 -0
- powermean-0.1.0a1/src/powermean/solve/linear_certificate.py +354 -0
- powermean-0.1.0a1/src/powermean/solve/linear_evaluation.py +223 -0
- powermean-0.1.0a1/src/powermean/solve/linear_status.py +174 -0
- powermean-0.1.0a1/src/powermean/solve/newton_absorbed.py +1075 -0
- powermean-0.1.0a1/src/powermean/solve/newton_convex.py +975 -0
- powermean-0.1.0a1/src/powermean/solve/newton_profiled.py +641 -0
- powermean-0.1.0a1/src/powermean/solve/newton_retry.py +139 -0
- powermean-0.1.0a1/src/powermean/solve/newton_trace.py +211 -0
- powermean-0.1.0a1/src/powermean/solve/no_point.py +59 -0
- powermean-0.1.0a1/src/powermean/solve/options.py +354 -0
- powermean-0.1.0a1/src/powermean/solve/point_loss.py +285 -0
- powermean-0.1.0a1/src/powermean/solve/profiled_indications.py +169 -0
- powermean-0.1.0a1/src/powermean/solve/profiled_linear_loss.py +442 -0
- powermean-0.1.0a1/src/powermean/solve/profiled_loss.py +725 -0
- powermean-0.1.0a1/src/powermean/solve/profiled_trigger.py +508 -0
- powermean-0.1.0a1/src/powermean/solve/quantities.py +140 -0
- powermean-0.1.0a1/src/powermean/solve/reduced_execution.py +625 -0
- powermean-0.1.0a1/src/powermean/solve/reduced_nonlinear.py +382 -0
- powermean-0.1.0a1/src/powermean/solve/reduced_nonlinear_loss.py +302 -0
- powermean-0.1.0a1/src/powermean/solve/reported.py +334 -0
- powermean-0.1.0a1/src/powermean/solve/root_kernel.py +448 -0
- powermean-0.1.0a1/src/powermean/solve/sparse_matrix.py +29 -0
- powermean-0.1.0a1/src/powermean/solve/starts.py +174 -0
- powermean-0.1.0a1/src/powermean/solve/status.py +168 -0
- powermean-0.1.0a1/src/powermean/solve/support.py +367 -0
- powermean-0.1.0a1/src/powermean/solve/support_gamma.py +550 -0
- powermean-0.1.0a1/src/powermean/solve/support_gamma_lp.py +579 -0
- powermean-0.1.0a1/src/powermean/solve/support_gamma_problem.py +208 -0
- powermean-0.1.0a1/src/powermean/solve/support_gamma_witness.py +507 -0
- powermean-0.1.0a1/src/powermean/solve/support_lp.py +451 -0
- powermean-0.1.0a1/src/powermean/solve/support_problem.py +220 -0
- powermean-0.1.0a1/src/powermean/solve/support_projection.py +582 -0
- powermean-0.1.0a1/src/powermean/solve/support_rectifier.py +355 -0
- powermean-0.1.0a1/src/powermean/solve/support_witness.py +484 -0
- powermean-0.1.0a1/src/powermean/solve/threads.py +2745 -0
- powermean-0.1.0a1/src/powermean/systems/__init__.py +5 -0
- powermean-0.1.0a1/src/powermean/systems/_cancel_rows.py +128 -0
- powermean-0.1.0a1/src/powermean/systems/admitted.py +133 -0
- powermean-0.1.0a1/src/powermean/systems/cancelled.py +421 -0
- powermean-0.1.0a1/src/powermean/systems/identified.py +184 -0
- powermean-0.1.0a1/src/powermean/systems/joint.py +425 -0
- powermean-0.1.0a1/src/powermean/systems/profiled.py +588 -0
- powermean-0.1.0a1/src/powermean/testing/__init__.py +53 -0
- powermean-0.1.0a1/src/powermean/testing/designs_solver.py +322 -0
- powermean-0.1.0a1/src/powermean/testing/designs_threeway.py +252 -0
- powermean-0.1.0a1/src/powermean/testing/designs_twoway.py +246 -0
- powermean-0.1.0a1/src/powermean/testing/showcase.py +371 -0
- powermean-0.1.0a1/src/powermean/testing/synthetic.py +272 -0
- powermean-0.1.0a1/tests/conftest.py +39 -0
- powermean-0.1.0a1/tests/test_after_estimation.py +85 -0
- powermean-0.1.0a1/tests/test_estimates.py +128 -0
- powermean-0.1.0a1/tests/test_interface.py +65 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0a1
|
|
4
|
+
|
|
5
|
+
First no-fixed-effects alpha for source and CI testing. This is not a stable
|
|
6
|
+
release or a package-index upload.
|
|
7
|
+
|
|
8
|
+
- Regression models without fixed effects: `fit`, `ppml`, `gpml`, `logols`, and
|
|
9
|
+
`prepare` for several fits on one prepared sample.
|
|
10
|
+
- Two solvers: Newton (default) and IOLS (`solver="iols"`), both in pure Python.
|
|
11
|
+
There is no compiled IOLS kernel in this version: `iols_backend="cpp"` is refused.
|
|
12
|
+
- Covariances: robust, HC0 to HC5, one-way and multiway clustering, with the
|
|
13
|
+
small-sample conventions of `ssc`.
|
|
14
|
+
- After estimation: `tidy`, `summary`, `effect`, `effects`, `contrast`, `lincom`,
|
|
15
|
+
`nlcom`, `test`, `wald`, `predict`, `influence`.
|
|
16
|
+
- A formula with fixed effects (a part after `|`) is refused in this version. Fixed
|
|
17
|
+
effects are planned for version 0.1.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, David Benatia
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: powermean
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Power-mean regression: PPML, GPML and log-linear models for outcomes with zeros
|
|
5
|
+
Project-URL: Repository, https://github.com/dvbn/powermean
|
|
6
|
+
Project-URL: Issues, https://github.com/dvbn/powermean/issues
|
|
7
|
+
Project-URL: Paper, https://arxiv.org/abs/2203.11820
|
|
8
|
+
Author: David Benatia
|
|
9
|
+
License-Expression: BSD-3-Clause
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: src/powermean/_vendor/SKLEARN_COPYING
|
|
12
|
+
Keywords: GPML,IOLS,PPML,econometrics,proportional effects,regression,zeros
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Requires-Dist: formulaic>=1.1.0
|
|
24
|
+
Requires-Dist: numpy>=2.3.1
|
|
25
|
+
Requires-Dist: pandas>=2.2.3
|
|
26
|
+
Requires-Dist: scipy>=1.15.0
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=8.3; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Powermean
|
|
32
|
+
|
|
33
|
+
Powermean is a Python package for estimating proportional effects. It brings exponential regression, including Poisson pseudo-maximum likelihood (PPML) and Gamma pseudo-maximum likelihood (GPML), and log-linear regression into a common power-mean framework. It can be used for estimation and inference of treatment effects or gravity models. The methods build on Benatia, Bellégo and Pape (BBP),
|
|
34
|
+
[*Dealing with Logs and Zeros in Regression Models*](https://arxiv.org/abs/2203.11820).
|
|
35
|
+
|
|
36
|
+
> **Status: pre-release `0.1.0a1`.** This version estimates models without
|
|
37
|
+
> fixed effects. A formula with fixed effects is refused with a clear message;
|
|
38
|
+
> fixed effects are planned for version 0.1. Interfaces may still change.
|
|
39
|
+
|
|
40
|
+
## From the question to the model
|
|
41
|
+
|
|
42
|
+
Suppose you want to know how sales change proportionally with a firm's
|
|
43
|
+
characteristics. A change in average sales and an average change in log sales
|
|
44
|
+
are different quantities. That distinction matters especially when some firms
|
|
45
|
+
have no sales: a model for the arithmetic mean can include those zeros,
|
|
46
|
+
whereas a regression of log sales requires positive outcomes.
|
|
47
|
+
|
|
48
|
+
Powermean makes this choice explicit through the **mean order**, `omega`.
|
|
49
|
+
Order one models the arithmetic conditional mean; order zero gives a
|
|
50
|
+
regression of the log outcome. Other orders describe other power means.
|
|
51
|
+
Choosing an order therefore starts with the quantity you want to study, rather
|
|
52
|
+
than with the method that happens to be easiest to compute.
|
|
53
|
+
|
|
54
|
+
Once the mean model is specified, the **working variance** determines the
|
|
55
|
+
weights in its estimating equation. At order one, PPML and GPML both model the
|
|
56
|
+
arithmetic conditional mean, but use different working variances. Under the
|
|
57
|
+
appropriate mean, identification and regularity conditions, they estimate the
|
|
58
|
+
same population coefficients; their estimates and precision can differ in a
|
|
59
|
+
sample. This is a choice of estimator for the model, separate from choosing
|
|
60
|
+
which mean to model.
|
|
61
|
+
|
|
62
|
+
In an exponential mean model without interactions, exponentiating a slope
|
|
63
|
+
gives the conditional mean ratio for a one unit increase in that regressor,
|
|
64
|
+
holding the others fixed. A causal interpretation requires an identification
|
|
65
|
+
argument in addition to the mean specification.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
Powermean requires Python 3.12 or later. This alpha is available from source
|
|
70
|
+
for testing; it is not published to a package index. From the repository root:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m pip install .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The package is pure Python and depends on NumPy, pandas, SciPy and Formulaic.
|
|
77
|
+
The CI matrix is configured for Python 3.12–3.14 on Linux, macOS and Windows.
|
|
78
|
+
|
|
79
|
+
## Fit and interpret a first model
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import numpy as np
|
|
83
|
+
import pandas as pd
|
|
84
|
+
import powermean as pm
|
|
85
|
+
|
|
86
|
+
rng = np.random.default_rng(20261028)
|
|
87
|
+
n = 240
|
|
88
|
+
x1, x2 = rng.normal(size=n), rng.normal(size=n)
|
|
89
|
+
mean = np.exp(0.3 + 0.25 * x1 - 0.15 * x2)
|
|
90
|
+
data = pd.DataFrame({"y": rng.poisson(mean), "x1": x1, "x2": x2})
|
|
91
|
+
|
|
92
|
+
result = pm.ppml("y ~ 1 + x1 + x2", data, vcov="robust")
|
|
93
|
+
print(result.summary())
|
|
94
|
+
print(result.effect("x1").to_dict())
|
|
95
|
+
result.tidy().to_csv("coefficients.csv", index=False)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The fit uses all 240 observations, including 66 zeros. The coefficient on `x1`
|
|
99
|
+
is 0.224509 with robust standard error 0.053047. The corresponding conditional
|
|
100
|
+
mean ratio is approximately 1.252: a one unit increase in `x1` is associated
|
|
101
|
+
with a 25.2% higher mean, holding `x2` fixed.
|
|
102
|
+
|
|
103
|
+
`effect("x1")` reports the proportional change and its interval, rather than
|
|
104
|
+
leaving the exponential transformation to you. It is a conditional comparison,
|
|
105
|
+
not an automatically identified causal effect.
|
|
106
|
+
|
|
107
|
+
## What this version does
|
|
108
|
+
|
|
109
|
+
| Task | Interface |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| Fit PPML, GPML or log OLS | `pm.ppml`, `pm.gpml`, `pm.logols`; or specify the mean order and working variance with `pm.fit`. |
|
|
112
|
+
| Use IOLS instead of Newton | `solver="iols"`, for working variances `tau` in `[1, 2]` and positive mean orders, without weights or offsets. Newton is the default. |
|
|
113
|
+
| Compare specifications on one prepared sample | `pm.prepare(...).fit(...)`. |
|
|
114
|
+
| Change the covariance without refitting | `result.vcov(spec)` for a matrix, or `result.with_vcov(spec)` for tables, intervals and tests using that covariance: robust, HC0 to HC5, one-way and multiway clustering. |
|
|
115
|
+
| Report proportional changes and test coefficients | `effect`, `effects`, `contrast`, `lincom`, `nlcom`, `test` and `wald`. |
|
|
116
|
+
| Predict | `result.predict()`, in sample or on new data. |
|
|
117
|
+
|
|
118
|
+
At nonzero mean orders, Newton accepts any finite power `tau`. Outside `[1, 2]`
|
|
119
|
+
the fit reports a selected root: one root of the estimating equation, not
|
|
120
|
+
promised unique or available for every sample. The result records this, and
|
|
121
|
+
`summary()` prints it as `Coverage: selected_root`. The fit also issues a
|
|
122
|
+
`CoverageWarning` when `tau < 1`, and when `tau > 2` and the sample has zero
|
|
123
|
+
outcomes; with `tau > 2` and positive outcomes only, it issues none.
|
|
124
|
+
|
|
125
|
+
## Known limits of this version
|
|
126
|
+
|
|
127
|
+
- No fixed effects, instruments, HAC or spatial covariances.
|
|
128
|
+
- IOLS runs in NumPy only. This version ships no compiled IOLS kernel and
|
|
129
|
+
refuses `iols_backend="cpp"`. Its IOLS results were checked against the NumPy
|
|
130
|
+
kernel only, not against a compiled one, and its speed was not measured.
|
|
131
|
+
Newton is the default solver.
|
|
132
|
+
- A regressor that is an exact linear combination of the others is not dropped:
|
|
133
|
+
the fit stops without a certified solution.
|
|
134
|
+
- A sample in which the estimate does not exist (separation) is not diagnosed
|
|
135
|
+
before the fit: the fit stops without a certified solution.
|
|
136
|
+
|
|
137
|
+
## Citation
|
|
138
|
+
|
|
139
|
+
If you use the package, please cite the paper: David Benatia, Christophe
|
|
140
|
+
Bellégo and Louis-Daniel Pape, *Dealing with Logs and Zeros in Regression
|
|
141
|
+
Models*, [arXiv:2203.11820](https://arxiv.org/abs/2203.11820).
|
|
142
|
+
|
|
143
|
+
## Help
|
|
144
|
+
|
|
145
|
+
Report a problem with a small simulated or redistributable example through
|
|
146
|
+
[Issues](https://github.com/dvbn/powermean/issues), without confidential data.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
BSD-3-Clause; see [LICENSE](LICENSE). Bundled scikit-learn components keep their
|
|
151
|
+
[third party notice](src/powermean/_vendor/SKLEARN_COPYING).
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Powermean
|
|
2
|
+
|
|
3
|
+
Powermean is a Python package for estimating proportional effects. It brings exponential regression, including Poisson pseudo-maximum likelihood (PPML) and Gamma pseudo-maximum likelihood (GPML), and log-linear regression into a common power-mean framework. It can be used for estimation and inference of treatment effects or gravity models. The methods build on Benatia, Bellégo and Pape (BBP),
|
|
4
|
+
[*Dealing with Logs and Zeros in Regression Models*](https://arxiv.org/abs/2203.11820).
|
|
5
|
+
|
|
6
|
+
> **Status: pre-release `0.1.0a1`.** This version estimates models without
|
|
7
|
+
> fixed effects. A formula with fixed effects is refused with a clear message;
|
|
8
|
+
> fixed effects are planned for version 0.1. Interfaces may still change.
|
|
9
|
+
|
|
10
|
+
## From the question to the model
|
|
11
|
+
|
|
12
|
+
Suppose you want to know how sales change proportionally with a firm's
|
|
13
|
+
characteristics. A change in average sales and an average change in log sales
|
|
14
|
+
are different quantities. That distinction matters especially when some firms
|
|
15
|
+
have no sales: a model for the arithmetic mean can include those zeros,
|
|
16
|
+
whereas a regression of log sales requires positive outcomes.
|
|
17
|
+
|
|
18
|
+
Powermean makes this choice explicit through the **mean order**, `omega`.
|
|
19
|
+
Order one models the arithmetic conditional mean; order zero gives a
|
|
20
|
+
regression of the log outcome. Other orders describe other power means.
|
|
21
|
+
Choosing an order therefore starts with the quantity you want to study, rather
|
|
22
|
+
than with the method that happens to be easiest to compute.
|
|
23
|
+
|
|
24
|
+
Once the mean model is specified, the **working variance** determines the
|
|
25
|
+
weights in its estimating equation. At order one, PPML and GPML both model the
|
|
26
|
+
arithmetic conditional mean, but use different working variances. Under the
|
|
27
|
+
appropriate mean, identification and regularity conditions, they estimate the
|
|
28
|
+
same population coefficients; their estimates and precision can differ in a
|
|
29
|
+
sample. This is a choice of estimator for the model, separate from choosing
|
|
30
|
+
which mean to model.
|
|
31
|
+
|
|
32
|
+
In an exponential mean model without interactions, exponentiating a slope
|
|
33
|
+
gives the conditional mean ratio for a one unit increase in that regressor,
|
|
34
|
+
holding the others fixed. A causal interpretation requires an identification
|
|
35
|
+
argument in addition to the mean specification.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
Powermean requires Python 3.12 or later. This alpha is available from source
|
|
40
|
+
for testing; it is not published to a package index. From the repository root:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python -m pip install .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The package is pure Python and depends on NumPy, pandas, SciPy and Formulaic.
|
|
47
|
+
The CI matrix is configured for Python 3.12–3.14 on Linux, macOS and Windows.
|
|
48
|
+
|
|
49
|
+
## Fit and interpret a first model
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import numpy as np
|
|
53
|
+
import pandas as pd
|
|
54
|
+
import powermean as pm
|
|
55
|
+
|
|
56
|
+
rng = np.random.default_rng(20261028)
|
|
57
|
+
n = 240
|
|
58
|
+
x1, x2 = rng.normal(size=n), rng.normal(size=n)
|
|
59
|
+
mean = np.exp(0.3 + 0.25 * x1 - 0.15 * x2)
|
|
60
|
+
data = pd.DataFrame({"y": rng.poisson(mean), "x1": x1, "x2": x2})
|
|
61
|
+
|
|
62
|
+
result = pm.ppml("y ~ 1 + x1 + x2", data, vcov="robust")
|
|
63
|
+
print(result.summary())
|
|
64
|
+
print(result.effect("x1").to_dict())
|
|
65
|
+
result.tidy().to_csv("coefficients.csv", index=False)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The fit uses all 240 observations, including 66 zeros. The coefficient on `x1`
|
|
69
|
+
is 0.224509 with robust standard error 0.053047. The corresponding conditional
|
|
70
|
+
mean ratio is approximately 1.252: a one unit increase in `x1` is associated
|
|
71
|
+
with a 25.2% higher mean, holding `x2` fixed.
|
|
72
|
+
|
|
73
|
+
`effect("x1")` reports the proportional change and its interval, rather than
|
|
74
|
+
leaving the exponential transformation to you. It is a conditional comparison,
|
|
75
|
+
not an automatically identified causal effect.
|
|
76
|
+
|
|
77
|
+
## What this version does
|
|
78
|
+
|
|
79
|
+
| Task | Interface |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| Fit PPML, GPML or log OLS | `pm.ppml`, `pm.gpml`, `pm.logols`; or specify the mean order and working variance with `pm.fit`. |
|
|
82
|
+
| Use IOLS instead of Newton | `solver="iols"`, for working variances `tau` in `[1, 2]` and positive mean orders, without weights or offsets. Newton is the default. |
|
|
83
|
+
| Compare specifications on one prepared sample | `pm.prepare(...).fit(...)`. |
|
|
84
|
+
| Change the covariance without refitting | `result.vcov(spec)` for a matrix, or `result.with_vcov(spec)` for tables, intervals and tests using that covariance: robust, HC0 to HC5, one-way and multiway clustering. |
|
|
85
|
+
| Report proportional changes and test coefficients | `effect`, `effects`, `contrast`, `lincom`, `nlcom`, `test` and `wald`. |
|
|
86
|
+
| Predict | `result.predict()`, in sample or on new data. |
|
|
87
|
+
|
|
88
|
+
At nonzero mean orders, Newton accepts any finite power `tau`. Outside `[1, 2]`
|
|
89
|
+
the fit reports a selected root: one root of the estimating equation, not
|
|
90
|
+
promised unique or available for every sample. The result records this, and
|
|
91
|
+
`summary()` prints it as `Coverage: selected_root`. The fit also issues a
|
|
92
|
+
`CoverageWarning` when `tau < 1`, and when `tau > 2` and the sample has zero
|
|
93
|
+
outcomes; with `tau > 2` and positive outcomes only, it issues none.
|
|
94
|
+
|
|
95
|
+
## Known limits of this version
|
|
96
|
+
|
|
97
|
+
- No fixed effects, instruments, HAC or spatial covariances.
|
|
98
|
+
- IOLS runs in NumPy only. This version ships no compiled IOLS kernel and
|
|
99
|
+
refuses `iols_backend="cpp"`. Its IOLS results were checked against the NumPy
|
|
100
|
+
kernel only, not against a compiled one, and its speed was not measured.
|
|
101
|
+
Newton is the default solver.
|
|
102
|
+
- A regressor that is an exact linear combination of the others is not dropped:
|
|
103
|
+
the fit stops without a certified solution.
|
|
104
|
+
- A sample in which the estimate does not exist (separation) is not diagnosed
|
|
105
|
+
before the fit: the fit stops without a certified solution.
|
|
106
|
+
|
|
107
|
+
## Citation
|
|
108
|
+
|
|
109
|
+
If you use the package, please cite the paper: David Benatia, Christophe
|
|
110
|
+
Bellégo and Louis-Daniel Pape, *Dealing with Logs and Zeros in Regression
|
|
111
|
+
Models*, [arXiv:2203.11820](https://arxiv.org/abs/2203.11820).
|
|
112
|
+
|
|
113
|
+
## Help
|
|
114
|
+
|
|
115
|
+
Report a problem with a small simulated or redistributable example through
|
|
116
|
+
[Issues](https://github.com/dvbn/powermean/issues), without confidential data.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
BSD-3-Clause; see [LICENSE](LICENSE). Bundled scikit-learn components keep their
|
|
121
|
+
[third party notice](src/powermean/_vendor/SKLEARN_COPYING).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "powermean"
|
|
7
|
+
version = "0.1.0a1"
|
|
8
|
+
description = "Power-mean regression: PPML, GPML and log-linear models for outcomes with zeros"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "David Benatia" }]
|
|
11
|
+
license = "BSD-3-Clause"
|
|
12
|
+
license-files = ["LICENSE", "src/powermean/_vendor/SKLEARN_COPYING"]
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
|
+
keywords = ["econometrics", "regression", "PPML", "GPML", "IOLS", "zeros", "proportional effects"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Topic :: Scientific/Engineering",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"numpy>=2.3.1",
|
|
28
|
+
"pandas>=2.2.3",
|
|
29
|
+
"scipy>=1.15.0",
|
|
30
|
+
"formulaic>=1.1.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
test = ["pytest>=8.3"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Repository = "https://github.com/dvbn/powermean"
|
|
38
|
+
Issues = "https://github.com/dvbn/powermean/issues"
|
|
39
|
+
Paper = "https://arxiv.org/abs/2203.11820"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/powermean"]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
include = ["/src", "/tests", "/README.md", "/LICENSE", "/CHANGELOG.md", "/pyproject.toml"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 88
|
|
52
|
+
src = ["src"]
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""powermean: power-mean regression for outcomes with zeros.
|
|
2
|
+
|
|
3
|
+
The public interface is the list ``__all__`` below: the functions ``fit``, ``ppml``,
|
|
4
|
+
``gpml``, ``logols``, ``prepare``, ``solver_defaults`` and the convention factory
|
|
5
|
+
``ssc``, the working variance ``NB2``, the typed record ``SolverOptions`` that
|
|
6
|
+
``solver_defaults`` returns, and the exceptions and warnings of the package, which a
|
|
7
|
+
caller catches or filters by these names.
|
|
8
|
+
:mod:`powermean.testing` is the synthetic data used by tests, examples and fixtures,
|
|
9
|
+
with its own ``__all__``.
|
|
10
|
+
|
|
11
|
+
The names are resolved on first access (``__getattr__``), so that importing the
|
|
12
|
+
package, or a module of a lower layer, loads neither the interface, the result layer
|
|
13
|
+
nor the solvers until a public function is used.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import importlib
|
|
19
|
+
from typing import TYPE_CHECKING
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from powermean.api import NB2, fit, gpml, logols, ppml, prepare, solver_defaults
|
|
23
|
+
from powermean.data.inference_conventions import ssc
|
|
24
|
+
from powermean.errors import (
|
|
25
|
+
ConvergenceError,
|
|
26
|
+
CovarianceWarning,
|
|
27
|
+
CoverageWarning,
|
|
28
|
+
ExistenceError,
|
|
29
|
+
IdentificationError,
|
|
30
|
+
NumericalWarning,
|
|
31
|
+
SampleError,
|
|
32
|
+
SolverCapabilityError,
|
|
33
|
+
SpecificationError,
|
|
34
|
+
)
|
|
35
|
+
from powermean.solve.options import SolverOptions
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"NB2",
|
|
39
|
+
"ConvergenceError",
|
|
40
|
+
"CovarianceWarning",
|
|
41
|
+
"CoverageWarning",
|
|
42
|
+
"ExistenceError",
|
|
43
|
+
"IdentificationError",
|
|
44
|
+
"NumericalWarning",
|
|
45
|
+
"SampleError",
|
|
46
|
+
"SolverCapabilityError",
|
|
47
|
+
"SolverOptions",
|
|
48
|
+
"SpecificationError",
|
|
49
|
+
"fit",
|
|
50
|
+
"gpml",
|
|
51
|
+
"logols",
|
|
52
|
+
"ppml",
|
|
53
|
+
"prepare",
|
|
54
|
+
"solver_defaults",
|
|
55
|
+
"ssc",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
# The module that defines each public name, resolved lazily.
|
|
59
|
+
_SOURCES: dict[str, str] = {
|
|
60
|
+
"NB2": "powermean.api",
|
|
61
|
+
"fit": "powermean.api",
|
|
62
|
+
"gpml": "powermean.api",
|
|
63
|
+
"logols": "powermean.api",
|
|
64
|
+
"ppml": "powermean.api",
|
|
65
|
+
"prepare": "powermean.api",
|
|
66
|
+
"solver_defaults": "powermean.api",
|
|
67
|
+
"ssc": "powermean.data.inference_conventions",
|
|
68
|
+
"SolverOptions": "powermean.solve.options",
|
|
69
|
+
"ConvergenceError": "powermean.errors",
|
|
70
|
+
"CovarianceWarning": "powermean.errors",
|
|
71
|
+
"CoverageWarning": "powermean.errors",
|
|
72
|
+
"ExistenceError": "powermean.errors",
|
|
73
|
+
"IdentificationError": "powermean.errors",
|
|
74
|
+
"NumericalWarning": "powermean.errors",
|
|
75
|
+
"SampleError": "powermean.errors",
|
|
76
|
+
"SolverCapabilityError": "powermean.errors",
|
|
77
|
+
"SpecificationError": "powermean.errors",
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def __getattr__(name: str) -> object:
|
|
82
|
+
"""A public name, imported from its module on first access."""
|
|
83
|
+
source = _SOURCES.get(name)
|
|
84
|
+
if source is None:
|
|
85
|
+
raise AttributeError(f"module 'powermean' has no attribute {name!r}")
|
|
86
|
+
value: object = getattr(importlib.import_module(source), name)
|
|
87
|
+
globals()[name] = value
|
|
88
|
+
return value
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def __dir__() -> list[str]:
|
|
92
|
+
"""The public names beside the attributes of the module."""
|
|
93
|
+
return sorted(set(globals()) | set(__all__))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Restricted native package: the exact FE incidence row reduction.
|
|
2
|
+
|
|
3
|
+
``_echelon_cpp`` (built from ``echelon.cpp`` by the top-level CMake project when
|
|
4
|
+
``POWERMEAN_BUILD_BASIS`` is on) is an optional accelerator of
|
|
5
|
+
:func:`powermean.fe.certificate_basis._operational_echelon`. Only that module
|
|
6
|
+
imports it, only after explicit ``basis_backend="cpp"`` selection. The Python
|
|
7
|
+
loop stays the specification and handles representation/work/allocation declines.
|
|
8
|
+
A missing or broken explicitly requested extension is an error. Defaults do not
|
|
9
|
+
probe this module.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
__all__: tuple[str, ...] = ()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Internal coordination of the formula front end with the sample construction.
|
|
2
|
+
|
|
3
|
+
:mod:`powermean.formula` evaluates a formula on every row with pandas and
|
|
4
|
+
Formulaic and may import no later stage; :mod:`powermean.data` constructs the sample
|
|
5
|
+
on arrays and may import neither pandas nor Formulaic nor the interface. The modules
|
|
6
|
+
of this package stand between them. :mod:`powermean._prepare.compose` reads an
|
|
7
|
+
evaluated :class:`~powermean.formula.frame.ModelFrame` and the columns of its data,
|
|
8
|
+
feeds arrays and masks to :func:`powermean.data.sample.build_sample`, and keeps the
|
|
9
|
+
user's pandas Index in a state of its own, selected by position only;
|
|
10
|
+
:mod:`powermean._prepare.effects` reads the raw labels of a formula's fixed-effect terms
|
|
11
|
+
by position and marks their missing values for step 2 of the sample construction.
|
|
12
|
+
They evaluate no formula, transform no outcome and fit nothing, and this package
|
|
13
|
+
exports no public name. No stage of the pipeline imports it.
|
|
14
|
+
"""
|