Skip to content

Commit

Permalink
validation check
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Jan 28, 2025
1 parent bf1e50c commit 1b2ac32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions R/SingleGroup-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -1884,8 +1884,7 @@ mirt2traditional <- function(x, vcov, nfact){
x@par <- par
names(x@est) <- names(par)
x@parnames <- names(x@par)
if(length(vcov) == 0L || (is.na(vcov[1L,1L]) || !(cls %in%
c('dich', 'graded', 'gpcm', 'nominal', 'nestlogit', 'Luo2001')))){
if(!valid_vcov(vcov) || !(cls %in% c('dich', 'graded', 'gpcm', 'nominal', 'nestlogit', 'Luo2001'))){
x@SEpar <- numeric()
} else {
vpick <- subset_vcov(xorg, vcov)
Expand Down
8 changes: 7 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ SE.Lambdas <- function(pars, acov, nfact){
out[1, index]
}

if(length(acov) == 1 && is.na(acov)) return(NULL)
if(!valid_vcov(acov)) return(NULL)
nitems <- length(pars) - 1
SE.F <- matrix(NA, nitems, nfact)
for(i in 1:nitems){
Expand Down Expand Up @@ -2919,6 +2919,12 @@ is.latent_regression <- function(mod){
!is.null(mod@Data$covdata)
}

valid_vcov <- function(obj){
ret <- if(length(obj) == 0 || (length(obj) == 1 && is.na(obj[1]))) FALSE
else TRUE
ret
}

# subset of vcov for delta method
subset_vcov <- function(obj, vcov){
nms <- colnames(vcov)
Expand Down

0 comments on commit 1b2ac32

Please sign in to comment.