Retrieve the ML fits from the fitVectors column in a table of fits.

RetrieveFittedModelsFromFitVectors(
  fitMappings,
  tableFits = fitMappings$tableFits,
  modelTypes = fitMappings$arguments$modelTypes,
  modelTypesNew = NULL,
  argsMixedGaussian = fitMappings$arguments$argsMixedGaussian,
  X = fitMappings$X,
  tree = fitMappings$tree,
  SE = fitMappings$SE,
  setAttributes = FALSE
)

Arguments

fitMappings

an object of S3 class PCMFitModelMappings.

tableFits

a data.table

modelTypes

a character vector of model types. Default: fitMappings$arguments$modelTypes.

modelTypesNew

NULL or a character vector containing all model-types in fitMappings$arguments$modelTypes and, eventually, additional model-types.

argsMixedGaussian

a list of arguments passed to the MixedGaussian. Default: fitMappings$arguments$argsMixedGaussian.

X

a k x N numerical matrix with possible NA and NaN entries. Each column of X contains the measured trait values for one species (tip in tree). Missing values can be either not-available (NA) or not existing (NaN). Default: fitMappings$X.

tree

a phylo object with N tips. Default: fitMappings$tree.

SE

a k x N matrix specifying the standard error for each measurement in X. Alternatively, a k x k x N cube specifying an upper triangular k x k factor of the variance covariance matrix for the measurement error for each node i=1, ..., N. Default: fitMappings$SE.

setAttributes

logical indicating if an X and tree attribute should be set to each model-object. This is used for later evaluation of the log-likelihood of the score for the model on the given tree and data. Using a global tree for that is a bad idea, because the model may be fit for a subtree, i.e. clade. Default FALSE.

Value

a copy of tableFits with added column "model" and, if necessary, updated integer model-type indices in the "fitVector" column.