Help on plot from transition matrix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help on plot from transition matrix

LFG85
Dear all,

 I am wanting to make a flow diagram like the one attached as an example
for the given dataset (
https://drive.google.com/file/d/1CdtcJ5g6bp6jEoY7P6dKxO1mZWLEFZX7/view?usp=sharing
).

The idea is to plot a flow diagram using the probabilities given by a
transition matrix like the displayed in the example below. I have found
some tools like DiagrammeR which might work for this purpose, but it works
by introducing values manually. I wanted to know if there exists any
package able to plot automatically the flow diagram, given the transition
probabilities.

Thanks in advance.

#######

library(TraMineR)

h2a=c("Q-X-Q-Y-W-Z-P")

h3a=c("Q-X-Q-Y-W-Z-P-Q-M-P-Q-A")

h4a=c("Q-X-Q-X-Q-X-Q-Y-W-Z-C-B-Q-M-B-Q-A")

h6a=c("Q-X-Q-X-Q-Y-W-Z-P-Q-P-Q-M-Q-A")

h7a=c("Q-Y-W-Z-P-Q-B-Q-M-A")

h8a=c("Q-Y-W-Z-P-B-Q-M-Q-A")

h9a=c("Q-X-Q-W-Z-B-Q-A")

h10a=c("Q-Y-W-Z-Q-A")

h11a=c("Q-Y-W-Z-B-Q-P-B-Q-M-A")

h12a=c("Q-W-Z-B-P-Q-A")

h13a=c("Q-X-Q-Y-W-Z-P-Q-A")

h14a=c("Q-X-B-X-Q-X-B-Q-X-Q-X-Q-Y-W-Z-B-P-B-Q-A")

h15a=c("Q-X-Y-W-Z-B-P-Q-B-Q-A")

h16a=c("Q-X-Q-B-Q-X-B-X-Q-Y-W-Z-P-B-Q-A")

h17a=c("Q-X-Q-X-B-X-Q-W-Z-P-B-P-Q-A")

h18a=c("Q-Y-W-Z-B-P-Q-B-Q-P-Q-M-B-P-A")

h19a=c("Q-W-Z-B-P-Q-P-Q-M-Q-A")

a=c(h2a,h3a,h4a,h6a,h7a,h8a,h9a,h10a,h11a,h12a,h13a,h14a,h15a,h16a,h17a,h18a,h19a)

a

library(TraMineR)

i1=seqdef(c(h2a,h3a,h4a,h6a,h7a,h8a,h9a,h10a,h11a,h12a,h13a,h14a,h15a,h16a,h17a,h18a,h19a))

seqtrate(i1)

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Help on plot from transition matrix

Jim Lemon-4
Hi Luis,
I had a quick look at the "diagram" package, which seems to accept
transition matrices. I don't have it installed, but the help pages are
fairly easy to follow and may do the job for you.

Jim

On Wed, Aug 26, 2020 at 5:50 PM Luis Fernando GarcĂ­a
<[hidden email]> wrote:

>
> Dear all,
>
>  I am wanting to make a flow diagram like the one attached as an example
> for the given dataset (
> https://drive.google.com/file/d/1CdtcJ5g6bp6jEoY7P6dKxO1mZWLEFZX7/view?usp=sharing
> ).
>
> The idea is to plot a flow diagram using the probabilities given by a
> transition matrix like the displayed in the example below. I have found
> some tools like DiagrammeR which might work for this purpose, but it works
> by introducing values manually. I wanted to know if there exists any
> package able to plot automatically the flow diagram, given the transition
> probabilities.
>
> Thanks in advance.
>
> #######
>
> library(TraMineR)
>
> h2a=c("Q-X-Q-Y-W-Z-P")
>
> h3a=c("Q-X-Q-Y-W-Z-P-Q-M-P-Q-A")
>
> h4a=c("Q-X-Q-X-Q-X-Q-Y-W-Z-C-B-Q-M-B-Q-A")
>
> h6a=c("Q-X-Q-X-Q-Y-W-Z-P-Q-P-Q-M-Q-A")
>
> h7a=c("Q-Y-W-Z-P-Q-B-Q-M-A")
>
> h8a=c("Q-Y-W-Z-P-B-Q-M-Q-A")
>
> h9a=c("Q-X-Q-W-Z-B-Q-A")
>
> h10a=c("Q-Y-W-Z-Q-A")
>
> h11a=c("Q-Y-W-Z-B-Q-P-B-Q-M-A")
>
> h12a=c("Q-W-Z-B-P-Q-A")
>
> h13a=c("Q-X-Q-Y-W-Z-P-Q-A")
>
> h14a=c("Q-X-B-X-Q-X-B-Q-X-Q-X-Q-Y-W-Z-B-P-B-Q-A")
>
> h15a=c("Q-X-Y-W-Z-B-P-Q-B-Q-A")
>
> h16a=c("Q-X-Q-B-Q-X-B-X-Q-Y-W-Z-P-B-Q-A")
>
> h17a=c("Q-X-Q-X-B-X-Q-W-Z-P-B-P-Q-A")
>
> h18a=c("Q-Y-W-Z-B-P-Q-B-Q-P-Q-M-B-P-A")
>
> h19a=c("Q-W-Z-B-P-Q-P-Q-M-Q-A")
>
> a=c(h2a,h3a,h4a,h6a,h7a,h8a,h9a,h10a,h11a,h12a,h13a,h14a,h15a,h16a,h17a,h18a,h19a)
>
> a
>
> library(TraMineR)
>
> i1=seqdef(c(h2a,h3a,h4a,h6a,h7a,h8a,h9a,h10a,h11a,h12a,h13a,h14a,h15a,h16a,h17a,h18a,h19a))
>
> seqtrate(i1)
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.