Description Usage Format Details Examples
Each sequence contains the marital status for a given indivudal across 12 years. The sequence dataset is derived from data from the British Household Panel Survey.
1 | data("maritalData")
|
A data frame with 4728 observations across 12 BHPS census waves.
Each sequence represents a unique individual. The sequence alphabet is of length seven and the possible states are: "divorced", "have a dissoved civil partnership","in a civil partnership", "married", "never married", "separated", and "widowed".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | library(TraMineR)
data(maritalData)
#-------------------------------------------
# Converting the data into a sequence object
#-------------------------------------------
#balphabet = c( "divorced" , "have a dissolved civil partnership" ,
#"in a civil partnership", "married" ,
#"never married" ,"separated" ,"widowed" )
#blabels = c( "divorced" , "have a dissolved civil partnership" ,
#"in a civil partnership", "married" ,
#"never married" ,"separated" ,"widowed" )
#bcodes = c( "divorced" , "have a dissolved civil partnership",
#"in a civil partnership", "married" ,
#"never married" ,"separated" ,"widowed" )
#bseq = seqdef(maritalData, alphabet=balphabet,
#states = bcodes, labels = blabels)
# forming a sequence object
#-----------------------------
# Calculating the mobility index
# per sequence and storing
# the indices in an array
#-----------------------------
#lseq = length(bseq[,1])
#wseq = length(bseq[1,])
#sequence_summary = array(0,c(lseq,1))
#for(i in 1:lseq){
#sequence_summary[i] = mobility_index(bseq[i,],balphabet,7)
#}
#plot(hist(sequence_summary),xlim=c(1,7),col="red")
#---------------------------------------
# Generating subsets of the sequence data
#--------------------------------------
#seqIplot(bseq, sortv = "from.start",cex.legend=1)
#mseq = bseq[which(bseq[,1]=="married"),] # sequences which start with the married state
#seqIplot(mseq, sortv = "from.start",cex.legend=1)
#sseq = bseq[which(bseq[,1]=="never married"),] # sequences which start with the never married state
#seqIplot(sseq, sortv = "from.start",cex.legend=1)
#------------------------------------
# Lifecourse destandardization
#------------------------------------
#object = summary(as.factor(sequence_summary))
#summarize = chisq.test(object,p = rep(1/length(object),9))
# assuming the "standard" probabilities is p = rep(1/length(object),9)
# alternative standard probabilities can be used.
#summary(maritalData)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.