pred_gif {MagmaClustR} | R Documentation |
Magma prediction for ploting GIFs
Description
Generate a Magma or classic GP prediction under a format that is compatible
with a further GIF visualisation of the results. For a Magma prediction,
either the trained_model
or hyperpost
argument is required.
Otherwise, a classic GP prediction is applied and the prior mean can be
specified through the mean
argument.
Usage
pred_gif(
data,
trained_model = NULL,
grid_inputs = NULL,
hyperpost = NULL,
mean = NULL,
hp = NULL,
kern = "SE",
pen_diag = 1e-10
)
Arguments
data |
A tibble or data frame. Required columns: 'Input', 'Output'. Additional columns for covariates can be specified. The 'Input' column should define the variable that is used as reference for the observations (e.g. time for longitudinal data). The 'Output' column specifies the observed values (the response variable). The data frame can also provide as many covariates as desired, with no constraints on the column names. These covariates are additional inputs (explanatory variables) of the models that are also observed at each reference 'Input'. |
trained_model |
A list, containing the information coming from a
Magma model, previously trained using the |
grid_inputs |
The grid of inputs (reference Input and covariates) values
on which the GP should be evaluated. Ideally, this argument should be a
tibble or a data frame, providing the same columns as |
hyperpost |
A list, containing the elements 'mean' and 'cov', the
parameters of the hyper-posterior distribution of the mean process.
Typically, this argument should from a previous learning using
|
mean |
Mean parameter of the GP. This argument can be specified under various formats, such as:
|
hp |
A named vector, tibble or data frame of hyper-parameters
associated with |
kern |
A kernel function, defining the covariance structure of the GP. Several popular kernels (see The Kernel Cookbook) are already implemented and can be selected within the following list:
|
pen_diag |
A number. A jitter term, added on the diagonal to prevent numerical issues when inverting nearly singular matrices. |
Value
A tibble, representing Magma or GP predictions as two column 'Mean'
and 'Var', evaluated on the grid_inputs
. The column 'Input' and
additional covariates columns are associated to each predicted values. An
additional 'Index' column is created for the sake of GIF creation using
the function plot_gif
Examples
TRUE