[R] Help with Sequences.ind.0, package Biograph

Annalisa Stacchini s.annina at hotmail.it
Sun Mar 2 17:56:36 CET 2014


Dear R
users,I do not know if I'm right using the function Sequences.ind.0() of the package Biograph:I run the
following code (data in csv attached, they are a sub-sample of a bigger
sample): PICCOLO<-read.csv("PICCOLO.csv")TRANSpiccolo<-data.frame(as.Date(PICCOLO$S, origin=
PICCOLO$S, format("%Y-%m-%d")),as.Date(PICCOLO$A,
origin= PICCOLO$A, format("%Y-%m-%d")),as.Date(PICCOLO$B,
origin= PICCOLO$B, format("%Y-%m-%d")), as.Date(PICCOLO$C,
origin= PICCOLO$C, format("%Y-%m-%d")), as.Date(PICCOLO$D,
origin= PICCOLO$D, format("%Y-%m-%d")), as.Date(PICCOLO$E,
origin= PICCOLO$E, format("%Y-%m-%d"))) colnames(TRANSpiccolo)<-c("S", "A",
"B", "C", "D","E")library(Biograph)SEQ.prova_piccolo<-Sequences.ind.0(d=
TRANSpiccolo,
namestates<-c("S", "A", "B", "C",
"D","E"))TRpiccolo<- cbind(cmc_as_Date(SEQ.prova_piccolo$d[
,1], format.out="%Y-%m-%d"), cmc_as_Date(SEQ.prova_piccolo$d[ ,2], format.out="%Y-%m-%d"),
cmc_as_Date(SEQ.prova_piccolo$d[ ,3], format.out="%Y-%m-%d"))





















colnames(TRpiccolo)<-c("T","U","V")

and I get
paths (to see them, write: SEQ.prova_piccolo$path), where the initial
state (S), which is the same for every individual, is repeated twice (e.g. SSB,
SSAD).1) Is it
right? Or I'd
better exclude the column S, with the 'dates of birth' of the individuals
(equal to the date of enty in state S), and get paths with not-repeated S (e.g.
SB, SAD)? 2)
Moreover, I get a transitions matrix (SEQ.prova_piccolo$d), where the dates
appear in different colums with respect to where they are in the input
dataframe (TRANSpiccolo).Is it
right? 
3) Then, when I check if the dates of the transitions matrix are ok, through cmc_as_Date() , I get wrong and meaningless dates (as you can see by taping: TRpiccolo). May this happen because the dates, in the matrix provided by Sequences.ind.0(), are not in cmc format? In which format are they?
Or is my error anywhere else?
Thanks for your attention,RegardsAnnalisa Stacchini











































  		 	   		  


More information about the R-help mailing list