seqimpute  R Documentation 
The seqimpute package implements the MICT and MICTtiming methods. These are multiple imputation methods for longitudinal data. The core idea of the algorithms is to fills gaps of missing data, which is the typical form of missing data in a longitudinal setting, recursively from their edges. The prediction is based on either a multinomial or a random forest regression model. Covariates and timedependent covariates can be included in the model.
The MICTtiming algorithm is an extension of the MICT algorithm designed to address a key limitation of the latter: its assumption that position in the trajectory is irrelevant.
seqimpute(
data,
var = NULL,
np = 1,
nf = 1,
m = 5,
timing = FALSE,
frame.radius = 0,
covariates = NULL,
time.covariates = NULL,
regr = "multinom",
npt = 1,
nfi = 1,
ParExec = FALSE,
ncores = NULL,
SetRNGSeed = FALSE,
verbose = TRUE,
available = TRUE,
pastDistrib = FALSE,
futureDistrib = FALSE,
...
)
data 
a data frame containing sequences of a categorical
variable with missing data (coded as 
var 
the list of columns containing the trajectories. Default is NULL, i.e. all the columns. 
np 
number of previous observations in the imputation model of the internal gaps. 
nf 
number of future observations in the imputation model of the internal gaps. 
m 
number of multiple imputations (default: 
timing 
a logical value that specifies if the MICT algorithm (timing=FALSE) or the MICTtiming algorithm (timing=TRUE) should be used. 
frame.radius 
parameter relative to the MICTtiming algorithm specifying the radius of the timeframe. 
covariates 
the list of columns containing the covariates to include in the imputation process 
time.covariates 
the list of columns containing the timevarying covariates to include in the imputation process 
regr 
a character specifying the imputation method. If

npt 
number of previous observations in the imputation model of the terminal gaps. 
nfi 
number of future observations in the imputation model of the initial gaps. 
ParExec 
logical. If 
ncores 
integer. Number of cores to be used for the parallel computation. If no value is set for this parameter, the number of cores will be set to the maximum number of CPU cores minus 1. 
SetRNGSeed 
an integer that is used to set the seed in the case of
parallel computation. Note that setting 
verbose 
logical. If 
available 
a logical value allowing the user to choose whether
to consider the already imputed data in the predictive model
( 
pastDistrib 
a logical indicating if the past distribution should be used as predictor in the imputation model. 
futureDistrib 
a logical indicating if the future distribution should be used as predictor in the imputation model. 
... 
Named arguments that are passed down to the imputation functions. 
The imputation process is divided into several steps, depending on the type of gaps of missing data. The order of imputation of the gaps are:
Internal gap:
there is at least np
observations
before an internal gap and nf
after the gap
Initial gap:
gaps situated at the very beginning of a trajectory
Terminal gap:
gaps situated at the very end of a trajectory
Lefthand side specifically located gap (SLG):
gaps
that have at least nf
observations after the gap, but less than
np
observation before it
Righthand side SLG:
gaps
that have at least np
observations before the gap, but less than
nf
observation after it
Bothhand side SLG:
gaps
that have less than np
observations before the gap, and less than
nf
observations after it
The primary difference between the MICT and MICTtiming algorithms lies in their approach to selecting patterns from other sequences for fitting the multinomial model. While the MICT algorithm considers all similar patterns regardless of their temporal placement, MICTtiming restricts pattern selection to those that are temporally closest to the missing value. This refinement ensures that the imputation process adequately accounts for temporal dynamics, resulting in more accurate imputed values.
Returns an S3 object of class seqimp
.
Kevin Emery <kevin.emery@unige.ch>, Andre Berchtold, Anthony Guinchard, and Kamyar Taher
HALPIN, Brendan (2012). Multiple imputation for lifecourse sequence data. Working Paper WP201201, Department of Sociology, University of Limerick. http://hdl.handle.net/10344/3639.
HALPIN, Brendan (2013). Imputing sequence data: Extensions to initial and terminal gaps, Stata's. Working Paper WP201301, Department of Sociology, University of Limerick. http://hdl.handle.net/10344/3620
# Default multiple imputation of the trajectories of game addiction with the
# MICT algorithm
## Not run:
set.seed(5)
imp1 < seqimpute(data = gameadd, var = 1:4)
# Default multiple imputation with the MICTtiming algorithm
set.seed(3)
imp2 < seqimpute(data = gameadd, var = 1:4, timing = TRUE)
# Inclusion in the MICttiming imputation process of the three background
# characteristics (Gender, Age and Track), and the timevarying covariate
# about gambling
set.seed(4)
imp3 < seqimpute(data = gameadd, var = 1:4, covariates = 5:7,
time.covariates = 8:11)
# Parallel computation
imp4 < seqimpute(data = gameadd, var = 1:4, covariates = 5:7,
time.covariates = 8:11, ParExec = TRUE, ncores=5, SetRNGSeed = 2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.