410 likes | 872 Views
Tetrad: Machine Learning and Graphcial Causal Models. Richard Scheines Joe Ramsey Carnegie Mellon University. Peter Spirtes, Clark Glymour. Goals. Convey rudiments of graphical causal models Basic working knowledge of Tetrad IV. Tetrad IV: Complete Causal Modeling Tool. Tetrad.
E N D
Tetrad: Machine Learning and Graphcial Causal Models Richard Scheines Joe Ramsey Carnegie Mellon University Peter Spirtes, Clark Glymour
Goals Convey rudiments of graphical causal models Basic working knowledge of Tetrad IV
Tetrad Main website: http://www.phil.cmu.edu/projects/tetrad/ Download site: http://www.phil.cmu.edu/projects/tetrad_download/ Data files: www.phil.cmu.edu/projects/tetrad_download/download/workshop/Data/
Topic Outline Motivation Representing/Modeling Causal Systems Estimation and Updating Model Search Linear Latent Variable Models Case Study: fMRI
StatisticalCausal Models: Goals • Policy, Law, and Science: How can we use data to answer • subjunctive questions (effects of future policy interventions), or • counterfactual questions (what would have happened had things been done differently (law)? • scientific questions (what mechanisms run the world) • Rumsfeld Problem: Do we know what we do and don’t know: Can we tell when there is or is not enough information in the data to answer causal questions?
Causal Inference Requires More than Probability Prediction from Observation ≠ Prediction from Intervention P(Lung Cancer 1960 = y | Tar-stained fingers 1950 = no) ≠ P(Lung Cancer 1960 = y | Tar-stained fingers 1950 set = no) In general: P(Y=y | X=x, Z=z) ≠ P(Y=y | Xset=x, Z=z) Causal Prediction vs. Statistical Prediction: Non-experimental data (observational study) P(Y=y | X=x, Z=z) P(Y,X,Z) P(Y=y | Xset=x, Z=z) Causal Structure Background Knowledge
Foundations of Causal Epistemology Some Causal Structures can parameterize the sameset of probability distributions, some cannot P1(X,YZ) Y Z X Y Z X P2(X,YZ) Y Z X Y Z X
Causal Search Causal Search: Find/compute all the causal models that are indistinguishable given background knowledge and data Represent features common to all such models Multiple Regressionis often the wrong tool for Causal Search: Example: Foreign Investment & Democracy
Does Foreign Investment in 3rd World Countries inhibit Democracy? Foreign Investment Timberlake, M. and Williams, K. (1984). Dependence, political exclusion, and government repression: Some cross-national evidence. American Sociological Review 49, 141-146. N = 72 PO degree of political exclusivity CV lack of civil liberties EN energy consumption per capita (economic development) FI level of foreign investment
Foreign Investment Correlations po fi en fi -.175 en -.480 0.330 cv 0.868 -.391 -.430
Case Study 1: Foreign Investment Regression Results po = .227*fi - .176*en + .880*cv SE (.058) (.059) (.060) t 3.941 -2.99 14.6 Interpretation: foreign investment increases political repression
Case Study 1: Foreign Investment Alternatives There is no model with testable constraints (df > 0) in which FI has a positive effect on PO that is not rejected by the data.
Outline • Motivation • Representing/Modeling Causal Systems • Causal Graphs • Standard Parametric Models • Bayes Nets • Structural Equation Models • Other Parametric Models • Generalized SEMs • Time Lag models
Causal Graphs Causal Graph G = {V,E} Each edge X Y represents a direct causal claim: X is a direct cause of Y relative to V Years of Education Income Years of Education Skills and Knowledge Income
Causal Graphs Not Cause Complete Common Cause Complete
Modeling Ideal Interventions Interventions on the Effect Post Pre-experimental System Room Temperature Sweaters On
Modeling Ideal Interventions Interventions on the Cause Post Pre-experimental System Sweaters On Room Temperature
Pre-intervention graph “Soft” Intervention “Hard” Intervention Interventions & Causal Graphs Model an ideal intervention by adding an “intervention” variable outside the original system as a direct cause of its target. Intervene on Income
Tetrad Demo Build and Save an acyclic causal graph: with 3 measured variables, no latents with at least 3 measured variables, and at least 1 latent
Causal Bayes Networks The Joint Distribution Factors According to the Causal Graph, P(S,YF, L) = P(S) P(YF | S) P(LC | S)
Causal Bayes Networks The Joint Distribution Factors According to the Causal Graph, P(S = 0) = 1 P(S = 1) = 1 - 1 P(YF = 0 | S = 0) = 2 P(LC = 0 | S = 0) = 4 P(YF = 1 | S = 0) = 1- 2 P(LC = 1 | S = 0) = 1- 4 P(YF = 0 | S = 1) = 3 P(LC = 0 | S = 1) = 5 P(YF = 1 | S = 1) = 1- 3 P(LC = 1 | S = 1) = 1- 5 P(S) P(YF | S) P(LC | S) = f() All variables binary [0,1]: = {1, 2,3,4,5,}
Structural Equation Models Causal Graph • Structural Equations For each variable X V, an assignment equation: X := fX(immediate-causes(X), eX) • Exogenous Distribution: Joint distribution over the exogenous vars : P(e)
Linear Structural Equation Models Causal Graph Path diagram Equations: Education := Education Income :=Educationincome Longevity :=EducationLongevity Exogenous Distribution: P(ed, Income,Income) - i≠jei ej(pairwise independence) - no variance is zero E.g. (ed, Income,Income) ~N(0,2) 2 diagonal, - no variance is zero Structural Equation Model: V = BV + E
Tetrad Demo • Interpret your causal graph with 3 measured variables with at least 2 parametric models: • Bayes Parametric Model • SEM Parametric Model • Interpret your other graph with a parametric model of your choice
Tetrad Demo Instantiate at least one Bayes PM with a Bayes IM Instantiate at least one SEM PM with a SEM IM Instantiate at least one SEM PM with a Standardized SEM IM Generate two data sets (N= 50, N=5,000) for each
Outline • Motivation • Representing/Modeling Causal Systems • Causal Graphs • Standard Parametric Models • Bayes Nets • Structural Equation Models • Other Parametric Models • Generalized SEMs • Time Lag models
Generalized SEM • The Generalized SEM is a generalization of the linear SEM model. • Allows for arbitrary connection functions • Allows for arbitrary distributions • Simulation from cyclic models supported.
Hands On • Create a DAG. • Parameterize it as a Generalized SEM. • Open the Generalized SEM and select Apply Templates from the Tools menu. • Apply the default template to variables, which will make them all linear functions. • For errors, select a non-Gaussian distribution, such as U(0, 1). • Save.
Time Series Simulation (Hands On) • Tetrad includes support for doing time series simulations. • First, one creates a time series graph. • Then one parameterizes the time series graph as a SEM. • Then one instantiates the SEM. • Then one simulates data from the SEM Instantiated Model.
Time Series Simulation • One can, e.g., calculate a vector auto-regression for it. (One can do this as well from time series data loaded in.) • Attach a data manipulation box to the data. • Select vector auto-regression. • One can create staggered time series data • Attach a data manipulation box. • Select create time series data. • Should give the time lag graph with some extra edges in the highest lag.
Tetrad Demo Estimate one Bayes PM for which you have an IM and data Estimate one SEM PM for which you have an IM and data Import data from charity.txt, and build and estimate model two models to estimate on those data
Hypothesis 1 Hypothesis 2
Tetrad Demo Pick one of your Bayes IMs Find a variable X to update conditional on Y such that:The marginal on X changes when Y is passively observed = y, but does not change when Y is manipulated = y Find a variable Z to update conditional on W such that:The marginal on Z changes when W is passively observed = w, and changes in exactly the same way when W is manipulated = w