Hello Mat,<br><br>a few months ago, I wanted to perform clustering of event sequences and <span class="gD">Matthias Studer told me how to do this with the TraMineRextras package. I think you can find his message in the archives of the mailing list (he sent it on march 16th 2012).</span><br>
<br>To extract association rules from event sequences and to get the corresponding hazard ratios, you have to use the seqerulesdisc function available in the same package.<span class="gD"><br><br>Hope this helps, best regards,<br>
<br>Hugo<br><br></span><br><div class="gmail_quote">2012/7/9 Weldon, Mat <span dir="ltr"><<a href="mailto:m.weldon@lancaster.ac.uk" target="_blank">m.weldon@lancaster.ac.uk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div link="blue" vlink="purple" lang="EN-GB">
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m doing a project with a set of criminal histories (ie. Lists of age-stamped offences). Here is an example: oftype is the type of crime, and sid is the subject ID:<u></u><u></u></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">        sid        oftype   age<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.1 5556           B&E    18<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.2 5556 motor vehicle    18<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.3 5556 motor vehicle    18<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.4 5556           B&E    22<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.5 5556       alcohol    24<u></u><u></u></span></p>
<p class="MsoNormal"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">5556.6 5556 miscellaneous    29<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Since these are events, I’m using the event methods in TraMineR to analyse them. I’ve created a seqe object, and run a frequent sub-sequence analysis. Here is the top 10:<u></u><u></u></p>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">           Subsequence   Support Count<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">1            (assault) 0.6261261   417<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">2  (child molestation) 0.6246246   416<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">3               (rape) 0.5000000   333<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">4              (theft) 0.4429429   295<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">5                (B&E) 0.4159159   277<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">6      (noncontact SO) 0.3963964   264<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">7       (public order) 0.3858859   257<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">8            (alcohol) 0.3183183   212<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">9  (assault)-(assault) 0.3018018   201<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">10    (assault)-(rape) 0.2882883   192<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console""><u></u> <u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">Computed on 666 event sequences<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console"">  Constraint Value<u></u><u></u></span></pre>
<pre><span style="background:#e1e2e5;font-family:"Lucida Console""> countMethod  COBJ<u></u><u></u></span></pre>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’d like to compute clusters of sequences, either using agnes or pam algorithms, and then run a discriminating sequence analysis on the clusters (as demonstrated by Studer et al. 2010). However, I’m a bit stuck and I haven’t been able to
 find any help in the documentation. I have a few questions:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p><u></u><span>1.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Is there a function for computing dissimilarity measures, like seqdist, that works with event sequences? Something that I can feed into a clustering algorithm? I don’t know how Studer et al. did it because no code was provided.<u></u><u></u></p>

<p><u></u><span>2.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Is there a way to constrain frequent subsequences to be maximal, in the sense that if “(assault)-(assault)” is frequent then “(assault)” will not be listed, for example?<u></u><u></u></p>
<p><u></u><span>3.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Is there a way to calculate association rules for sequences using a hazard ratio measure similar to that described in Muller et al. (2010)?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Many thanks in advance. Best wishes,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Mat<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Mat Weldon<u></u><u></u></p>
<p class="MsoNormal">Department of Mathematics and Statistics<u></u><u></u></p>
<p class="MsoNormal">Room B18, Fylde College <u></u><u></u></p>
<p class="MsoNormal">Lancaster University<u></u><u></u></p>
<p class="MsoNormal">Lancaster, LA1 4YF<u></u><u></u></p>
<p class="MsoNormal">Tel: 07929 310475<u></u><u></u></p>
<p class="MsoNormal">Email: <a href="mailto:m.weldon@lancaster.ac.uk" target="_blank">m.weldon@lancaster.ac.uk</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>_______________________________________________<br>
Traminer-users mailing list<br>
<a href="mailto:Traminer-users@lists.r-forge.r-project.org">Traminer-users@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users</a><span onmouseout="cancel = false; window.setTimeout(WRCHideContent, 1000); clearTimeout(showTimer);" onmouseover=" var self = this; showTimer = window.setTimeout(function(){WRCShowContent({'rating':{'value':-1,'weight':0},'flags':{},'single':true,'ttl':7200,'expireTime':'20120709204658'}, self.className)},600);" class="wrc0" style="padding-right:16px;width:16px;height:16px"></span><br>
</blockquote></div><br>