predict.ergmito: Prediction method for 'ergmito' objects

View source: R/predict.R

predict.ergmitoR Documentation

Prediction method for ergmito objects

Description

Takes an ergmito object and makes prediction at tie level. See details for information regarding its implementation.

Usage

## S3 method for class 'ergmito'
predict(object, newdata = NULL, ...)

Arguments

object

An object of class ergmito.

newdata

New set of networks (or network) on which to make the prediction.

...

Passed to new_rergmito, the workhorse of this method.

Details

After fitting a model with a small network (or a set of them), we can use the parameter estimates to calculate the likelihood of observing any given tie in the network, this is, the marginal probabilites at the tie level.

In particular, the function takes the full set of networks on the support of the model and adds them up weighted by the probability of observing them as predicted by the ERGM, formally:

% \hat{A} = \sum_i \mathbf{Pr}(A = a_i)\times a_i

Where \hat{A} is the predicted adjacency matrix, and a_i is the i-th network in the support of the model. This calculation is done for each individual network used in the model.

Value

A list of adjacency matrix of length nnets(object) or, if specified nnets(newdata).

Examples

data(fivenets)

# bernoulli graph
fit <- ergmito(fivenets ~ edges) 

# all ties have the same likelihood
# which is roughly equal to:
# mean(nedges(fivenets)/(nvertex(fivenets)*(nvertex(fivenets) - 1)))
predict(fit) 


# If we take into account vertex attributes, now the story is different!
fit <- ergmito(fivenets ~ edges + nodematch("female")) 

# Not all ties have the same likelihood, since it depends on homophily!
predict(fit) 

muriteams/ergmito documentation built on Sept. 15, 2023, 7:07 a.m.