multiple imputation and multigroup SEM in R


I want to perform multigroup SEM on imputed data using the R packages mice and semTools, specifically the runMI function that calls Lavaan.

I am able to do so when imputing the entire dataset at once, but whilst trawling through stackoverflow/stackexchange I have come across the recommendation to impute data separately for each level of a grouping variable (e.g. men, women), so that the features of each group are preserved (e.g. https://stats.stackexchange.com/questions/149053/questions-on-multiple-imputation-with-mice-for-a-multigroup-sem-analysis-inclu). However, I've not been able to find any references to support this course.

My question is both conceptual and practical -

1) Is splitting the dataset by group prior to imputing the correct course? Could anyone point me towards references advising this?

2) If so, how can I combine the datasets imputed by group using mice together, whilst still retaining multiple imputed datasets in a list of dataframes of the mids class? I have attempted to do so, but end up with an integer

set.seed(12345) HSMiss <- HolzingerSwineford1939[ , paste("x", 1:9, sep = "")] HSMiss$x5 <- ifelse(HSMiss$x1 <= quantile(HSMiss$x1, .3), NA, HSMiss$x5) HSMiss$x9 <- ifelse(is.na(HSMiss$x5), NA, HSMiss$x9) HSMiss$school <- HolzingerSwineford1939$school HS.model <- ' visual =~ x1 + a*x2 + b*x3 textual =~ x4 + x5 + x6 x7 ~ textual + visual + x9 ' group1 <- subset(HSMiss, school =='Pasteur') group2 <- subset(HSMiss, school =='Grant-White') imputed.group1 <- mice(group1, m = 3, seed = 12345) imputed.group2 <- mice(group2, m = 3, seed = 12345) #attempted merging: imputed.both <- nrow(complete(rbind(imputed.group1, imputed.group2)))

I would be incredibly grateful if anyone can offer me some help. As you can tell, I am very much still learning about R and imputation, so apologies if this is a stupid question - however, I couldn't find anything regarding this specific query elsewhere.


You are getting just an integer when mergin because you are calling nrow(). Remove that call and you'll get a merged data frame.

imputed.both <- complete(rbind(imputed.group1, imputed.group2))

In case you find yourself with datasets that have multiple groups, you can something like the following to simplify this task.

imputed.groups <- lapply(split(HSMiss, HSMiss$school), function(x) { complete(mice(x, m = 3, seed = 12345)) }) imputed.both <- do.call(args = imputed.groups, what = rbind)

About how appropiate is this approach for imputing, that's probably a question better suited for Cross Validated.



  • multiple imputation and multigroup SEM in R
  • Kotlin Channels usage difference between Send and Offer
  • ftp文件传输
  • How to Detect and Redirect from URL with Anchor Using mod_rewrite/htaccess?
  • C: How to get rid of conversion error?
  • WPF: Get MouseEnter Event When IsEnabled=false
  • Only label selected breaks
  • Can Fortran PURE functions use global parameters?
  • iOS 9 UIPasteboard won't work in the background
  • Is it possible to take screenshot in unrooted android phone.? [duplicate]
  • SIlverStripe - No data written onBeforeWrite
  • PHP file() error, invalid argument
  • Can the ResourceLocalService be called remotely via the JSON-WS API?
  • NSTimers causing leaks
  • Best way to send continuous data in Java using Netty
  • How to use InjectTouchInput for specific window?
  • How do decorators in es6 work?
  • GitLab runner on Windows and dealing with & %ERRORLEVEL%
  • Android: Mediaplayer stop / start playing raw resource
  • when plotting a graph using bokeh, how to remove missing date while x_axis type is datetime ,
  • Google Compute instance receiving email
  • How to search for a method or variable name within android project?
  • Smarter Removing Unnecessary WhiteSpace CSV
  • UIScrollView does not restore properly
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • How to use AJAX to upload large CSV file? [closed]
  • Stop an element moving with padding on hover
  • Typeahead.js does give me suggestions but doesn't select them
  • I am consuming a WCF service that requires headers from a .NET 2 website. How can I programmatically
  • Unable to create Access token grant type in wso2 API manager store to test API
  • Make checkout phone field optional for specific countries in WooCommerce
  • calling IO Operations from thread in ruby c extension will cause ruby to hang
  • How to call different template for different category archive page in woocommerce
  • Angular 4: Responsive Grid List
  • Write to .csv file with PHP (Commas in Data Error)