[Traminer-users] Traminer-users Digest, Vol 9, Issue 3

Alexis Gabadinho Alexis.Gabadinho at unige.ch
Thu Apr 21 10:14:11 CEST 2011


Hi Alexandre,

No you should not have a % at the end since "contact[count.miss>0, 2:4]" 
displays the input data, not the sequence object.

To display the void elements in your sequence object, type

print(contact.seq, extended=TRUE)

By "the way your sequences are prepared" I mean that if one or several 
missing states (supposed to be NA's by default, but this can be 
overridden with "missing=" argument) are found in your input data, 
seqdef enters a data preparation stage. The way your missing values are 
handled in this stage is set with "left", "gaps" and "right" arguments.

Have a look at the way seqdef is handling missing values by using the 
ex1 example data set:

data(ex1)
ex1
seqdef(ex1, 1:13)
seqdef(ex1, 1:13, right=NA)

All the best,
Alexis.

Le 20. 04. 11 18:01, Alexandre Pollien a écrit :
> Thank you for your answers Matthias and Alexis,
>
> Sorry but I still have a problem with the missings: I can not 
> understand why my missings are not coded as void element. They are 
> indeed located after the last valid state and I even tried to specify 
> the default value right="DEL". I'm especially surprised because I made 
> ​​this observation on old scripts that did not react like this before 
> (I think... maybe I'm going mad?)
>
> Alexis, what do you mean by "the way your sequences are prepared"? I 
> usually use csv file
>
> An exemple to be clearer:
>
> id,c1,c2,c3
> 21,8,1,
>
> --> and import in TraMineR:
>
>
> #########################
>
> library(TraMineR)
> library(foreign)
>
> contact<-read.csv("base.csv")
>
> names(contact)
> [1] "id" "c1" "c2" "c3"
>
> contact.seq <- seqdef(contact, 2:4, right="DEL")
> [>] found missing values ('NA') in sequence data
> [>] preparing 1 sequences
> [>] coding void elements with '%' and missing values with '*'
> [>] 2 distinct states appear in the data:
> 1 = 1
> 2 = 8
> [>] alphabet (state labels):
> 1 = 1 (1)
> 2 = 8 (8)
> [>] 1 sequences in the data set
> [>] min/max sequence length: 2/2
>
> count.miss <- rowSums(is.na(contact[,2:4]))
>
> contact[count.miss>0, 2:4]
> c1 c2 c3
> 1 8 1 NA
>
> #########################
>
> Should I not have a % at the end ?
>
>
>
> Best (and beautifull easter)
>
>
> Alexandre
>
>
>
>
>
>
> Le 19.04.2011 12:00, traminer-users-request at r-forge.wu-wien.ac.at a 
> écrit :
>> Send Traminer-users mailing list submissions to
>>     traminer-users at lists.r-forge.r-project.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>     https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users 
>>
>>
>> or, via email, send a message with subject or body 'help' to
>>     traminer-users-request at lists.r-forge.r-project.org
>>
>> You can reach the person managing the list at
>>     traminer-users-owner at lists.r-forge.r-project.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Traminer-users digest..."
>>
>>
>> Today's Topics:
>>
>>     1. Re: The substitution cost matrix is not symmetric
>>        (Alexis Gabadinho)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 18 Apr 2011 13:54:12 +0200
>> From: Alexis Gabadinho<Alexis.Gabadinho at unige.ch>
>> Subject: Re: [Traminer-users] The substitution cost matrix is not
>>     symmetric
>> To: Users questions<traminer-users at r-forge.wu-wien.ac.at>
>> Message-ID:<4DAC2664.3090502 at unige.ch>
>> Content-Type: text/plain; charset=windows-1252; format=flowed
>>
>> Hi Alexandre,
>>
>> Regarding your second question, you have indeed missing values in your
>> data, since we can see in the output of seqdist that the length of your
>> sequences vary from 1 to 12.
>>
>> The way missing values (supposed to be NA's by default) are handled is
>> set in seqdef with the arguments "gaps", "left" and "right". By
>> default,  missing values found after the last valid state in a sequence
>> are coded as void elements, meaning that your sequence is supposed to
>> end with the last valid state. Thus if you have sequences of unequal
>> length, ending with NA'S , this is the way your sequences are prepared.
>> See user's guide for more information.
>>
>> To locate missing values in your data you can do for example:
>>
>> count.miss<- rowSums(is.na(contact[,2:15]))
>>
>> This counts the number of missing values in each row of your original 
>> data.
>>
>> To display the rows containing at least one missing value:
>>
>> contact[count.miss>0, 2:15]
>>
>> Best regards,
>> Alexis.
>>
>> Alexandre Pollien a ?crit :
>>> Hello,
>>>
>>> When I use seqsubm, now I get this message:
>>>
>>>>   contact.om<-
>>> seqdist(contact.seq,method="OM",indel=2,sm=cout,with.missing=FALSE,
>>> full.matrix=TRUE)
>>> [>] 5764 sequences with 9 distinct events/states
>>> [>] 496 distinct sequences
>>> [>] min/max sequence length: 1/12
>>> [>] computing distances using OM metric
>>> [>] total time: 1.25 secs
>>> Message d'avis :
>>> The substitution cost matrix is not symmetric.
>>>
>>> cout is computed with seqsubm (method="TRATE")
>>>
>>>
>>> A surprising aspect is that it is not systematic (3 / 4)
>>>
>>> I thought of a problem of missing value
>>>
>>>
>>> Another amazing prompt is that seqdef shows this message:
>>>>   contact.seq<- seqdef(contact, 2:15, states = contact.shortlab,labels
>>> = contact.lab)
>>> [>] found missing values ('NA') in sequence data
>>>
>>> ...even when there is no missing in my data! (How can I seethe
>>> sequence containing the missing data?)
>>>
>>>
>>> Does anyone have a idea?
>>>
>>> Thank you very much
>>>
>>> Best regards and good weekend
>>>
>>> Alexandre
>>>
>>>
>>>
>>> _______________________________________________
>>> Traminer-users mailing list
>>> Traminer-users at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users 
>>>
>>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> Traminer-users mailing list
>> 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 9, Issue 3
>> ********************************************
>>
>
>
>
> _______________________________________________
> Traminer-users mailing list
> 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/20110421/485554e3/attachment-0001.htm>


More information about the Traminer-users mailing list