Path Diagram for Multistate Model

Hi all,

I am searching for a method to illustrate a multistate model. I have tested statefig, but with longer labels it does not work well (check code below and compare the different labels). I know that lavaan includes something like it, but I am not sure if lavaan is a good choice for multistate models.

Thanks in advance

states <- c("1",
            "2",
            "4",
            "3",
            "5")

states <- c("Condition 1",
            "Condition 2",
            "Condition 4",
            "Condition 3",
            "Condition 5")

cmat <- matrix(0L,5,5, dimnames = list(states,states))
cmat[1, -1] <- c(1.2,1,0.8,0.4)
cmat[2, -2] <- c(0,1,0,1)
cmat[3, -3] <- c(0,0,0,1)
cmat[4, -4] <- c(0,0,1,1)

statefig(c(1,3,1), cmat,
         box = T,
         offset = c(-10,0,0,0,1))

To me it looks quite nice with a small margin value; and a nice big plot window for it to draw in

library(survival)

states <- c("1",
            "2",
            "4",
            "3",
            "5")
library(survival)
states <- c("Condition 1\nis this a problem?",
            "Condition 2\n extra long descriptions",
            "Condition 4",
            "Condition 3",
            "Condition 5")

cmat <- matrix(0L,5,5, dimnames = list(states,states))
cmat[1, -1] <- c(1.2,1,0.8,0.4)
cmat[2, -2] <- c(0,1,0,1)
cmat[3, -3] <- c(0,0,0,1)
cmat[4, -4] <- c(0,0,1,1)

statefig(c(1,3,1), cmat,
         box = T,
         offset = c(-10,0,0,0,1),
         margin = 0.01)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.