[Traminer-users] Traminer-users Digest, Vol 35, Issue 2

Gilbert Ritschard Gilbert.Ritschard at unige.ch
Mon Nov 18 18:26:05 CET 2013


Hi Jeremy,

You should also subset the dissimilarity matrix seq.om, and since the maximum distance in seq.om[clust1,clust1] is less than the maximum in the whole matrix you have to give explicitly the maximum distance.
With:

seqrplot(mvad.seq[clust1,], dist.matrix = seq.om[clust1,clust1], dmax=max(seq.om), border = NA)

you get the same solution for the first cluster.

Best.
Gilbert

From: traminer-users-bounces at lists.r-forge.r-project.org [mailto:traminer-users-bounces at lists.r-forge.r-project.org] On Behalf Of Jeremy Reynolds
Sent: Monday, November 18, 2013 17:44
To: traminer-users at lists.r-forge.r-project.org
Subject: Re: [Traminer-users] Traminer-users Digest, Vol 35, Issue 2

Dear Alexis and Chris,
Thank you very much for your help with the special seqrplot plot.  I have an additional question that you or someone else on the list can probably answer easily.

In experimenting with seqrplot, I have found that when I request plots for each cluster in a cluster solution I get a different result than when I try to get a single plot using only the data from one cluster.  I have included an example below.  Shouldn't these be the same? Am I doing something wrong when selecting the cases to use in the second sqrplot command?
Thanks,

Jeremy
P.S. Has anyone identified a color scheme for sequence index plots that works well when the plot has to be black & white or grey scale?

