full <- rbind(c(0, 1, 1, 1),
c(0, 0, 1, 1),
c(0, 0, 0, 1),
c(0, 0, 0, 0))
chain <- rbind(c(0, 1, 0, 0),
c(0, 0, 1, 0),
c(0, 0, 0, 1),
c(0, 0, 0, 0))
identical(shd(full, chain), c(3/6, 3))
Run the code above in your browser using DataLab