bsBootMiss: Bollen-Stine Bootstrap with the Existence of Missing Data

bsBootMissR Documentation

Bollen-Stine Bootstrap with the Existence of Missing Data


Implement the Bollen and Stine's (1992) Bootstrap when missing observations exist. The implemented method is proposed by Savalei and Yuan (2009). This can be used in two ways. The first and easiest option is to fit the model to incomplete data in lavaan using the FIML estimator, then pass that lavaan object to bsBootMiss.


bsBootMiss(x, transformation = 2, nBoot = 500, model, rawData, Sigma, Mu,
  group, ChiSquared, EMcov, writeTransData = FALSE, transDataOnly = FALSE,
  writeBootData = FALSE, bootSamplesOnly = FALSE, writeArgs, seed = NULL,
  suppressWarn = TRUE, showProgress = TRUE, ...)



A target lavaan object used in the Bollen-Stine bootstrap


The transformation methods in Savalei and Yuan (2009). There are three methods in the article, but only the first two are currently implemented here. Use transformation = 1 when there are few missing data patterns, each of which has a large size, such as in a planned-missing-data design. Use transformation = 2 when there are more missing data patterns. The currently unavailable transformation = 3 would be used when several missing data patterns have n = 1.


The number of bootstrap samples.


Optional. The target model if x is not provided.


Optional. The target raw data set if x is not provided.


Optional. The model-implied covariance matrix if x is not provided.


Optional. The model-implied mean vector if x is not provided.


Optional character string specifying the name of the grouping variable in rawData if x is not provided.


Optional. The model's χ^2 test statistic if x is not provided.


Optional, if x is not provided. The EM (or Two-Stage ML) estimated covariance matrix used to speed up Transformation 2 algorithm.


Logical. If TRUE, the transformed data set is written to a text file, transDataOnly is set to TRUE, and the transformed data is returned invisibly.


Logical. If TRUE, the result will provide the transformed data only.


Logical. If TRUE, the stacked bootstrap data sets are written to a text file, bootSamplesOnly is set to TRUE, and the list of bootstrap data sets are returned invisibly.


Logical. If TRUE, the result will provide bootstrap data sets only.


Optional list. If writeBootData = TRUE or writeBootData = TRUE, user can pass arguments to the write.table function as a list. Some default values are provided: file = "bootstrappedSamples.dat", row.names = FALSE, and na = "-999", but the user can override all of these by providing other values for those arguments in the writeArgs list.


The seed number used in randomly drawing bootstrap samples.


Logical. If TRUE, warnings from lavaan function will be suppressed when fitting the model to each bootstrap sample.


Logical. Indicating whether to display a progress bar while fitting models to bootstrap samples.


The additional arguments in the lavaan function. See also lavOptions


The second is designed for users of other software packages (e.g., LISREL, EQS, Amos, or Mplus). Users can import their data, χ^2 value, and model-implied moments from another package, and they have the option of saving (or writing to a file) either the transformed data or bootstrapped samples of that data, which can be analyzed in other programs. In order to analyze the bootstrapped samples and return a p value, users of other programs must still specify their model using lavaan syntax.


As a default, this function returns a BootMiss object containing the results of the bootstrap samples. Use show, summary, or hist to examine the results. Optionally, the transformed data set is returned if transDataOnly = TRUE. Optionally, the bootstrap data sets are returned if bootSamplesOnly = TRUE.


Terrence D. Jorgensen (University of Amsterdam;

Syntax for transformations borrowed from


Bollen, K. A., & Stine, R. A. (1992). Bootstrapping goodness-of-fit measures in structural equation models. Sociological Methods & Research, 21(2), 205–229. doi: 10.1177/0049124192021002004

Savalei, V., & Yuan, K.-H. (2009). On the model-based bootstrap with missing data: Obtaining a p-value for a test of exact fit. Multivariate Behavioral Research, 44(6), 741–763. doi: 10.1080/00273170903333590

See Also



## Not run: 
dat1 <- HolzingerSwineford1939
dat1$x5 <- ifelse(dat1$x1 <= quantile(dat1$x1, .3), NA, dat1$x5)
dat1$x9 <- ifelse($x5), NA, dat1$x9)

targetModel <- "
visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9
targetFit <- sem(targetModel, dat1, meanstructure = TRUE, = TRUE,
                 missing = "fiml", group = "school")
summary(targetFit, fit = TRUE, standardized = TRUE)

# The number of bootstrap samples should be much higher.
temp <- bsBootMiss(targetFit, transformation = 1, nBoot = 10, seed = 31415)

hist(temp, printLegend = FALSE) # suppress the legend
## user can specify alpha level (default: alpha = 0.05), and the number of
## digits to display (default: nd = 2).  Pass other arguments to hist(...),
## or a list of arguments to legend() via "legendArgs"
hist(temp, alpha = .01, nd = 3, xlab = "something else", breaks = 25,
     legendArgs = list("bottomleft", box.lty = 2))

## End(Not run)

semTools documentation built on May 10, 2022, 9:05 a.m.