Closed seonghobae closed 3 years ago
https://github.com/philchalmers/mirt/blob/b7150f0b7ae09cf284dcbfc2f2e37b45d799380e/R/MHRM.utils.R#L79 I guess this line has an error to do this.
Thanks, this was related to a recent change that avoided computing the Hessian when it was not used. Should be patched now.
I guess need to fix again for vertical scaling.
library('mirt')
set.seed(12345)
a <- matrix(abs(rnorm(15,1,.3)), ncol=1)
d <- matrix(rnorm(15,0,.7),ncol=1)
itemtype <- rep('2PL', nrow(a))
N <- 1000
dataset1 <- simdata(a, d, N, itemtype)
dataset2 <- simdata(a, d, N, itemtype, mu = .1, sigma = matrix(1.5))
dat <- rbind(dataset1, dataset2)
group <- c(rep('D1', N), rep('D2', N))
# vertical scaling (i.e., equating when groups answer items others do not)
dat2 <- dat
dat2[group == 'D1', 1:2] <- dat2[group != 'D1', 14:15] <- NA
head(dat2)
tail(dat2)
# items with missing responses need to be constrained across groups for identification
nms <- colnames(dat2)
mod_anchor <- multipleGroup(dat2, 1, group,
invariance = c(nms[c(1:5, 14:15)], 'free_means', 'free_var'), method = 'MHRM', optimizer = 'BFGS')
Error in L %*% h :
Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 88
13.
L %*% h
12.
L %*% h
11.
updateHess(-h, L)
10.
MHRM.deriv(pars = pars, gtheta = gtheta, lrPars = lrPars, OffTerm = OffTerm,
longpars = longpars, USE.FIXED = USE.FIXED, list = list,
ngroups = ngroups, LR.RAND = LR.RAND, DERIV = DERIV, gstructgrouppars = gstructgrouppars,
nfact = nfact, CUSTOM.IND = CUSTOM.IND, RAND = RAND, cycles = cycles, ...
9.
gr(par, ...)
8.
(function (par)
gr(par, ...))(c(a1 = 0.858029762402287, d = -0.705355822796004,
a1 = 0.92646214777839, d = -0.0918796487849519, a1 = 1.10939589619799,
d = -0.220129304877892, a1 = 0.943033886461536, d = 0.100905450181409, ...
7.
optim(shortpars, MHRM.LL_reload, gr = MHRM.deriv_reload, pars = pars,
gtheta = gtheta, lrPars = lrPars, OffTerm = OffTerm, longpars = longpars,
USE.FIXED = USE.FIXED, list = list, ngroups = ngroups, LR.RAND = LR.RAND,
DERIV = DERIV, has_graded = has_graded, nfact = nfact, CUSTOM.IND = CUSTOM.IND, ...
6.
MHRM.Mstep(pars = pars, gtheta = gthetatmp, lrPars = lrPars,
OffTerm = OffTerm, longpars = longpars, USE.FIXED = USE.FIXED,
list = list, ngroups = ngroups, LR.RAND = LR.RAND, DERIV = DERIV,
gstructgrouppars = gstructgrouppars, nfact = nfact, CUSTOM.IND = CUSTOM.IND, ...
5.
MHRM.group(pars = pars, constrain = constrain, Ls = Ls, PrepList = PrepList,
Data = Data, list = list(NCYCLES = opts$NCYCLES, BURNIN = opts$BURNIN,
SEMCYCLES = opts$SEMCYCLES, gain = opts$gain, KDRAWS = opts$KDRAWS,
MHDRAWS = opts$MHDRAWS, TOL = opts$TOL, SE = FALSE, SE.type = "none", ...
4.
ESTIMATION(data = data, model = model, group = group, invariance = invariance,
method = method, itemtype = itemtype, dentype = dentype,
...)
Same problem as before but with equality constraints. Should be patched now. Thanks!
Hello, Can you check these errors?
Best, Seongho