computeEnsembleWeight: Function to compute the weights of the ensemble models

Description Usage Arguments Value

View source: R/computeEnsembleWeight.R

Description

Function to compute the weights of the ensemble models

Usage

1
2
computeEnsembleWeight(data, cvGroup, fits, method = "inverse",
  imputationParameters)

Arguments

data

A data.table containing the data.

cvGroup

A vector of the same length as nrow(data). Entries of the vector should be integers from 1 to the number of cross-validation groups (typically 10). This should be randomly assigned, and is usually created by ensembleImpute.

fits

The fitted values from the models.

method

Must be either "inverse" or "stacking". If "inverse", the final ensemble is a weighted average of all the individual models, where the weight of each model is proportional to 1/error from that model. If "stacking", then the weight is assigned via a linear regression (where the independent variable in the regression is the variable being imputed, and each individual model is a dependent variable). The linear regression is restricted, however: no weights may be negative and the weights must sum to one.

imputationParameters

A list of the parameters for the imputation algorithms. See defaultImputationParameters() for a starting point.

Value

A list of two objects. The first is a matrix of weights that can be multiplied by the fitted models to give the imputed values. Rows corresponding to non-missing values in data have values of NA.

The second object is a matrix of errors for each model and each byKey. These error values are used for creating an estimate for the variability of each imputed value.


SWS-Methodology/faoswsImputation documentation built on April 7, 2018, 10:12 p.m.