R/gBsuffStats.r

Defines functions gBsuffStats

########## R function: gBsuffStats ##########

# For computing sufficient statistic quantities for the 
# gamselBayes() function:

# Last changed: 08 OCT 2021

gBsuffStats <- function(y,X,Z)
{
   # Compute the sufficient statistic quantities:

   XTy <- as.vector(crossprod(X,y))
   XTX <- crossprod(X)

   if (!is.null(Z))
   {
      ZTy <- as.vector(crossprod(Z,y))
      ZTX <- crossprod(Z,X)
      ZTZ <- crossprod(Z)
   }
   if (is.null(Z))
   {
      ZTy <- NA
      ZTX <- NA
      ZTZ <- NA
   }

   # Return the sufficient statistic quantities:

   return(list(XTy=XTy,XTX=XTX,ZTy=ZTy,ZTX=ZTX,ZTZ=ZTZ))
}

############ End of gBsuffStats ############

Try the gamselBayes package in your browser

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

gamselBayes documentation built on June 8, 2025, 10:21 a.m.