Skip to content

Commit

Permalink
improve determination of number of ordinal categories, per #84
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed Aug 11, 2024
1 parent aa122e7 commit 5958cfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: blavaan
Title: Bayesian Latent Variable Analysis
Version: 0.5-5.1293
Version: 0.5-5.1294
Authors@R: c(person(given = "Edgar", family = "Merkle",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
10 changes: 1 addition & 9 deletions R/lav_export_stanmarg.R
Original file line number Diff line number Diff line change
Expand Up @@ -1386,14 +1386,7 @@ lav2standata <- function(lavobject, dosam = FALSE) {
dat$YX <- dat$YX[, -ordidx, drop=FALSE]


nlevs <- rep(NA, length(ordidx))
neach <- vector("list", length(ordidx))
for(i in 1:length(ordidx)){
ordvar <- unlist(lapply(lavobject@Data@X, function(x) x[,ordidx[i]]))
ordvar <- ordvar[!is.na(ordvar)]
nlevs[i] <- max(ordvar) #length(unique(ordvar))
}

nlevs <- 1 + as.numeric( table(pta$th.idx[[1]]) )
maxcat <- max(nlevs)

dat$Nord <- length(ordidx)
Expand All @@ -1414,7 +1407,6 @@ lav2standata <- function(lavobject, dosam = FALSE) {
dat$contidx <- array(1:ptot, ptot)
}
dat$nlevs <- array(0, 0)
dat$neach <- matrix(0, 0, 0)
}

return(dat)
Expand Down

0 comments on commit 5958cfb

Please sign in to comment.