View source: R/missings_generation.R
seqaddNA | R Documentation |
Generation of missing data under the form of gaps, which is the typical form of missing data with longitudinal data. It simulates MCAR or MAR missing data.
seqaddNA(
data,
var = NULL,
states.high = NULL,
propdata = 1,
pstart.high = 0.1,
pstart.low = 0.005,
maxgap = 3,
only.traj = FALSE
)
data |
a data frame containing sequences of a multinomial
variable with missing data (coded as |
var |
the list of columns containing the trajectories.
Default is |
states.high |
list of states that have a larger probability of triggering a subsequent missing data gap |
propdata |
proportion observations for which missing data is simulated |
pstart.high |
probability to start a missing data for the
states specified with the |
pstart.low |
probability to start a missing data for the other states |
maxgap |
maximum length of a missing data gap |
only.traj |
logical that specifies whether only the trajectories should
be returned ( |
Returns a data frame on which missing data were simulated
Kevin Emery
# Generate MCAR missing data on the mvad dataset
# from the TraMineR package
## Not run:
data(mvad, package = "TraMineR")
mvad.miss <- seqaddNA(mvad, var = 17:86)
# Generate missing data on mvad where joblessness is more likely to trigger
# a missing data gap
mvad.miss2 <- seqaddNA(mvad, var = 17:86, states.high = "joblessness")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.