spaMM allows computation of four variance components of prediction, returned by predict as “...Var” attributes: predVar, fixefVar, residVar, or respVar. The phrase “prediction variance” is used inconsistently in the literature. Often it is used to denote the uncertainty in the response (therefore, including the residual variance), but spaMM follows some literature for mixed models in departing from this usage. Here, this uncertainly is called the response variance (respVar), while prediction variance (predVar) is used to denote the uncertainty in the linear predictor (as in Booth & Hobert, 1998; see also Jeske & Harville, 1988). The respVar is the predVar plus the residual variance residVar.
Which components are returned is controlled in particular by the type and variances arguments of the relevant functions. variances is a list of booleans whose possible elements either match the possible returned components: predVar, fixefVar, residVar, or respVar; or may additionally include linPred, disp, cov, as_tcrossfac_list and possibly other cryptic ones.
The predict default value for all elements is NULL, which jointly translate to no component being computed, equivalently to setting all elements to FALSE. However, setting one component to TRUE may reverse the default effect for other components. In particular, by default, component predVar implies linPred=TRUE, disp=TRUE and component respVar additionally implies residVar=TRUE; in both cases, the linPred=TRUE default by default implies fixefVar=TRUE. Calling for one variance may imply that some of its components are not only computed but also returned as a distinct attribute.
By default the returned components are vectors of variances (with exceptions for some type value). To obtain covariance matrices (when applicable), set cov=TRUE. as_tcrossfac_list=TRUE can be used to return a list of matrices \(X_i\) such that the predVar covariance matrix equals \(\sum_i X_i X'_i\). It thus provides a representation of the predVar that may be useful in particular when the predVar has large dimension, as the component \(X_i\)s may require less memory (being possibly non-square or sparse).
residVar=TRUE evaluates residVar the residual variance. For families without a dispersion parameter (e.g., binomial or poisson), this is as given by the variance function of the family object (in the binomial case, it is thus the variance of a single binary draw). For families with a dispersion parameter (such as \(\phi\) for gaussian or Gamma families, negative-binomial, beta), it is the residual variance as function of the dispersion parameter, whether this parameter is a single scalar or follows a more complex residual-dispersion model. Prior weights are however ignored (see the residVar etractor for the opposite feature). For the beta-binomial family, it is also the variance of a single binary draw; although this family has a residual-dispersion parameter the latter variance is not affected by it.
fixefVar=TRUE evaluates fixefVar, the variance due to uncertainty in fixed effects (X\(\beta\)).
Computations implying linPred=TRUE will take into account the variances of the linear predictor \(\eta\), i.e. the uncertainty in fixed effects (X\(\beta\)) and random effects (ZLv), for given dispersion parameters (see Details).
For fixed-effect models, the fixefVar calculations reduces to the linPred one.
Computations implying disp=TRUE additionally include the effect of uncertainty in estimates of dispersion parameters (\(\lambda\) and \(\phi\)), with some limitations (see Details). variances=list(predVar=TRUE), which evaluates the uncertainty of linear predictor, implies disp=TRUE by default, meaning that it includes such effects of uncertainty in dispersion parameters on the linear predictor. variances=list(respVar=TRUE) performs similarly but additionally includes the residual variance in the returned variance.