<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi all,<br>
<br>
I hope I understand well your question. Usually, the problem with
seqfplot is that the most frequent one are the stable sequence,
especially when sequences are long (and 77 monthes is long). This is
due to the fact that every small difference is taken into account.
To overcome this problem, you may use "representative sequences".
This procedure tries to regroup sequences that differ only
marginally and to identify a set of sequences that might represent a
given percentage of the sequences in that group (see the help of the
seqrep function). <br>
<br>
The procedure and the concept of representative sequence is
described in this reference: Gabadinho A, Ritschard G, Studer M,
Müller NS (2011). "Extracting and Rendering Representative
Sequences", In A Fred, JLG Dietz, K Liu, J Filipe (eds.), <em>Knowledge
Discovery, Knowledge Engineering and Knowledge Management</em>,
volume 128 of <em>Communications in Computer and Information
Science (CCIS)</em>, pp. 94-106. Springer-Verlag.
<br>
<br>
I have another suggestion regarding your code. You may use the group
argument (available in all seq*plot) to automatically draw a
distinct plot of each group of sequences.<br>
<br>
seqdplot(fx.seq, group=pam.best.fx$clustering)<br>
<br>
<br>
Hope this helps.<br>
Matthias Studer<br>
<br>
Le 17.05.2011 19:19, Kleinbaum, Adam M. a écrit :
<blockquote
cite="mid:AC6EEF6CB9A72348B9F7D228C937211C258D431924@email.tucknt.dartmouth.edu"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m having an issue with seqfplot I’m
hoping you
can help me with. I have a series of career sequences over a
77-month
observation period for a group of 15,000 or so individuals. I
use the
following code to read in my data (including labels), define a
color palette,
and drop any observations with missing data:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">fx
<- read.csv(file="Seq_function.txt", header=FALSE)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">fx.lab
<- c("AD", "CO", "FI", "GM",
"HR", "LE", "MF", "MK", "OT",
"RD", "SC", "SL", "SV")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">fx.seq
<- seqdef(fx, 2:78, labels=fx.lab)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">attr(fx.seq,"cpal")
<- c(brewer.pal(n=12, name="Set3"), "cyan",
"white")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">fx
<- fx[!is.na(fx[,78]), ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">fx.seq
<- fx.seq[seqlength(fx.seq)==77,] <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal">Then I use TraMineR to calculate the
substitution cost
matrix and do optimal matching. Next I use the “cluster”
package to do a cluster analysis and I find that there are 9
prototypical
sequences. I’d like to do a bit of graphing for each of the 9
clusters,
so I run the following code:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">for
(i in 1:k.best.om.fx)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">
seqdplot(fx.seq[pam.best.fx$clustering==i,], withlegend=F,
title=paste("Cluster ", i))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">
seqfplot(fx.seq[pam.best.fx$clustering==i,], withlegend=F,
title=paste("Cluster ", i))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family:
"Courier New";">seqlegend(fx.seq)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">where fx.seq contains my sequences, as
shown above;
pam.best.fx is the pam object that came out of the clustering
algorithm and pam.best.fx$clustering
contains the index of each actor’s cluster assignment.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The seqdplot command produces a series of 9
beautiful
distribution plots, one for each cluster. No problem.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What I want seqfplot to do is, for each
cluster, graph out
the frequency of sequences within each cluster, from most
frequent on down the
list. To take one example, the medoid of one cluster is 77
observations
of all the same job function – people who stay in sales and
don’t
move. People assigned to that cluster should have spent
nearly all 77
periods in that function. The output should look like a long
sequence of
blocks that are mostly the same color, with another sequence
above it that’s
a little bit different, but also mostly all the same color.
But instead,
every single block is a different color from the one next to
it. There’s
obviously some problem with either how I’m calling the
function or how I’m
defining my color palette, but I can’t figure out what it is.
I’m
especially perplexed that seqdplot works properly while an
identical call to seqfplot
does not. Any ideas? Thanks in advance,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">All the best,<o:p></o:p></p>
<p class="MsoNormal">Adam<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">--<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size: 10pt;">Adam M.
Kleinbaum<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">Assistant
Professor<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">Tuck School
of Business<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">Dartmouth
College<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;"><a class="moz-txt-link-freetext" href="http://bit.ly/kleinbaum">http://bit.ly/kleinbaum</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">603.646.6447<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Traminer-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Traminer-users@lists.r-forge.r-project.org">Traminer-users@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users</a>
</pre>
</blockquote>
</body>
</html>