I wasn't able to come up with anything definitive, but I did come up with this toy example that might be helpful to you.
In the first example, all three hold: $E(XY)=E(E(X|Z)Y)$, $E(XW)=E(E(X|Z)W)$, and $E(XY)=E(E(X|Z,W)Y)$
In the second example, none of the three hold.
require(dplyr)
calc <- function(A, p) {
stopifnot(sum(p) == 1)
Ex <- sum(p*A$X)
Ey <- sum(p*A$Y)
Ez <- sum(p*A$Z)
Ew <- sum(p*A$W)
# E(X|Z)
Exgz <- with(A, c(sum(X[Z==0]*p[Z==0])/sum(p[Z==0]), sum(X[Z==1]*p[Z==1])/sum(p[Z==1])))
# E(E(X|Z))
EExgz <- sum(p*Exgz[A$Z+1])
stopifnot(Ex == EExgz)
# E(X)E(Y)
ExEy <- Ex * Ey
# E(XY)
Exy <- sum(p*A$X*A$Y)
# E(E(X|Z)Y)
EExgz_y <- sum(p*Exgz[A$Z+1]*A$Y)
# E(X)E(W)
ExEw <- Ex * Ew
# E(XW)
Exw <- sum(p*A$X*A$W)
# E(E(X|Z)W)
EExgz_w <- sum(p*Exgz[A$Z+1]*A$W)
# E(X|Z,W)
Exgzw <- with(A, matrix(c(sum(X[Z==0 & W==0]*p[Z==0 & W==0])/sum(p[Z==0 & W==0]),
sum(X[Z==1 & W==0]*p[Z==1 & W==0])/sum(p[Z==1 & W==0]),
sum(X[Z==0 & W==1]*p[Z==0 & W==1])/sum(p[Z==0 & W==1]),
sum(X[Z==1 & W==1]*p[Z==1 & W==1])/sum(p[Z==1 & W==1])
), nrow = 2, ncol = 2))
# E(E(X|Z,W))
EExgzw <- sum(p*mapply(function(z,w) Exgzw[z+1,w+1], z=A$Z, w=A$W))
stopifnot(EExgzw == Ex)
# E(E(X|Z,W) Y)
EExgzw_y <- sum(p*mapply(function(z,w) Exgzw[z+1,w+1], z=A$Z, w=A$W)*A$Y)
cov_xy <- with(A, sum(p*(X - mean(Ex))*(Y - mean(Ey))))
cov_xz <- with(A, sum(p*(X - mean(Ex))*(Z - mean(Ez))))
cov_xw <- with(A, sum(p*(X - mean(Ex))*(W - mean(Ew))))
cov_yz <- with(A, sum(p*(Z - mean(Ez))*(Y - mean(Ey))))
cov_yw <- with(A, sum(p*(W - mean(Ew))*(Y - mean(Ey))))
cov_zw <- with(A, sum(p*(Z - mean(Ez))*(W - mean(Ew))))
return(list(Exy=Exy, ExEy=ExEy, EExgz_y=EExgz_y,
Exw=Exw, ExEw=ExEw, EExgz_w=EExgz_w,
EExgzw_y=EExgzw_y,
cov=matrix(c(cov_xy,0,0,cov_xz,cov_yz,0,cov_xw,cov_yw,cov_zw), ncol=3, dimnames = list(c("X","Y","Z"), c("Y","Z","W")))))
}
################################################################################
A <- expand.grid(X=c(0,1), Y=c(0,1), Z=c(0,1), W=c(0,1))
p_x <- data.frame(X = c(0, 0, 1, 1),
Z = c(0, 1, 0, 1),
p_x = c(0.3, 0.4, 0.7, 0.6))
A <- A %>% dplyr::inner_join(p_x, by = c("X", "Z"))
A$p_y <- ifelse(A$Y == 0, 0.15, 0.85)
A$p_z <- ifelse(A$Z == 0, 0.8, 0.2)
A$p_w <- ifelse(A$W == 0, 0.1, 0.9)
# P(X,Y,Z,W) = P(W)*P(Z|W)*P(Y|W,Y)*P(X|Z,W,Y)
# = P(W)*P(Z)*P(Y)*P(X|Z)
p <- with(A, p_x * p_y * p_z * p_w)
calc(A, p)
#> $Exy
#> [1] 0.578
#>
#> $ExEy
#> [1] 0.578
#>
#> $EExgz_y
#> [1] 0.578
#>
#> $Exw
#> [1] 0.612
#>
#> $ExEw
#> [1] 0.612
#>
#> $EExgz_w
#> [1] 0.612
#>
#> $EExgzw_y
#> [1] 0.578
#>
#> $cov
#> Y Z W
#> X 6.505213e-19 -1.600000e-02 -1.301043e-18
#> Y 0.000000e+00 1.734723e-18 1.084202e-19
#> Z 0.000000e+00 0.000000e+00 -1.084202e-19
################################################################################
A <- expand.grid(X=c(0,1), Y=c(0,1), Z=c(0,1), W=c(0,1))
A$p_z <- ifelse(A$Z == 0, 0.8, 0.2)
p_x <- data.frame(X = c(0, 0, 1, 1),
Z = c(0, 1, 0, 1),
p_x = c(0.3, 0.4, 0.7, 0.6))
A <- A %>% dplyr::inner_join(p_x, by = c("X", "Z"))
p_y <- data.frame(Y = c(0, 0, 0, 0, 1, 1, 1, 1),
X = c(0, 0, 1, 1, 0, 0, 1, 1),
Z = c(0, 1, 0, 1, 0, 1, 0, 1),
p_y = c(0.1, 0.2, 0.3, 0.4, 0.9, 0.8, 0.7, 0.6))
A <- A %>% dplyr::inner_join(p_y, by = c("Y", "X", "Z"))
A$p_w <- c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.99, 0.98, 0.97, 0.96, 0.95, 0.94, 0.93, 0.92)
# P(X,Y,Z,W) = P(Z)*P(X|Z)*P(Y|Z,X)*P(W|X,Y,Z)
p <- with(A, p_x * p_y * p_z * p_w)
calc(A, p)
#> $Exy
#> [1] 0.464
#>
#> $ExEy
#> [1] 0.50592
#>
#> $EExgz_y
#> [1] 0.5072
#>
#> $Exw
#> [1] 0.65232
#>
#> $ExEw
#> [1] 0.6530176
#>
#> $EExgz_w
#> [1] 0.653616
#>
#> $EExgzw_y
#> [1] 0.5073216
#>
#> $cov
#> Y Z W
#> X -0.04192 -0.0160 -0.00069760
#> Y 0.00000 -0.0128 -0.00287808
#> Z 0.00000 0.0000 -0.00598400
Created on 2022-08-08 by the reprex package (v2.0.1)