What if we don’t know the structure?
Are the two nodes independent given any set of other nodes (including the empty set)?
Are the two nodes independent given any set of other nodes (including the empty set)?
Are the two nodes independent given any set of other nodes (including the empty set)?
Is the middle node in the set that separated the other two nodes?
Is the middle node in the set that separated the other two nodes?
Doosje, B., Loseman, A., & Bos, K. (2013). Determinants of radicalization of Islamic youth in the Netherlands: Personal uncertainty, perceived injustice, and perceived group threat. Journal of Social Issues, 69(3), 586-604.
MacCallum, R. C., Wegener, D. T., Uchino, B. N., & Fabrigar, L. R. (1993). The problem of equivalent models in applications of covariance structure analysis. Psychological bulletin, 114(1), 185.
Data <- read.csv(text = '
In-group Identification;identification; 4.56; 0.85
Individual Deprivation;in_dep; 2.39; 0.81
Collective Deprivation;col_dep; 3.31; 0.92
Intergroup Anxiety;anxiety; -0.20; 0.17
Symbolic Threat;sym_threat; 3.46; 0.76
Realistic Threat;real_threat; 3.10; 0.88
Personal Emotional Uncertainty;uncertainty; 2.84; 0.67
Perceived Injustice;injustice; 2.38; 0.68
Perceived Illegitimacy authorities;illegitemacy; 2.37; 0.02
Perceived In-group superiority;superiority; 3.26; 0.93
Distance to Other People;distance; 2.32; 0.66
Societal Disconnected;disconnected; 2.79; 0.96
Attitude towards Muslim Violence;muslim_violence; 2.89; 1.06
Own Violent Intentions;own_violent; 2.08; 0.91
', sep = ";", header = FALSE)
names(Data) <- c("name","var","mean", "sd")
library("lavaan")
corMat <- getCov('
1 -.19 .08 -.25 .42 .07 .08 -.06 -.28 .09 -.17 -.25 -.04 -.07
1 .49 .36 .23 .50 .21 .50 .25 .12 .17 .21 .12 .09
1 .11 .54 .62 .26 .38 .21 .31 .18 .09 .20 .10
1 .01 .15 .19 .21 .35 .08 .22 .26 .18 .14
1 .64 .21 .24 .07 .39 .01 .04 .17 -.01
1 .27 .34 .16 .35 .19 .14 .26 .16
1 .10 .08 .29 .18 .00 .30 .14
1 .15 .01 .03 .23 .04 .06
1 .22 .17 .35 .35 .24
1 .34 .08 .53 .30
1 .08 .44 .39
1 .24 .00
1 .47
1
',lower=FALSE)
covmat <- cor2cov(corMat, Data$sd)
colnames(covmat) <- rownames(covmat) <- Data$var
library("pcalg")
pc.fit <- pc(suffStat = list(C = covmat, n = 131),
indepTest = gaussCItest,
alpha=0.05, labels = as.character(Data$name))
library("qgraph")
qgraph(pc.fit, vsize = 15, vsize2 = 5, shape = "ellipse", repulsion = 0.7)
Mod <-'
muslim_violence ~ own_violent + distance + disconnected + superiority
disconnected ~ identification
superiority ~ sym_threat
sym_threat ~ col_dep + identification
col_dep ~ in_dep
real_threat ~ in_dep + sym_threat
in_dep ~~ injustice
'
fit <- sem(Mod, sample.cov = covmat, sample.nobs = 131)
round(fitMeasures(fit)[c('chisq','df', 'pvalue','cfi','nfi','rmsea','rmsea.ci.lower','rmsea.ci.upper')], 2)
## chisq df pvalue cfi nfi
## 80.52 39.00 0.00 0.89 0.81
## rmsea rmsea.ci.lower rmsea.ci.upper
## 0.09 0.06 0.12
The edges in a MRF can be interpreted in several ways:
If this model is the generating model, does:
# Generate data (binary):
A <- sample(c(0,1), 10000, replace = TRUE)
B <- 1 * (runif(10000) < ifelse(A==1, 0.8, 0.2))
# Predict A from B (logistic bregression):
AonB <- glm(A ~ B, family = "binomial")
coef(AonB)
## (Intercept) B
## -1.425 2.834
# Predict B from A (logistic regression):
BonA <- glm(B ~ A, family = "binomial")
coef(BonA)
## (Intercept) A
## -1.416 2.834
If this model is the generating model, does:
# Generate data (Gaussian):
A <- rnorm(10000)
B <- A + rnorm(10000)
C <- B + 2*rnorm(10000)
# Predict A from C:
AonC <- lm(A ~ C)
summary(AonC)
##
## Call:
## lm(formula = A ~ C)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.420 -0.610 -0.002 0.608 3.047
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.01185 0.00913 -1.3 0.19
## C 0.16511 0.00376 43.9 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.913 on 9998 degrees of freedom
## Multiple R-squared: 0.162, Adjusted R-squared: 0.162
## F-statistic: 1.93e+03 on 1 and 9998 DF, p-value: <2e-16
# Predict A from B and C:
AonBC <- lm(A ~ B + C)
summary(AonBC)
##
## Call:
## lm(formula = A ~ B + C)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7929 -0.4827 0.0039 0.4751 2.8681
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.00280 0.00709 -0.40 0.69
## B 0.49651 0.00612 81.16 <2e-16 ***
## C -0.00177 0.00357 -0.49 0.62
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.709 on 9997 degrees of freedom
## Multiple R-squared: 0.495, Adjusted R-squared: 0.495
## F-statistic: 4.89e+03 on 2 and 9997 DF, p-value: <2e-16
\[ \Pr\left( \boldsymbol{X} = \boldsymbol{x} \right) = \frac{1}{Z} \exp \left( \sum_i \tau_i x_i + \sum_{<ij>} \omega_{ij} x_i x_j \right) \]
In matrix form the Ising Model probability distribution is proportional to: \[ \Pr\left(\pmb{X} = \pmb{x}\right) \propto \exp\left( \pmb{\tau}^\top \pmb{x} + \frac{1}{2} \pmb{x}^\top\pmb{\Omega}\pmb{x} \right) \]
\[ \boldsymbol{\Omega} = \begin{bmatrix} 0 & \omega_{12} & 0\\ \omega_{12} & 0 & \omega_{23}\\ 0 & \omega_{23} & 0\\ \end{bmatrix}, \boldsymbol{\tau} = \begin{bmatrix} \tau_1 \\ \tau_2 \\ \tau_3 \end{bmatrix} \]
\[ \boldsymbol{\Omega} = \begin{bmatrix} 0 & 0.5 & 0\\ 0.5 & 0 & 0.5\\ 0 & 0.5 & 0\\ \end{bmatrix}, \boldsymbol{\tau} = \begin{bmatrix} -0.1 \\ -0.1 \\ -0.1 \end{bmatrix} \]
\[ \Pr\left( \boldsymbol{X} = \boldsymbol{x} \right) = \frac{1}{Z} \exp \left( \sum_i \tau_i x_i + \sum_{<ij>} \omega_{ij} x_i x_j \right) \]
We can compute the unnormalized probability that all nodes are \(1\):
\[ \exp\left( -0.1 + -0.1 + -0.1 + 0.5 + 0.5 \right) = 2.0138 \]
What if we observe \(X_2 = 1\)?
What if we observe \(X_2 = 1\)?
What if we observe \(X_2 = 1\)?
The conditional distribution for node \(i\) given that we observe all other nodes is: \[ \Pr\left(X_i = x_i \mid \pmb{X}^{-(i)} = \pmb{x}^{-(i)} \right) \propto \exp\left( \left(\tau_i + \sum_{j,j\not=i} \omega_{ij} x_j \right) x_i\right) \]
\[ \Pr\left( X_1 = 1 \right) \propto \exp\left(\tau_1 + \omega_{12} x_2 + \omega_{14} x_4\right) \]
\[ \Pr\left( X_2 = 1 \right) \propto \exp\left(\tau_2 + \omega_{12} x_1 + \omega_{23} x_3\right) \]
\[ \Pr\left( X_3 = 1 \right) \propto \exp\left(\tau_3 + \omega_{23} x_2 + \omega_{34} x_4\right) \]
\[ \Pr\left( X_4 = 1 \right) \propto \exp\left(\tau_4 + \omega_{14} x_1 + \omega_{34} x_3\right) \]
If \(\pmb{x}\) is not binary but assumed Gaussian we can use a multivariate Gaussian distribution: \[ f\left( \pmb{X} = \pmb{x} \right) = \frac{1}{\sqrt{(2\pi)^k|\boldsymbol\Sigma|}} \exp\left(-\frac{1}{2}({\boldsymbol x}-{\boldsymbol\mu})^{\top}{\boldsymbol\Sigma}^{-1}({\boldsymbol x}-{\boldsymbol\mu}) \right) \]
Reparameterizing \(\pmb{\tau} = {\boldsymbol \mu}^\top {\boldsymbol\Sigma}^{-1}\) and \(\pmb{\Omega} = -\boldsymbol{\Sigma}^{-1}\) we obtain the following expression for the Multivariate Normal Distribution:
\[ f\left(\pmb{x}\right) \propto \exp\left( \pmb{\tau}^\top \pmb{x} + \frac{1}{2} \pmb{x}^\top\pmb{\Omega}\pmb{x} \right) \]
If we observe the value of every node except node \(i\) we obtain the following (assuming all variables are standardized):
\[ \begin{aligned} X_i \mid \pmb{X}^{-(i)} \sim N\left( \sum_{j\not=i} \frac{\omega_{ij}}{\theta^2_i} x_j, \theta^2_{i} \right) \end{aligned} \]
In which \(\theta^2_{i}\) is the \(i\)th diagonal element of the precision matrix, also called the residual variance.
\[ X_1 = \tau_1 + \omega_{12} \theta^{-2}_1 x_2 + \omega_{14} \theta^{-2}_1 x_4 + \varepsilon_1 \]
\[ X_2 = \tau_2 + \omega_{12} \theta^{-2}_2 x_2 + \omega_{23} \theta^{-2}_2 x_3 + \varepsilon_2 \]
\[ X_3 = \tau_3 + \omega_{23} \theta^{-2}_3 x_3 + \omega_{34} \theta^{-2}_3 x_4 + \varepsilon_3 \]
\[ X_4 = \tau_4 + \omega_{34} \theta^{-2}_4 x_3 + \omega_{14} \theta^{-2}_4 x_1 + \varepsilon_4 \]
Because the Ising Model is a combination of multiple logistic models and the Gaussian Random field a combination of multiple linear models we can form MRF’s in the following way:
By Jolanda Kossakowski
By Jolanda Kossakowski
By Jolanda Kossakowski
By Jolanda Kossakowski
By Jolanda Kossakowski
By Jolanda Kossakowski
By Jolanda Kossakowski