Skip to content

Commit

Permalink
change how we compute the number of levels of each ordinal variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed Aug 4, 2024
1 parent eb9c76c commit dad2e8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 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.1291
Version: 0.5-5.1292
Authors@R: c(person(given = "Edgar", family = "Merkle",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion R/lav_export_stanmarg.R
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ lav2standata <- function(lavobject, dosam = FALSE) {
for(i in 1:length(ordidx)){
ordvar <- unlist(lapply(lavobject@Data@X, function(x) x[,ordidx[i]]))
ordvar <- ordvar[!is.na(ordvar)]
nlevs[i] <- length(unique(ordvar))
nlevs[i] <- max(ordvar) #length(unique(ordvar))
}

maxcat <- max(nlevs)
Expand Down

1 comment on commit dad2e8d

@jpritikin
Copy link

@jpritikin jpritikin commented on dad2e8d Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this code depend on the data having a least one response at the maximum end of the Likert scale? Instead of looking at the observed data, can you assume that you can call nlevels on the data?
Or maybe it's fine the way it is.

Please sign in to comment.