技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
effect-estimation【数据与研究】Operate DoWhy CausalModel potential-outcomes workflows for identification, estimation, do-operations, refutation, and sensitivity analysis.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user wants DoWhy's classic potential-outcomes
workflow around CausalModel: model assumptions, identify an estimand, estimate
ACE/CATE/frontdoor/IV/mediation effects, compute do, or refute an effect
estimate.
This file is a router. Read the bundled references for concrete APIs, parameters, recipes, and failure recovery before writing nontrivial code.
Route here for requests mentioning any of these signals:
CausalModel, identify_effect, estimate_effect, refute_estimate, or
CausalModel.do.backdoor.linear_regression,
backdoor.propensity_score_matching, iv.instrumental_variable,
frontdoor.two_stage_regression, or mediation.two_stage_regression.estimate_effect API.method_name, no valid identified estimand, no
instruments, unidentifiable effects, estimate absent before refutation, NaNs,
or graph/data variable mismatches in the classic workflow.dowhy.gcm graphical causal models, structural mechanisms, GCM sampling,
GCM interventions, point counterfactuals, anomaly/root-cause attribution,
distribution change, and GCM graph/model validation belong in
../graphical-causal-models/SKILL.md.df.causal.do, do-samplers, graph string parsing, graph plotting,
data/schema preparation, built-in datasets, data transformers, graph discovery
handoff, and time-series helper questions belong in
../data-graph-interfaces/SKILL.md.CausalModel, identification, estimation, do, refutation, and result-object
signatures and return types.do, and validation steps.method_params shapes, and dependency
or access caveats.--samples, --seed, and --tolerance.common_causes, instruments, effect_modifiers), or neither.data-graph-interfaces before estimating.do(x) outcome expectation.CausalEstimate exists.CausalModel(data=df, treatment=..., outcome=..., graph=...) when
the user has a DAG; otherwise use explicit common_causes, instruments, and
effect_modifiers role lists.identified_estimand = model.identify_effect(...) and inspect the
printed estimand or its variable lists before calling estimate_effect.method_name to estimate_effect, do, and
refute_estimate; None is an error by design.<identifier>.<estimator> form, for example
backdoor.linear_regression, iv.instrumental_variable, or
frontdoor.two_stage_regression.target_units="ate", "att", "atc", a row-filter lambda, or an effect-
modifier DataFrame only when the selected estimator supports that form.fit_estimator=False only after the same model has cached a fitted
estimator for the exact same method name and compatible effect modifiers.CausalModel.do, choose a regression-style estimator that implements the
do-operator, such as backdoor.linear_regression; many estimators do not.method_params; use nested
fit_params only for options that belong to the estimator's fit call.num_simulations only for final analysis.backdoor.linear_regression for a small, transparent baseline when
linear outcome assumptions are acceptable.backdoor.generalized_linear_model for GLM outcome models; provide a
statsmodels family in method_params.iv.instrumental_variable only when valid instruments are identified and
there are at least as many instruments as treatment variables.iv.regression_discontinuity when an instrument-like threshold variable,
threshold value, and bandwidth are part of the design.frontdoor.two_stage_regression for a singleton frontdoor mediator, and
mediation.two_stage_regression for NDE/NIE mediation estimands.random_common_cause to test invariance to an independent added covariate.placebo_treatment_refuter to test that a randomized or permuted
treatment gives an effect near zero.data_subset_refuter to test stability under random subsampling.bootstrap_refuter to test stability under bootstrap resampling and noise.dummy_outcome_refuter when the outcome should be replaced by a known
synthetic target.add_unobserved_common_cause for sensitivity analysis; choose
direct-simulation, linear-partial-R2, non-parametric-partial-R2, or
e-value according to estimator assumptions and available domain bounds.num_simulations; several also
accept n_jobs and verbose through model.refute_estimate.python scripts/smoke_causal_model.py --samples 1000 --seed 7 --tolerance 0.35
python scripts/parallel_refutation_template.py --num-simulations 3 --n-jobs 1
Both scripts are self-contained and perform no downloads. Use them to confirm a current Python environment can import DoWhy and run the classic workflow before adapting code to user data.
When answering, state the chosen identification strategy, estimator method name,
required columns, important method_params, one validation check, and one
refuter or sensitivity check. If routing away, name the sibling skill and the
reason. Do not point future agents to external notebooks, tests, or a source
checkout; distill the needed recipe here.