Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/poLCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ function(formula,data,nclass=2,maxiter=1000,graphs=FALSE,tol=1e-10,
ret$npar <- (R*sum(K.j-1)) + (R-1) # number of degrees of freedom used by the model (number of estimated parameters)
if (S>1) { ret$npar <- ret$npar + (S*(R-1)) - (R-1) }
ret$aic <- (-2 * ret$llik) + (2 * ret$npar) # Akaike Information Criterion
ret$sabic <- (-2 * ret$llik) + (log((N + 2) / 24) * ret$npar)
ret$bic <- (-2 * ret$llik) + (log(N) * ret$npar) # Schwarz-Bayesian Information Criterion
ret$Nobs <- sum(rowSums(y==0)==0) # number of fully observed cases (if na.rm=F)
if (all(rowSums(y==0)>0)) { # if no rows are fully observed
Expand Down
1 change: 1 addition & 0 deletions R/print.poLCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function(x, ...) {
cat("maximum log-likelihood:", x$llik, "\n \n")
cat("AIC(",R,"): ",x$aic,"\n",sep="")
cat("BIC(",R,"): ",x$bic,"\n",sep="")
cat("SABIC(",R,"): ",x$sabic,"\n",sep="")
if (S==1) cat("G^2(",R,"): ",x$Gsq," (Likelihood ratio/deviance statistic) \n",sep="")
cat("X^2(",R,"): ",x$Chisq," (Chi-square goodness of fit) \n \n",sep="")
if (x$numiter==x$maxiter) cat("ALERT: iterations finished, MAXIMUM LIKELIHOOD NOT FOUND \n \n")
Expand Down
1 change: 1 addition & 0 deletions man/poLCA.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Model specification: Latent class models have more than one manifest variable, s
\item{coeff.V}{covariance matrix of coefficient estimates on covariates (when estimated).}
\item{aic}{Akaike Information Criterion.}
\item{bic}{Bayesian Information Criterion.}
\item{sabic}{Sample-Size adjusted Bayesian Information Criterion.}
\item{Gsq}{Likelihood ratio/deviance statistic.}
\item{Chisq}{Pearson Chi-square goodness of fit statistic for fitted vs. observed multiway tables.}
\item{time}{length of time it took to run the model.}
Expand Down