[Traminer-users] plots with group option vs separate plots

Pierre Blavier pit.blavier at gmail.com
Tue Mar 25 23:52:33 CET 2014


Hi,

thanks to both, you are right :

> ncol(trajpro.seq)
[1] 41
instead of 21.

In fact i have sequences that are misaligned like stairs year by year, so i
do :

trajpro.seq <- seqdef(immimigpro, 1636:1676, states=labpro.court,
labels=labpro.long, xstep=6, left="DEL", right="DEL")
summary(trajpro.seq)
> freq(seqlength(trajpro.seq), total=T)
         n     %
1        1   0.0
3        1   0.0
4        1   0.0
5        1   0.0
6        2   0.1
8        1   0.0
9        1   0.0
10       1   0.0
11       1   0.0
12       2   0.1
13       1   0.0
16       1   0.0
17       1   0.0
18       1   0.0
19       2   0.1
20       7   0.3
21    2264  98.9
41       1   0.0
NA       0   0.0
Total 2290 100.0

I guess these 2290-2264 individuals are "real missing values" and do not
understand why one remains at 41.

immimigpro <- subset(immimigpro, seqlength(trajpro.seq)==21)
freq(seqlength(trajpro.seq), total=T)

> trajpro.seq <- seqdef(immimigpro, 1636:1676, states=labpro.court,
labels=labpro.long, xstep=6, left="DEL", right="DEL")
 [>] found missing values ('NA') in sequence data
 [>] preparing 2264 sequences
 [>] coding void elements with '%' and missing values with '*'
 [>] state coding:
       [alphabet]  [label]  [long label]
     1  1           Sa       Salarié
     2  2           In       Indépendant
     3  3           Ch       Chômage
     4  4           Et       Etudes
     5  5           Fo       Foyer
     6  6           Aut      Autre
     7  7           Var      Variable
 [>] 2264 sequences in the data set
 [>] min/max sequence length: 21/21

summary(trajpro.seq)

and then i obtain the graph with 41 periods even if all sequences are all
21-period long.

The solution with seqiplot(data.seq[,1:21]) works but it would be better to
fix the problem above. Any idea ?

Thanks a lot, best,

Pierre












2014-03-24 16:14 GMT+01:00 Gilbert Ritschard <Gilbert.Ritschard at unige.ch>:

>  Hi Pierre,
>
>
>
> It would be more useful to get help if you would provide the code you are
> using to generate your state sequence object.
>
>
>
> My guess is that you created your state sequence object by passing a table
> with 41 columns (the last 20 ones containing perhaps only NA's). Assuming
> your sequence data are in columns 1 to 21 of a data frame named data, a
> solution would be to use something like seqdef(data[,1:21]).
>
>
>
> If your state sequence object is data.seq, you can use
> seqiplot(data.seq[,1:21]) to plot only the first 21 columns. Fixing the
> seqdef problem is preferable however.
>
>
>
> Best.
>
> Gilbert
>
>
>
>
>
> *From:* traminer-users-bounces at lists.r-forge.r-project.org [
> mailto:traminer-users-bounces at lists.r-forge.r-project.org<traminer-users-bounces at lists.r-forge.r-project.org>]
> *On Behalf Of *Pierre Blavier
> *Sent:* Sunday, March 23, 2014 18:02
> *To:* Users questions
> *Subject:* Re: [Traminer-users] plots with group option vs separate plots
>
>
>
> Hi everybody,
>
>
>
> here is a plot from the TramineR seqiplot command. It gives the first 10
> sequences of my dataset, all my sequences are 21 period-long. Does anyone
> know how to reduce the length of the x-axis to have a length of the longest
> sequence, i.e. 21 periods ? It's probably simple but i could not fix it. I
> have the same problems for other plots
>
>
>
> Thanks, Best,
>
>
>
> Pierre
>
>
>
>
>
>
>
> [image: Image removed by sender.]
>
>
>
>
>
> 2014-01-15 16:35 GMT+01:00 Gilbert Ritschard <Gilbert.Ritschard at unige.ch>:
>
>  Hi Jeremy,
>
>
>
> Thank you for your question. Could you provide a reproducible working
> example? Indeed you are right, you should get the same plot in both cases.
> You do not provide enough information, however, to allow identifying the
> source of the problem.
>
>
>
> Your question certainly is of interest for many TraMineR users and future
> users.  I would therefore suggest you post your question on StackOverflow
> (see http://mephisto.unige.ch/traminer/contrib.shtml) using the
> "traminer" tag which is searchable, unlike this r-forge list.
>
>
>
> Best.
>
> Gilbert
>
>
>
>
>
>
>
> *From:* traminer-users-bounces at lists.r-forge.r-project.org [mailto:
> traminer-users-bounces at lists.r-forge.r-project.org] *On Behalf Of *Jeremy
> Reynolds
> *Sent:* Monday, January 13, 2014 22:09
> *To:* traminer-users at lists.r-forge.r-project.org
> *Subject:* [Traminer-users] plots with group option vs separate plots
>
>
>
> Hello,
>
> I have been making sequence plots, and I seem to be getting very different
> results when I use the "group" option of the seqdplot or seqIplot command
> than when I draw separate plots for each subgroup.
>
> After creating a sequence object and performing optimal matching using
> PAM, I have chosen a 4 cluster solution.  I then create a single plot that
> shows the distribution across states in each of the 4 clusters like this:
>
>
> seqdplot(seq.hc, group = pam5vs$clustering$cluster4, border = NA,
> title="pam5vs")
>
> If I subset the data and make a separate plot for one of the 4 clusters as
> in the code below, the N matches the results above (the total N and the N
> across the states), but I get a very different impression of how the cases
> are distributed across the states in the two graphs.  Am I doing something
> wrong?  I would be happy to provide more detail if needed.
>
> Thanks,
>
> Jeremy
>
>
> cluster4 <- subset(bhps, pam5vs$clustering$cluster4==(6875))
> seq.cluster4 <- seqdef(cluster4 [4:21], labels = c("M", "S", "F", "O", "U"
> ))
>
> seqdplot(seq.cluster4, border = NA, title="pam5vs cluster 6875")
>
> --
>
> ********************
> Dr. Jeremy Reynolds
> Associate Professor
> Undergraduate Coordinator
> Department of Sociology
> 116 Baldwin Hall
> University of Georgia
> Athens, GA 30602-1611
> Phone: (706) 583-8072
> Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
> Fax: (706) 542-4320
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20140325/05bcce61/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD000.jpg
Type: image/jpeg
Size: 823 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20140325/05bcce61/attachment.jpg>


More information about the Traminer-users mailing list