R/gdm_est_b_centerintercepts.R

Defines functions gdm_est_b_centerintercepts

## File Name: gdm_est_b_centerintercepts.R
## File Version: 0.02

gdm_est_b_centerintercepts <- function(b, centerintercepts, TD, Qmatrix )
{
    if ( centerintercepts ){
        if (TD==1){
            b <- b - mean(b)
        }
        if (TD > 1){
            for (dd in 1:TD){
                ind.dd <- which( Qmatrix[,dd,1] > 0 )
                m1 <- sum( b[ind.dd,] ) / ( ncol(b) * length(ind.dd) )
                b[ind.dd,] <- b[ind.dd,] -     m1
            }
        }
    }
    return(b)
}

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.