Skip to main content
. 2019 Dec 29;22(1):46. doi: 10.3390/e22010046
Algorithm 1 Sampling of causal data via forward model
  • Input: Power spectra Pβ,Pf, noise variance ς2, number of bins nbins, desired number (As we draw the number of samples from Poisson distribution in each bin, we do not deterministically control the total number of samples) of samples N˜

  • Output:N samples (di)=(xi,yi) generated from a causal relation of either XY or YX
    1. Draw a sample field βR[0,1] from the distribution N(β|0,B)
    2. Set an equally spaced grid with nbins points in the interval [0,1]: z=(z1,,znbins),zi=i0.5nbins
    3. Calculate the vector of Poisson means λ=(λ1,λnbins) with λieβ(zi)
    4. At each grid point i{1,,nbins}, draw a sample ki from a Poisson distribution with mean λi: kiPλi(ki)
    5. Set N=i=1nbinski
    6. For each i{1,,nbins} add ki times the element zi to the set of measured xj. Construct the vector x=(,zi,zi,zikitimes,)
    7. Draw a sample field fR[0,1] from the distribution N(f|0,F). Rescale f s.th. f[0,1][0,1]
    8. Draw a multivariate noise sample ϵRN from a normal distribution with zero mean and variance ς2, ϵN(ϵ|0,ς2)
    9. Generate the effect data y by applying f to x and adding ϵ: y=f(x)+ϵ
    10. With probability 12 return d=(xT,yT), otherwise return d=(yT,xT)