<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Say, would a Mantel (1967) test work? The quantitative covariate can be turned into a distance matrix. &nbsp;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext"> Zuluaga, Juan
<br>
<b>Sent:</b> Monday, October 31, 2011 9:16 AM<br>
<b>To:</b> Users questions<br>
<b>Subject:</b> RE: [Traminer-users] quantitative explanatory variables?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Mr. Studer, thank you very much for the code, it makes sense.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">However, are you implying that this is an open question? &nbsp;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">The fact that you are seem to be satisfied with MJ Anderson approach for categorical explanatory variables and have implement it in dissassoc(), while you have
 no equivalent routine for quantitative, does is it mean that you are not satisfied with existing approaches for quantitative explanatory variables? &nbsp;May I ask you what have you considered (and perhaps rejected)?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">-j<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext"> traminer-users-bounces@r-forge.wu-wien.ac.at [mailto:traminer-users-bounces@r-forge.wu-wien.ac.at]
<b>On Behalf Of </b>Matthias Studer<br>
<b>Sent:</b> Monday, October 31, 2011 2:57 AM<br>
<b>To:</b> Users questions<br>
<b>Subject:</b> Re: [Traminer-users] quantitative explanatory variables?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Dear Juan Zuluaga,<br>
<br>
I agree with you. Our example dataset lacks an example with a quantitative covariate.
<br>
<br>
There are two solutions to analyse the link with a quantitative covariate. The first one is to discretize the variable before using it (an example is given below). The second solution is to use the tree procedure. This procedure automatically finds the best
 cutting points by testing all possible binary splits.&nbsp; This will also work with ordinal covariates.<br>
<br>
An example of both solutions is given below using the biofam dataset (Swiss family life sequences between 15 and 30 years old).<br>
<br>
## Loading TraMineR<br>
library(TraMineR)<br>
## Loading the biofam dataset<br>
data(biofam)<br>
<br>
## States labels<br>
bf.labels &lt;- c(&quot;Parent&quot;, &quot;Left&quot;, &quot;Married&quot;, &quot;Left/Married&quot;,&nbsp; &quot;Child&quot;, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Left/Child&quot;, &quot;Left/Married/Child&quot;, &quot;Divorced&quot;)<br>
## States short labels for the sequences<br>
bf.shortlab &lt;- c(&quot;P&quot;,&quot;L&quot;,&quot;M&quot;,&quot;LM&quot;,&quot;C&quot;,&quot;LC&quot;, &quot;LMC&quot;, &quot;D&quot;)<br>
## Building the sequence object<br>
biofam.seq &lt;- seqdef(biofam[,10:25], states=bf.shortlab, labels=bf.labels)<br>
## Computing distance using Optimal matching with transition based substitution costs.<br>
biodist &lt;- seqdist(biofam.seq, method=&quot;OM&quot;, sm=&quot;TRATE&quot;, indel=1)<br>
<br>
## First solution : Use a discretized variable<br>
## The &quot;cut&quot; function creates a factor using the given cutting points<br>
biofam$cohort &lt;- cut(biofam$birthyr, c(1900, 1930, 1940, 1950, 1960), right=FALSE,
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labels=c(&quot;1900-1929&quot;, &quot;1930-1939&quot;, &quot;1940-1949&quot;, &quot;1950-1959&quot;))<br>
## Compute the association with this new variable<br>
da &lt;- dissassoc(biodist, biofam$cohort, R=1000)<br>
## Printing results<br>
## Differences are highly significant <br>
print(da)<br>
<br>
<br>
## Second solution : Use the tree procedure<br>
## It will automatically find the best binary splits<br>
biotree &lt;- seqtree(biofam.seq~birthyr, data=biofam, diss=biodist)<br>
<br>
##Printing the tree<br>
print(biotree)<br>
## Displaying the tree (adjusting legend fontsize otherwise it's too big)<br>
## You will need to install GraphViz for this<br>
seqtreedisplay(biotree, type=&quot;d&quot;, legend.fontsize=2)<br>
<br>
<br>
## Creating a new cohort covariate according to the splitting points found with the tree procedure<br>
biofam$cohort2 &lt;- cut(biofam$birthyr, c(1900, 1929, 1941, 1947, 1951, 1970), right=FALSE,
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labels=c(&quot;&lt;=1928&quot;, &quot;1929-1940&quot;, &quot;1941-1946&quot;, &quot;1947-1950&quot;, &quot;1951&#43;&quot;))<br>
<br>
## Computing association with this new variable<br>
da2 &lt;- dissassoc(biodist, biofam$cohort2, R=1000)<br>
## Printing results<br>
## Pseudo R2 is slightly higher than before<br>
print(da2)<br>
<br>
Hope this helps.<br>
<br>
Matthias Studer<br>
<br>
<br>
<br>
Le 30.10.2011 02:04, Zuluaga, Juan a écrit&nbsp;: <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hello Traminer people,
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I read your Sociological Methods and Research paper. &nbsp;The McVicar and Anyadike-Danes (2002) dataset that you used has categorical covariates.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">How do you deal with quantitative variates? &nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Thank you!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">-juan zuluaga</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Traminer-users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Traminer-users@lists.r-forge.r-project.org">Traminer-users@lists.r-forge.r-project.org</a><o:p></o:p></pre>
<pre><a 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><o:p></o:p></pre>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>