The raw data consist of the binary judgments of 101 first-year psychology students who indicated whether or not they would display each of 8 anger-related behaviors when being angry at someone in each of 6 situations.

  1. fighting (fly off the handle, quarrel),
  2. fleeing (leave, avoid),
  3. emotional sharing (pour out one’s heart, tell one’s story),
  4. making up (make up, clear up the matter).
  1. the extent to which one likes the instigator of anger (like, dislike, unfamiliar)
  2. the status of the instigator of anger (higher, lower, equal).

Each situation is presented as one level of a factor, without specifying a level for the other factor.

library(plfm)
## Loading required package: sfsmisc
## Loading required package: abind
data(anger)
D = anger$data

Ising model graphs for situation

Plot a graph based on the Ising model pour the subset of the data of situation “like”.

library(IsingFit)
r.nb = 1 # "like" 
D.subset = matrix(0,nrow(D),ncol(D[1,,]))
for (ii in 1:nrow(D)){
    D.subset[ii,] = c(D[ii,r.nb,])
}
D.subset = data.frame(D.subset)
colnames(D.subset) <- colnames(D[1,,])

mod.ising = IsingFit(D.subset,gamma=.25)
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |========================                                         |  38%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=========================================                        |  62%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=================================================================| 100%
title("Like")

Question: What are the conditionnal independence describd by this graph?

This result can be compared to some plots from the MCA (multivariate correspondance analysis)

library(FactoMineR)
mca = MCA(apply(D.subset,2,as.factor),graph=FALSE)
plot(mca,choix="var")

Question: What are the information on the MCA plot? Can retrieve some informations which help to understand the graph plot?

Ising model graphs for behaviours

Plot a graph based on the Ising model pour the subset of the data of situation “like”.

c.nb = c(5,6) #  
D.subset = matrix(0,nrow(D),6)
for (ii in 1:nrow(D)){
    D.subset[ii,] = c(D[ii,1:3,c.nb])
}
D.subset = data.frame(D.subset)
colnames(D.subset)[1:3] <- paste("Hart","/",rownames(D[1,1:3,]),sep="")
colnames(D.subset)[4:6] <- paste("Story","/",rownames(D[1,1:3,]),sep="")
mod.ising = IsingFit(D.subset,gamma=.01)
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |===========                                                      |  17%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |======================================================           |  83%
  |                                                                       
  |=================================================================| 100%
title("Hart+Story")