############
# My example code
############
data(mvad)
mvad.labels <- c("employment", "further education", "higher education", "joblessness", "school", "training")
mvad.scode <- c("EM", "FE", "HE", "JL", "SC", "TR")
mvad.seq <- seqdef(mvad, 17:86, states = mvad.scode, labels = mvad.labels, xtstep = 6)
ccost <- seqsubm(mvad.seq, method = "CONSTANT", cval = 2)
seq.om<http://seq.om> <- seqdist(mvad.seq, method = "OM", sm = ccost)
clusterward <- agnes(seq.om<http://seq.om>, diss = TRUE, method = "ward")
cluster3 <- cutree(clusterward, k = 3)
cluster3 <- factor(cluster3, labels = c("Type 1", "Type 2", "Type 3"))
table(cluster3)

#representative sequences for each cluster
seqrplot(mvad.seq, group = cluster3, dist.matrix = seq.om<http://seq.om>, border = NA)

#representative sequences for a particular cluster (here cluster 1)
#why are the results not the same as when done by group in the previous seqrplot?   (# of sequences and coverage do not match output from above)
clust1 <- which(cluster3=="Type 1")
seqrplot(mvad.seq[clust1,], dist.matrix = seq.om<http://seq.om>, border = NA)


############
# The output
############
> #representative sequences for each cluster
  > seqrplot(mvad.seq, group = cluster3, dist.matrix = seq.om<http://seq.om>, border = NA)
[>] number of objects (sum of weights): 295
[>] max. distance: 140
[>] neighborhood radius: 14
[>] 1 representative(s) selected, coverage=32% (threshold=25%)
[>] 186 distinct sequence(s)
[>] number of objects (sum of weights): 164
[>] max. distance: 140
[>] neighborhood radius: 14
[>] 2 representative(s) selected, coverage=39% (threshold=25%)
[>] 98 distinct sequence(s)
[>] number of objects (sum of weights): 253
[>] max. distance: 140
[>] neighborhood radius: 14
[>] 3 representative(s) selected, coverage=30% (threshold=25%)
[>] 206 distinct sequence(s)
> #representative sequences for a particular cluster (here cluster 1)
  > #why are the results not the same as when done by group in the previous seqrplot?  (# of sequences and coverage do not match output from above)
  > clust1 <- which(cluster3=="Type 1")
> seqrplot(mvad.seq[clust1,], dist.matrix = seq.om<http://seq.om>, border = NA)
[>] number of objects (sum of weights): 295
[>] max. distance: 140
[>] neighborhood radius: 14
[>] 3 representative(s) selected, coverage=27% (threshold=25%)
[>] 186 distinct sequence(s)









Today's Topics:

   1. Plot of Representative Sequences (Jeremy Reynolds)
   2. Re: Plot of Representative Sequences (Chris Cameron)
   3. Re: Plot of Representative Sequences (Alexis Gabadinho)


----------------------------------------------------------------------

Message: 1
Date: Thu, 14 Nov 2013 16:15:49 -0500
From: Jeremy Reynolds <jeremyr at uga.edu<mailto:jeremyr at uga.edu>>
To: traminer-users at lists.r-forge.r-project.org<mailto:traminer-users at lists.r-forge.r-project.org>
Subject: [Traminer-users] Plot of Representative Sequences
Message-ID:
        <CABicVB9xs7V33HQ=vFYYKjOxULd5fzZjgFBOZOeTmqkVYragQQ at mail.gmail.com<mailto:vFYYKjOxULd5fzZjgFBOZOeTmqkVYragQQ at mail.gmail.com>>
Content-Type: text/plain; charset="iso-8859-1"

Dear TraMineR Users,

Does anyone know how Gabadinho and Ritschard produced figure 5 of their
paper (see link below)? For each group, it has one plot showing three
different sequences: the sequence that is most frequent, the sequence with
the highest neighborhood density, and the sequence that is most central.

I can do a plot with one of the three sequences for each group, but I'm not
sure how to combine the three into a single plot.

Thanks,

Jeremy

Gabadinho A, Ritschard G (2013). "Searching for typical life trajectories
applied to child birth histories", In R L?vy, E. Widmer (eds.), *Gendered
Life Courses*, pp. 287-312. Vienna: LIT.

http://mephisto.unige.ch/pub/publications/gr/GabadhinoRitschard-TypicalTrajectories2013.pdf

--
********************
Dr. Jeremy Reynolds
Associate Professor
Undergraduate Coordinator
Department of Sociology
116 Baldwin Hall
University of Georgia
Athens, GA 30602-1611
Phone: (706) 583-8072<tel:%28706%29%20583-8072>
Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
Fax: (706) 542-4320<tel:%28706%29%20542-4320>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20131114/8906d0a6/attachment-0001.html>

------------------------------

Message: 2
Date: Thu, 14 Nov 2013 16:35:43 -0500
From: Chris Cameron <cjc73 at cornell.edu<mailto:cjc73 at cornell.edu>>
To: Users questions <traminer-users at r-forge.wu-wien.ac.at<mailto:traminer-users at r-forge.wu-wien.ac.at>>
Subject: Re: [Traminer-users] Plot of Representative Sequences
Message-ID: <0996DFC3-86BB-4629-8F7C-9EC42255217A at cornell.edu<mailto:0996DFC3-86BB-4629-8F7C-9EC42255217A at cornell.edu>>
Content-Type: text/plain; charset="iso-8859-1"

Hi Jeremy

I think you would create a new input sequences set with only the desired sequences and then use seqiplot.
You can also just plot particular values using indexing. Does this work for your case?

seqiplot(morn.dss[c(1,6,10),])

Chris Cameron
PhD Candidate
Dept of Sociology
Cornell University


On Nov 14, 2013, at 4:15 PM, Jeremy Reynolds <jeremyr at uga.edu<mailto:jeremyr at uga.edu>> wrote:

> Dear TraMineR Users,
>
> Does anyone know how Gabadinho and Ritschard produced figure 5 of their paper (see link below)? For each group, it has one plot showing three different sequences: the sequence that is most frequent, the sequence with the highest neighborhood density, and the sequence that is most central.
>
> I can do a plot with one of the three sequences for each group, but I'm not sure how to combine the three into a single plot.
>
> Thanks,
>
> Jeremy
>
> Gabadinho A, Ritschard G (2013). "Searching for typical life trajectories applied to child birth histories", In R L?vy, E. Widmer (eds.), Gendered Life Courses, pp. 287-312. Vienna: LIT.
>
> http://mephisto.unige.ch/pub/publications/gr/GabadhinoRitschard-TypicalTrajectories2013.pdf
>
>
> --
> ********************
> Dr. Jeremy Reynolds
> Associate Professor
> Undergraduate Coordinator
> Department of Sociology
> 116 Baldwin Hall
> University of Georgia
> Athens, GA 30602-1611
> Phone: (706) 583-8072<tel:%28706%29%20583-8072>
> Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
> Fax: (706) 542-4320<tel:%28706%29%20542-4320>
> _______________________________________________
> Traminer-users mailing list
> Traminer-users at lists.r-forge.r-project.org<mailto:Traminer-users at lists.r-forge.r-project.org>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20131114/b2122592/attachment-0001.html>

------------------------------

Message: 3
Date: Fri, 15 Nov 2013 11:04:45 +0100
From: Alexis Gabadinho <alexis.gabadinho at unige.ch<mailto:alexis.gabadinho at unige.ch>>
To: <traminer-users at lists.r-forge.r-project.org<mailto:traminer-users at lists.r-forge.r-project.org>>
Subject: Re: [Traminer-users] Plot of Representative Sequences
Message-ID: <5285F1BD.5090905 at unige.ch<mailto:5285F1BD.5090905 at unige.ch>>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Dear Jeremry,

The plot is created by using the seqrep function with all three
criteria, then retrieving the index of the representatives and using
them to select the sequences to plot in the whole set with the tlim
argument.

Here is a code example, where
- "seq.object" is the sequence object,
- "dist" is  the pairwise distance matrix
- "max.dist" is the maximum theoretical distance between two sequences
(it is provided because it is not sure wether the maximum observed
distance equal the theoretical maximum)

## Sequences representatives
medoid <- seqrep(seq.object, criterion="dist", nrep=1, dist.matrix=dist,
dmax=max.dist)
freq <- seqrep(seq.object, criterion="freq", nrep=1, dist.matrix=dist,
dmax=max.dist)
density <- seqrep(seq.object, criterion="density", nrep=1,
dist.matrix=dist, dmax=max.dist)

rep.idx <- c(attr(freq,"Index")[1], attr(density,"Index")[1],
     attr(medoid,"Index")[1])
seqiplot(seq.object, tlim=rep.idx, withlegend=FALSE, title="Title",
border=NA)

Best regards,
Alexis


Le 14. 11. 13 22:15, Jeremy Reynolds a ?crit :
> Dear TraMineR Users,
>
> Does anyone know how Gabadinho and Ritschard produced figure 5 of
> their paper (see link below)? For each group, it has one plot showing
> three different sequences: the sequence that is most frequent, the
> sequence with the highest neighborhood density, and the sequence that
> is most central.
>
> I can do a plot with one of the three sequences for each group, but
> I'm not sure how to combine the three into a single plot.
>
> Thanks,
>
> Jeremy
>
> Gabadinho A, Ritschard G (2013). "Searching for typical life
> trajectories applied to child birth histories", In R L?vy, E. Widmer
> (eds.),/Gendered Life Courses/, pp. 287-312. Vienna: LIT.
>
> http://mephisto.unige.ch/pub/publications/gr/GabadhinoRitschard-TypicalTrajectories2013.pdf
>
>
> --
> ********************
> Dr. Jeremy Reynolds
> Associate Professor
> Undergraduate Coordinator
> Department of Sociology
> 116 Baldwin Hall
> University of Georgia
> Athens, GA 30602-1611
> Phone: (706) 583-8072<tel:%28706%29%20583-8072>
> Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
> Fax: (706) 542-4320<tel:%28706%29%20542-4320>
>
>
> _______________________________________________
> Traminer-users mailing list
> Traminer-users at lists.r-forge.r-project.org<mailto:Traminer-users at lists.r-forge.r-project.org>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20131115/cd9d3890/attachment-0001.html>

------------------------------

_______________________________________________
Traminer-users mailing list
Traminer-users at lists.r-forge.r-project.org<mailto:Traminer-users at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users

End of Traminer-users Digest, Vol 35, Issue 2
*********************************************



--
********************
Dr. Jeremy Reynolds
Associate Professor
Undergraduate Coordinator
Department of Sociology
116 Baldwin Hall
University of Georgia
Athens, GA 30602-1611
Phone: (706) 583-8072<tel:%28706%29%20583-8072>
Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
Fax: (706) 542-4320<tel:%28706%29%20542-4320>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20131118/7322666b/attachment-0001.html>


More information about the Traminer-users mailing list