Computes predictions and error for all nodes in the graph.
Usage
## S3 method for class 'mgm'
predict(object, data, variables='all', ...)
Arguments
object
The output object of mgmfit, tv.mgmfit, var.mgm or tv_var.mgm.
data
A data matrix with the same properties as the data on which the model was fit. Note that different data can be used here to estimate the out of sample prediction error.
variables
A character vector of variable names or a numeric vector of column numbers for which the the nodewise predictions and nodewise error should be computed. The default variables='all' computes predictions and error for all variables.
...
Other prediction arguments.
Value
In the case of stationarty graphs the function returns a list, in the case of time varying graphs the function returns a list of lists with the following entries:
pred
p x n matrix of predictions, where p are the selected variables and n are the number of observations in the provided dataset.
error
A data frame with the columns: Variable, Error and ErrorType. As error we report the root mean squared error (RMSE) for continuous variables and the proportion of correct classification for categorical variables. For time-varying graphs, both types of errors are weighted by the same weights used during estimation.