predictLatentFactor: predictLatentFactor

View source: R/predictLatentFactor.R

predictLatentFactorR Documentation

predictLatentFactor

Description

Draws samples from the conditional predictive distribution of latent factors

Usage

predictLatentFactor(
  unitsPred,
  units,
  postEta,
  postAlpha,
  rL,
  predictMean = FALSE,
  predictMeanField = FALSE
)

Arguments

unitsPred

a factor vector with random level units for which predictions are to be made

units

a factor vector with random level units that are conditioned on

postEta

a list containing samples of random factors at conditioned units

postAlpha

a list containing samples of range (lengthscale) parameters for latent factors

rL

a HmscRandomLevel-class object that describes the random level structure

predictMean

a boolean flag indicating whether to return the mean of the predictive Gaussian process distribution

predictMeanField

a boolean flag indicating whether to return the samples from the mean-field distribution of the predictive Gaussian process distribution

Details

Length of units vector and number of rows in postEta matrix shall be equal. The method assumes that the i-th row of postEta correspond to i-th element of units.

This method uses only the coordinates rL$s field of the rL$s argument. This field shall be a matrix with rownames covering the union of unitsPred and units factors. Alternatively, it can use distance matrix rL$distMat which is a symmetric square matrix with similar row names as the coordinate data (except for the GPP models that only can use coordinates).

In case of spatial random level, the computational complexity of the generic method scales cubically as the number of unobserved units to be predicted. Both predictMean=TRUE and predictMeanField=TRUE options decrease the asymptotic complexity to linear. The predictMeanField=TRUE option also preserves the uncertainty in marginal distribution of predicted latent factors, but neglects the inter-dependece between them.

Value

a list of length length(postEta) containing samples of random factors at unitsPred from their predictive distribution conditional on the values at units


Hmsc documentation built on Aug. 11, 2022, 5:11 p.m.