R/gdm_create_delta_designmatrix.R

Defines functions gdm_create_delta_designmatrix

## File Name: gdm_create_delta_designmatrix.R
## File Version: 0.09

########################################################
# create delta design matrix
gdm_create_delta_designmatrix <- function( delta.designmatrix,
        TP, D, theta.k, skill.levels,G)
{
    if ( is.null(delta.designmatrix) ){
        delta.designmatrix <- rep(1,TP)
        for (dd in 1:D){
            for ( pp in 1:(min( skill.levels[dd]-1,3) ) ){
                delta.designmatrix <- cbind( delta.designmatrix, theta.k[,dd]^pp )
            }
        }
        if (D>1){
            for (dd1 in 1:(D-1) ){
                for (dd2 in (dd1+1):D) {
                    delta.designmatrix <- cbind( delta.designmatrix, theta.k[,dd1]*theta.k[,dd2] )
                }
            }
        }
    }
    delta <- matrix(0,ncol(delta.designmatrix),G)
    covdelta <- NULL
    res <- list( delta=delta, covdelta=covdelta, delta.designmatrix=delta.designmatrix )
    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.