predictNet {modnets}R Documentation

Calculate prediction error from network models

Description

See the prediction error based on different statistics for either GGMs or SURs. Also can compare and find the change values (such as R-squared change) between two networks of the same size (i.e., with the same nodes).

Usage

predictNet(object, data = NULL, all = FALSE, scale = FALSE)

Arguments

object

Output from fitNetwork or mlGVAR. If using output from mlGVAR, then one of the two networks must be provided (i.e., either fixedNets or betweenNet).

data

The dataset used to fit the network model, or another network of the same type and size to be compared with the network specified in the first argument. If the prediction error for only one network is desired, and the dataset is included as an element of the relevant object, then this can be left as NULL.

all

if TRUE then returns a list containing the observed outcomes used to fit the models, their predicted values, and the prediction error for each outcome.

scale

Logical; determines whether or not to standardize the data before computing prediction error. This argument will be removed.

Value

A table showing different measures of prediction error associated with each node of the network. Or, if two networks are provided, a table that shows the difference in prediction error for each node across the two networks. Specifically, this is computed by taking the statistics for data and subtracting them from those for object.

If all = TRUE, then the following output is returned:

Y

The observed values of the outcome variables based on the data provided.

preds

The predicted values of the outcomes based on the models provided.

errors

Table containing prediction error statistics for each node.

See Also

fitNetwork

Examples

fit1 <- fitNetwork(ggmDat, covariates = 'M')
fit2 <- fitNetwork(ggmDat, moderators = 'M')

predictNet(fit1)
predictNet(fit1, all = TRUE)

predictNet(fit2, fit1) # Find the differences in prediction error across the two models

[Package modnets version 0.9.0 Index]