R/gdm_Qmatrix.R

Defines functions gdm_Qmatrix

## File Name: gdm_Qmatrix.R
## File Version: 0.05


#################################################
# define Q matrix
gdm_Qmatrix <- function(Qmatrix,irtmodel,I,TD,K,a)
{
    # Q matrix [1:I, 1:TD, 1:K]
    if ( is.null(Qmatrix) ){
        Qmatrix <- array( 1, dim=c(I,TD,K) )
            # modify it possibly
        if (K>1 & ( irtmodel !="2PLcat" ) ){
            for (kk in 2:K){Qmatrix[,,kk] <- kk*Qmatrix[,,1] }
        }
        if ( irtmodel=="2PLcat"){
            for (kk in 2:K ){
                a[,,kk] <- kk * a[,,kk]
                }
            }
        }
    res <- list(Qmatrix=Qmatrix, a=a)
    return(res)
}

Try the CDM package in your browser

Any scripts or data that you put into this service are public.

CDM documentation built on Aug. 25, 2022, 5:08 p.m.