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 |
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 |
all |
if |
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
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