View source: R/predict.mmsbm.R
predict.mmsbm | R Documentation |
The function produces expected posterior edges based on estimated parameters and (optionally new) predictor data
## S3 method for class 'mmsbm' predict( object, new.data.dyad = NULL, new.data.monad = NULL, forecast = FALSE, type = c("link", "response", "mm"), ... )
object |
Object of class |
new.data.dyad |
An optional |
new.data.monad |
An optional |
forecast |
Boolean. Should prediction forcast one step into the future? Defaults to FALSE. |
type |
Character string. The default is to use the linear predictor of edges. The alternative "response" returns predicted probabilities. The alternative "mm" returns predicted mixed-membership vectors. |
... |
Currently ignored |
If new.data.dyad = NULL
, vector of length nrow(object$dyadic.data)
. Else, vector of length nrow(new.data.dyad)
.
Santiago Olivella (olivella@unc.edu), Adeline Lo (aylo@wisc.edu), Tyler Pratt (tyler.pratt@yale.edu), Kosuke Imai (imai@harvard.edu)
library(NetMix) ## Load datasets data("lazega_dyadic") data("lazega_monadic") ## Estimate model with 2 groups lazega_mmsbm <- mmsbm(SocializeWith ~ Coworkers, ~ School + Practice + Status, senderID = "Lawyer1", receiverID = "Lawyer2", nodeID = "Lawyer", data.dyad = lazega_dyadic, data.monad = lazega_monadic, n.blocks = 2, mmsbm.control = list(seed = 123, conv_tol = 1e-2, hessian = FALSE)) ## Get in-sample predicted edge probabilities lazega_preds <- predict(lazega_mmsbm, type = "response")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.