R/gdina_designmatrices_create_Aj.R

Defines functions gdina_designmatrices_create_Aj

## File Name: gdina_designmatrices_create_Aj.R
## File Version: 0.12



#**** design matrices for GDINA model
gdina_designmatrices_create_Aj <- function(nq)
{
    Aj <- NULL
    if (nq==1){ Aj <- matrix( c(0,1), ncol=1 ) }
    if (nq==2){
        Aj <- matrix( c( 0, 0,
                        1, 0,
                        0, 1,
                        1, 1 ), byrow=TRUE, ncol=2 )
                    }
    if (nq==3){
        Aj <- matrix( c( 0, 0, 0,
                        1, 0, 0,    0, 1, 0,     0, 0, 1,
                        1, 1, 0,    1, 0, 1,   0, 1, 1,
                        1, 1, 1 ), byrow=TRUE, ncol=3 )
                    }
    if (nq==4){
        Aj <- matrix( c( 0, 0, 0, 0,
                        1,0,0,0,   0,1,0,0, 0,0,1,0, 0,0,0,1,
                        1,1,0,0,  1,0,1,0,   1,0,0,1,  0,1,1,0, 0,1,0,1, 0,0,1,1,
                        1,1,1,0, 1,0,1,1,   1,1,0,1,   0,1,1,1,
                        1, 1, 1,1), byrow=TRUE, ncol=4 )
                    }
    if (nq==5){
        Aj <- matrix( c( 0,0,0,0,0,
                1,0,0,0,0,
                0,1,0,0,0,
                0,0,1,0,0,
                0,0,0,1,0,
                0,0,0,0,1,
                1,1,0,0,0,
                1,0,1,0,0,
                1,0,0,1,0,
                1,0,0,0,1,
                0,1,1,0,0,
                0,1,0,1,0,
                0,1,0,0,1,
                0,0,1,1,0,
                0,0,1,0,1,
                0,0,0,1,1,
                1,1,1,0,0,
                1,1,0,1,0,
                1,1,0,0,1,
                1,0,1,1,0,
                1,0,1,0,1,
                1,0,0,1,1,
                0,1,1,1,0,
                0,1,1,0,1,
                0,1,0,1,1,
                0,0,1,1,1,
                1,1,1,1,0,
                1,1,1,0,1,
                1,1,0,1,1,
                1,0,1,1,1,
                0,1,1,1,1,
                1,1,1,1,1 ), byrow=TRUE, ncol=5 )
                    }
    if ( nq > 5){
        Aj <- gdina_designmatrices_create_Aj_general(nq)
    }
    return(Aj)
}


.create.Aj <- gdina_designmatrices_create_Aj

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.