Skip to main content
. Author manuscript; available in PMC: 2019 Apr 16.
Published in final edited form as: Proc AAAI Conf Artif Intell. 2016 Feb;2016:1037–1043.
Algorithm 1 Causal Explanation in Stochastic Processes
1:functionEXPLAIN(B,A)2:(WCF,WDEF)CHARACTERISTICSAMPLES(A)3:PCF1nWCFB4:PDEF1nWDEFB5:PΔPDEFPCF6:pPLOGLIKELIHOODTEST(n,nPCF,nPDEF)7:tCF1nwWcftB(w)8:tDEF1nwWdeftB(w)9:tΔtDEFtCF10:ptWELCHSTTEST(tB(WCF),tB(WDEF))11:mCF1nwWcfmB(w)12:mDEF1nwWdefmB(w)13:mΔmDEFmCF14:pmWELCHSTTEST(mB(WCF),mB(WDEF))15:return(PΔ,pP),(tΔ,pt),(mΔ,pm)16:functionCHARACTERISTICSAMPLES(A)17:ttAτ18:WCF19:WDEF20:k021:whilek<ndo22:repeat23:wCFsample fromPt()24:untilwCFA25:repeat26:wDEFsample fromPt()27:untilwDEFA28:WCFWCFwCF29:WDEFWDEFwDEF30:kk+131:return(WCF,WDEF)