Rev 4446 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
## Class definitions for the packagesetClass("lmList",representation(call = "call",pool = "logical"),contains = "list")setClass("lmList.confint", contains = "array")## -------------------- lmer-related Classes --------------------------------setOldClass("data.frame")setOldClass("family")setOldClass("logLik")setOldClass("terms")## mixed effects representationsetClass("mer",representation(## original dataflist = "list", # list of grouping factorsZt = "dgCMatrix", # sparse representation of Z'X = "matrix", # Xy = "numeric", # ywts = "numeric", # weights## do we need this for mer?wrkres = "numeric",# working residuals (copy of y for LMMs)## invariants derived from data structurecnames = "list", # column names of model matricesnc = "integer", # dimensions of blocks in OmegaGp = "integer", # Pointers to groups of rows in Zt## quantities that vary when Z, X or y are updatedXtX = "dpoMatrix", # X'XZtZ = "dsCMatrix", # Z'ZZtX = "dgeMatrix", # Z'XZty = "numeric", # Z'yXty = "numeric", # X'y## primary slots that vary during the optimization## When Omega is updated, these are updatedOmega = "list", # list of relative precision matrices## Cholesky factor of inflated [Z:X:y]'[Z:X:y]L = "dCHMsuper", # sparse Cholesky factor of Z'Z + OmegaRZX = "dgeMatrix",RXX = "dtrMatrix",rZy = "numeric",rXy = "numeric",devComp = "numeric", # Components of deviancedeviance = "numeric", # Current deviance (ML and REML)## Secondary slots only evaluated when requested.fixef = "numeric",ranef = "numeric",RZXinv = "dgeMatrix",bVar = "list",gradComp = "list",## status indicatorstatus = "integer"),validity = function(object) .Call(mer_validate, object))## Representation of linear and generalized linear mixed effects modelsetClass("lmer",representation(frame = "data.frame",call = "call", # call to model-fitting functionterms = "terms"), # terms for fixed-effectscontains = "mer")setClass("glmer",representation(family = "family", # glm familyweights = "numeric"),contains = "lmer")## Representation of linear and generalized linear mixed effects modelsetClass("lmer2",representation(## original dataframe = "data.frame", # model frame or empty framecall = "call", # matched call to model-fitting functionterms = "terms", # terms for fixed-effectsflist = "list", # list of grouping factorsZXyt = "dgCMatrix", # sparse form of [Z;X;-y]'weights = "numeric",# can be of length 0 for constant wtsoffset = "numeric", # can be of length 0 for 0 offsetcnames = "list", # column names of model matricesGp = "integer", # pointers to groups of rows in ZXytdims = "integer", # dimensions and indicators## quantities that vary with Z, X, y, weights or offsetA = "dsCMatrix", # tcrossprod(ZXyt) (w. wts and offset)## slots that vary during the optimizationST = "list", # list of TSST' rep of rel. var. matsL = "CHMfactor", # sparse Cholesky factor of A*deviance = "numeric", # ML and REML deviance and components## Secondary slots only evaluated when requested.fixef = "numeric",ranef = "numeric"),validity = function(object) .Call(lmer2_validate, object))setClass("glmer2",representation(family = "family",X = "matrix", # model matrix for fixed effectseta = "numeric", # linear predictormu = "numeric", # inverse link of linear predictormoff = "numeric", # model offset, if anypwts = "numeric", # prior weights, if anyy = "numeric"), # responsecontains = "lmer2")setClass("nlmer",representation(## original dataenv = "environment", # evaluation environment for modelmodel = "call", # model function as a function callframe = "data.frame", # model frame or empty framepnames = "character", # parameter names for nonlinear modelcall = "call", # matched call to model-fitting functionflist = "list", # list of grouping factorsXt = "dgCMatrix", # sparse form of X'Zt = "dgCMatrix", # sparse form of Z'y = "numeric", # responseweights = "numeric",# can be of length 0 for constant wtscnames = "list", # column names of model matricesGp = "integer", # pointers to groups of columns in Zdims = "integer", # dimensions and indicators## slots that vary during the optimizationST = "list", # list of TSST' rep of rel. var. matsVt = "dgCMatrix", # sparse form of V'=(ZTS)'L = "CHMfactor", # sparse Cholesky factor of V'V + Imu = "numeric", # fitted values at current values of beta and bMt = "dgCMatrix", # transpose of gradient matrix d mu/d udeviance = "numeric", # ML and REML deviance and componentsfixef = "numeric", # the fixed effects, betaranef = "numeric", # the random effects, buvec = "numeric" # orthogonal random effects, u, s.t. b=TSu),validity = function(object) .Call(nlmer_validate, object))setClass("summary.mer", # the "mer" result ``enhanced'' :representation(isG = "logical",methTitle = "character",logLik= "logLik",ngrps = "integer",sigma = "numeric", # scale, non-negative numbercoefs = "matrix",vcov = "dpoMatrix",REmat = "matrix",AICtab= "data.frame"),contains = "mer")setClass("summary.lmer2", # the "lmer2" result ``enhanced'' :representation(isG = "logical",methTitle = "character",logLik= "logLik",ngrps = "integer",sigma = "numeric", # scale, non-negative numbercoefs = "matrix",vcov = "dpoMatrix",REmat = "matrix",AICtab= "data.frame"),contains = "lmer2")setClass("summary.lmer", contains = c("summary.mer", "lmer"))setClass("summary.glmer", contains = c("summary.mer", "glmer"))setClass("ranef.lmer", contains = "list")setClass("coef.lmer", contains = "list")setClass("pedigree", representation =list(sire = "integer", dam = "integer", label = "character"),validity = function(object) {n <- length(sire <- object@sire)if (length(dam <- object@dam) != n)return("sire and dam slots must be the same length")if (length(object@label) != n)return("'label' slot must have the same length as 'sire' and 'dam'")if(n == 0) return(TRUE)animal <- 1:nsnmiss <- !is.na(sire)dnmiss <- !is.na(dam)if (any(sire[snmiss] >= animal[snmiss]) ||any(dam[dnmiss] >= animal[dnmiss]))return("the sire and dam must precede the offspring")if (any(sire[snmiss] < 1 | sire[snmiss] > n) |any(dam[dnmiss] < 1 | dam[dnmiss] > n))return(paste("Non-missing sire or dam must be in [1,",n, "]", sep = ''))TRUE})