<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<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;}
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-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.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:"Calibri","sans-serif";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:"Calibri","sans-serif";color:#1F497D">However, are you implying that this is an open question? <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";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? 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:"Calibri","sans-serif";color:#1F497D">-j<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </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:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";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> </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. 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 <- c("Parent", "Left", "Married", "Left/Married", "Child", <br>
"Left/Child", "Left/Married/Child", "Divorced")<br>
## States short labels for the sequences<br>
bf.shortlab <- c("P","L","M","LM","C","LC", "LMC", "D")<br>
## Building the sequence object<br>
biofam.seq <- seqdef(biofam[,10:25], states=bf.shortlab, labels=bf.labels)<br>
## Computing distance using Optimal matching with transition based substitution costs.<br>
biodist <- seqdist(biofam.seq, method="OM", sm="TRATE", indel=1)<br>
<br>
## First solution : Use a discretized variable<br>
## The "cut" function creates a factor using the given cutting points<br>
biofam$cohort <- cut(biofam$birthyr, c(1900, 1930, 1940, 1950, 1960), right=FALSE,
<br>
labels=c("1900-1929", "1930-1939", "1940-1949", "1950-1959"))<br>
## Compute the association with this new variable<br>
da <- 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 <- 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="d", legend.fontsize=2)<br>
<br>
<br>
## Creating a new cohort covariate according to the splitting points found with the tree procedure<br>
biofam$cohort2 <- cut(biofam$birthyr, c(1900, 1929, 1941, 1947, 1951, 1970), right=FALSE,
<br>
labels=c("<=1928", "1929-1940", "1941-1946", "1947-1950", "1951+"))<br>
<br>
## Computing association with this new variable<br>
da2 <- 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 : <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello Traminer people,
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I read your Sociological Methods and Research paper. 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:"Calibri","sans-serif";color:#1F497D">How do you deal with quantitative variates? </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thank you!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-juan zuluaga</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><br>
<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> </o:p></p>
</div>
</body>
</html>