Skip to content

Commit deb29f5

Browse files
committed
fix bug
1 parent cd8fbc1 commit deb29f5

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changes in mirt 1.45
22

3+
- Fixed extraction bug in `randef()` when `lr.random` structures were used
4+
35
- `extract.item()` and `extract.group()` now support objects
46
of class `MixtureClass`
57

R/randef.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
#' head(effects$Theta)
3434
#' head(effects$group)
3535
#'
36+
#' # lr.random input
37+
#' mod2 <- mixedmirt(Science, covdat, model=1, lr.random = ~ 1|group)
38+
#' summary(mod2)
39+
#'
40+
#' effects <- randef(mod2, ndraws = 2000)
41+
#' head(effects$Theta)
42+
#' head(effects$group)
43+
#'
3644
#' }
3745
randef <- function(x, ndraws = 1000, thin = 10, return.draws=FALSE){
3846
if(missing(x)) missingMsg('x')
@@ -89,10 +97,11 @@ randef <- function(x, ndraws = 1000, thin = 10, return.draws=FALSE){
8997
}
9098
}
9199
if(return.draws){
92-
DRAWS <- vector('list', 1 + length(random))
100+
DRAWS <- vector('list', 1 + length(random) + length(lr.random))
93101
retnames <- "Theta"
94-
if(length(random))
95-
retnames <- c('Theta', sapply(random, function(x) colnames(x@gdesign)[1L]))
102+
if(length(random) || length(lr.random))
103+
retnames <- c('Theta', sapply(random, function(x) colnames(x@gdesign)[1L]),
104+
sapply(lr.random, function(x) colnames(x@gdesign)[1L]))
96105
names(DRAWS) <- retnames
97106
}
98107
for(i in seq_len(ndraws)){

man/randef.Rd

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)