R/buildOffsetModel.R

Defines functions buildOffsetModel

Documented in buildOffsetModel

#' Build a marginal offset matrix given a model
#' @param modelObj a modelDI object
#' @param View The view for which to build the offset
#' @param distributions,compositional belong to the view
#'
#' @return The offset matrix
buildOffsetModel = function(modelObj, View, distributions, compositional){
with(modelObj, {
    if(distributions[[View]]=="quasi"){
        expColMat = exp(indepModels[[View]]$colMat)
        return(indepModels[[View]]$libSizes *
            if(compositional[[View]]) expColMat/rowSums(expColMat) else expColMat)
    } else if(distributions[[View]]=="gaussian"){
        return(indepModels[[View]]$colMat + indepModels[[View]]$libSizes)
    }
})
}

Try the combi package in your browser

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

combi documentation built on Nov. 8, 2020, 5:34 p.m.