Skip to content

Commit

Permalink
some connections
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Nov 7, 2024
1 parent 2ba6557 commit ad65d5e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions R/M2.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ M2 <- function(obj, type="M2*", calcNull = TRUE, na.rm=FALSE, quadpts = NULL, th
}
if(length(prodlist) > 0L)
Theta <- prodterms(Theta, prodlist)
if(extract.mirt(obj, 'nfixedeffects') > 0){
warning('M2() not fully tested for itemdesign effects')
if(nrow(extract.mirt(obj, "fixed.design")) == 1)
Theta <- cbind(extract.mirt(obj, "fixed.design")[rep(1, nrow(Theta)), , drop=FALSE], Theta)
}
} else {
Theta <- obj@Model$Theta
prior <- bfactorlist$prior[[group]]; Priorbetween <- bfactorlist$Priorbetween[[group]]
Expand Down
6 changes: 5 additions & 1 deletion R/extract.mirt.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
#' @param x mirt model of class 'SingleGroupClass', 'MultipleGroupClass', 'MixedClass' or
#' 'DiscreteGroupClass'
#' @param what a string indicating what to extract
#' @param item if necessary, which item to extract information from.
#' Defaults to 1 if not specified
#'
#' @author Phil Chalmers \email{rphilip.chalmers@@gmail.com}
#' @references
Expand All @@ -97,7 +99,7 @@
#' extract.mirt(grp1, 'parvec')
#'
#' }
extract.mirt <- function(x, what){
extract.mirt <- function(x, what, item = 1){
if(what == 'DIF_coefficients')
return(attr(x, 'DIF_coefficients'))
ret <- switch(what,
Expand Down Expand Up @@ -162,6 +164,8 @@ extract.mirt <- function(x, what){
formulas = x@Model$formulas,
lrformulas=x@ParObjects$lrPars@formula,
itemdesign = x@Data$itemdesign,
nfixedeffects=x@ParObjects$pars[[item]]@nfixedeffects,
fixed.design=x@ParObjects$pars[[item]]@fixed.design,
itemloc = x@Model$itemloc,
CUSTOM.IND = x@Internals$CUSTOM.IND,
dentype = x@Options$dentype,
Expand Down
5 changes: 4 additions & 1 deletion man/extract.mirt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad65d5e

Please sign in to comment.