I am still new to TraMineR; therefore, my problem might be very simple for most of you.
I am working on some sequence plots with my data and would like to see the results with the survey weights and nominal weights. I am able to import data into R and run sequence plots with the data as is, but am unable to run it with weights. I have included my syntax on how I created the state sequence objects (pretty naïve) and a two sequence plot examples. How do I write syntax to use weights? Thanks
Data file: DISDATAC; Survey weights: WTSURVY; Nominal weights: NORMWEIGHTS
DISDATAC<-read.spss("/Users/tac0432/Desktop/DISDATAC.sav",to.data.frame=TRUE,use.value.labels=TRUE,)
DISDATAC.shortlab <- c("2yr", "4yr", "Gov","Bus","UeL")
DISDATAC.lab <- c("2year college or Other School System", " 4year college or Medical Institution", " Government","Business/Industry","Unemployed or Not in the labor force")
DISDATAC.seq <- seqdef(DISDATAC, 09:12, states = DISDATAC.shortlab, labels = DISDATAC.lab)
DISDATAC.seq[1:20, 1:4] ; print(DISDATAC.seq[1:20, ], format = "SPS"); alphabet(DISDATAC.seq)
stlab(DISDATAC.seq)
Sequence Plot Syntax examples
seqIplot(DISDATAW.seq, border = NA, group = DISDATAW$NMRMEMG, sortv = "from.start")
seqIplot(DISDATAW.seq, border = NA, group = DISDATAW$GENDER:DISDATAW$NMRMEMG, sortv = "from.start")
Hard to be certain without a sample of your data to play with, but it looks like you need to provide a column of
weightsin theseqdeffunction. If you do that, theTraMineRplotting functions account for the weights by default.If you follow the help for
seqIplot, you can get to the help page that discusses weights. Here's the key section from the help forseqIplot:So we need to look at the function
seqdef, which creates theseqdataobject for plotting. The help forseqdefdescribes theweightsargument:The help also has an example of how to specify the weights in
seqdef.