Re: [R] Help on plot from transition matrix
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 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]] > > __ > R-help@r-project.org 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. __ R-help@r-project.org 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.
[R] Help on plot from transition matrix
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]] __ R-help@r-project.org 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.
Re: [R] Help on plot from transition matrix
Thanks Jim, I do not know what happened, I will try the question again. Best El lun., 24 ago. 2020 a las 5:47, Jim Lemon () escribió: > Hi Luis, > As so often happens, the image didn't make it. Try PNG or PDF format. > Without seeing what you want, it's only guessing. > > Jim > > On Mon, Aug 24, 2020 at 6:34 PM Luis Fernando García > wrote: > > > > I am wanting to make a flow diagram like the one attached as an example > for > > the given dataset. > > > > The idea is to plot a flow diagramm 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) > > __ > > R-help@r-project.org 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. > [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] Help on plot from transition matrix
Hi Luis, As so often happens, the image didn't make it. Try PNG or PDF format. Without seeing what you want, it's only guessing. Jim On Mon, Aug 24, 2020 at 6:34 PM Luis Fernando García wrote: > > I am wanting to make a flow diagram like the one attached as an example for > the given dataset. > > The idea is to plot a flow diagramm 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) > __ > R-help@r-project.org 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. __ R-help@r-project.org 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.
[R] Help on plot from transition matrix
I am wanting to make a flow diagram like the one attached as an example for the given dataset. The idea is to plot a flow diagramm 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) __ R-help@r-project.org 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.