I am using Stata Version 15.0 "gsem" command to get a latent class model fromm a sample with 6860 (incomplete) participants. I have 11 manifest dichotomous variables. I repeated the same analysis with R's poLCA and get the same log-likelihoods and class probabilities, but the sample sizes differ and consequently the information criteria (BIC, AIC). I can't figure out why different sample sizes are produced, ca anyone give me a hint how to find out?

In Stata (version 15) I used:
Code:
gsem (a b c d e f g h i j k <- ,logit) ///
, lclass(C 2) nocapslatent  ///
startvalues(randomid, draws(100) seed(15)) emopts(iter(20))
Code:
/*
. di e(ll) -26958.644
. di BIC 54119.589
number of obersvations 6606

In R (version 3.5.1) I used first the option where missing values are retained
Code:
library(poLCA)
f<- cbind(a,b,c,d,e,f,g,h,i,,j,k)
lc2<-poLCA(f, data=datsubset, nclass=2, maxiter=20, tol=1e-5, na.rm=FALSE, nrep=100, verbose=TRUE, calc.se=TRUE)
Code:
/*
. di e(ll) -26958.644
. di BIC 54120.46
number of observations 6860
number of fully observed cases 5872
and the option with complete-cases

Code:
library(poLCA)
f<- cbind(a,b,c,d,e,f,g,h,i,,j,k)
lc2<-poLCA(f, data=datsubset, nclass=2, maxiter=20, tol=1e-5, na.rm=TRUE, nrep=100, verbose=TRUE, calc.se=TRUE)




Code:
.di e(ll) -24396.64  .di BIC 48992.87 .number of fully observations 5872
Actually there are 5872 full observed cases in Stata and R dataset. To me it is unclear what Stata's gsem does with missing values. I only found an information in Statas manual:
gsem’s method ML is sometimes able to use more observations in the presence of missing values than can sem’s method ML. Meanwhile,gsem does not provide the MLMV methodprovided by sem for explicitly handling missing values.
How does Stata's gsem handle missing values?
I checked the overall sample and the missings values in each variable and they don't differ. There must be something in the code or algorithm to exclude a different number of cases. Any suggestions how to figure out what is happening?

Thanks in advance,
Susanne