Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models
Author
Christian Gische
Title
Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models
Description
Computation of interventional distribution in example model and proof of identification.
Category
Academic Articles & Supplements
Keywords
causal inference, structural equation modeling, graphical models, graph-based causal models, acyclic directed mixed graphs
URL
http://www.notebookarchive.org/2022-02-457rm10/
DOI
https://notebookarchive.org/2022-02-457rm10
Date Added
2022-02-09
Date Last Modified
2022-02-09
File Size
78.45 kilobytes
Supplements
Rights
CC BY 4.0



Supplementary material to C. Gische and M. C. Voelkle, “Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models,” Psychometrika, (2021). https://doi.org/10.1007/s11336-021-09811-z.
Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models
Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models
Christian Gische
Define the matrix of structural coefficients and the covariance matrix of the error terms
Define the matrix of structural coefficients and the covariance matrix of the error terms
(*definethematrixofstructuralcoefficients;sincethesymbolCisprotectedinMathematica,welabelthematrixasC6,where6isthenumberofobservedvariables*)
In[]:=
C6={{0,0,0,0,0,0},{0,0,0,0,0,0},{cxx,cxy,0,0,0,0},{cyx,cyy,0,0,0,0},{0,0,cxx,cxy,0,0},{0,0,cyx,cyy,0,0}};
(*definethecovariancematrixoftheerrorterms*)
In[]:=
PSI={{psix1x1,psix1y1,psix1x2,0,0,0},{psix1y1,psiy1y1,0,psiy1y2,0,0},{psix1x2,0,psixx,psixy,psix2x3,0},{0,psiy1y2,psixy,psiyy,0,psiy2y3},{0,0,psix2x3,0,psixx,psixy},{0,0,0,psiy2y3,psixy,psiyy}};
(*definethemeanvectoroftheerrorterms*)
In[]:=
Eepsilon={{0},{0},{0},{0},{0},{0}};
Compute the model implied distribution of observed variabels
Compute the model implied distribution of observed variabels
(*definethemodelimpliedmeanvectoroftheobservedvariables*)
In[]:=
EV=Inverse[IdentityMatrix[6]-C6].Eepsilon;
(*definethemodelimpliedcovariancematrixoftheobservedvariables*)
In[]:=
SigmaV=Inverse[IdentityMatrix[6]-C6].PSI.Transpose[Inverse[IdentityMatrix[6]-C6]];
(*collecttermsinthemodelimpliedcovariancematrixoftheobservedvariables*)
In[]:=
SigmaV=Collect[SigmaV,{psix1x1,psiy1y1,psix1y1,psixx,psiyy,psixy,psix1x2,psix2x3,psiy1y2,psiy2y3}];
(*extractthemodelimpliedvarianceofX2*)
In[]:=
VX2=SigmaV[[3,3]];
(*extractthemodelimpliedvarianceofY3*)
In[]:=
VY3=SigmaV[[6,6]];
(*extractthemodelimpliedcovarianceofX2andY3*)
In[]:=
COVX2Y3=SigmaV[[3,6]];
(*calculatetheconditionalmeanofY3givenX2=x2*)
In[]:=
EY3condX2=COVX2Y3/VX2*x2;
(*calculatetheconditionalvarianceofY3givenX2=x2*)
In[]:=
VY3condX2=VY3-(COVX2Y3^2/VX2);
Calculate the interventional moments for do(X2=x2)
Calculate the interventional moments for do(X2=x2)
(*definetheselectionmatrixfortheinterventionalvariable*)
In[]:=
e3={{0},{0},{1},{0},{0},{0}};
(*definethematrixthatsetstheinterventionalrowtozero*)
In[]:=
IN={{1,0,0,0,0,0},{0,1,0,0,0,0},{0,0,0,0,0,0},{0,0,0,1,0,0},{0,0,0,0,1,0},{0,0,0,0,0,1}};
(*definethetransformationmatrixT1*)
In[]:=
T1=Inverse[IdentityMatrix[6]-IN.C6].IN;
(*definethevectora1*)
In[]:=
a1=Inverse[IdentityMatrix[6]-IN.C6].e3;
(*calculatetheinverventionalmeanvector*)
In[]:=
Edox2=a1*x2;
(*calculatetheinverventionalcovariancematrix*)
In[]:=
Vdox2=T1.PSI.Transpose[T1];
(*collecttermsinthemodelimpliedcovariancematrixoftheobservedvariables*)
In[]:=
Vdox2=Collect[Vdox2,{psix1x1,psiy1y1,psix1y1,psixx,psiyy,psixy,psix1x2,psix2x3,psiy1y2,psiy2y3}];
(*extracttheinterventionalmeanofY3givendo(X2=x2)*)
EY3dox2=Edox2[[6]];
(*extracttheinterventionalvarianceofY3givendo(X2=x2)*)
VY3dox2=Vdox2[[6,6]];
ProofofIdentification
(*matrixofstructuralcoefficientsaccordingtoEquation3.2.1inBekkeretal.(1994);thismatrixcorrespondstothematrixI-Cfromthepaper;seealsoTableS.3ofthiselectronicsupplementarymaterial*)
In[]:=
IminusC6={{1,0,0,0,0,0},{0,1,0,0,0,0},{-cxx,-cxy,1,0,0,0},{-cyx,-cyy,0,1,0,0},{0,0,-cxx,-cxy,1,0},{0,0,-cyx,-cyy,0,1}};
(*CovariancematrixoferrortermsaccordingtoBekkeretal.(1994);thismatrixcorrespondstothematrixPsifromthepaper;seealsoTableS.3ofthiselectronicsupplementarymaterial*)
In[]:=
Psi={{psix1x1,psix1y1,psix1x2,0,0,0},{psix1y1,psiy1y1,0,psiy1y2,0,0},{psix1x2,0,psixx,psixy,psix2x3,0},{0,psiy1y2,psixy,psiyy,0,psiy2y3},{0,0,psix2x3,0,psixx,psixy},{0,0,0,psiy2y3,psixy,psiyy}};
(*restrictionmatrixR_PsiseeEquation(S.31)ofthiselectronicsupplementarymaterial*)
In[]:=
RPsi={{0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0}};
In[]:=
Dimensions[RPsi]
(*restrictionmatrixR_CseeEquation(S.32)ofthiselectronicsupplementarymaterial*)
In[]:=
In[]:=
Dimensions[RC]
(*commutationmatrixform=n=6,seeEquation1.5.1inBekkeretal.(1994)*)
In[]:=
(*M-matrix,seeSection1.5(belowEquation1.5.1)inBekkeretal.(1994)forp=6*)
In[]:=
M6=1/2*(IdentityMatrix[36]+K6);
(*Kroneckerproductinthefirstentryofthematrixontheright-handsideofEquation3.3.6inBekkeretal.(1994);seealsoEquation(S.29)ofthiselectronicsupplementarymaterial*)
In[]:=
FPsi=KroneckerProduct[IdentityMatrix[6],Psi];
(*Firstentryofthematrixontheright-handsideofEquation3.3.6inBekkeretal.(1994)seealsoEquation(S.29)ofthiselectronicsupplementarymaterial*)
In[]:=
J1=2*RPsi.M6.FPsi;
(*Kroneckerproductinthesecondentryofthematrixontheright-handsideofEquation3.3.6inBekkeretal.(1994);seealsoEquation(S.29)ofthiselectronicsupplementarymaterial*)
In[]:=
FC=KroneckerProduct[IdentityMatrix[6],Transpose[IminusC6]];
(*Secondentryofthematrixontheright-handsideofEquation3.3.6inBekkeretal.(1994);seealsoEquation(S.29)ofthiselectronicsupplementarymaterial*)
In[]:=
J2=RC.FC;
(*Joinfirstandsecondentryofthematrixontheright-handsideofEquation3.3.6inBekkeretal.(1994)toobtaintheJacobianmatrix;seealsoEquation(S.29)ofthiselectronicsupplementarymaterial*)
In[]:=
J=Join[J1,J2];
(*RankevaluationoftheJacobianmatrix*)
In[]:=
MatrixRank[J]
Out[]=
36
In[]:=
NullSpace[J]
Out[]=
{}
In[]:=
Dimensions[J]
Out[]=
{43,36}


Cite this as: Christian Gische, "Beyond the Mean: A Flexible Framework for Studying Causal Effects Using Linear Models" from the Notebook Archive (2022), https://notebookarchive.org/2022-02-457rm10

Download

