mpmm.predict: Predict probability of events given model parameters.

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/mpmm.predict.R

Description

This function is used to compute the probability of given events under the MPMM with the provided parameters. These parameters could be estimated from fitting the model with mpmm.cgs, for example.

Usage

1
mpmm.predict(dataset, params, dims)

Arguments

dataset

A Tx2 or Tx3 matrix of integers, each row corresponding to an event, each integer identifying the participating vertices.

params

A list with the following variables:

C

number of latent classes

pi

vector of length C, denoting the probability of each latent class

phi

a list with 3 elements (one for each dimension). Each element is a C x N_d matrix denoting the probability of choosing a particular actor i given the event has latent class c (where N_d is the number of possible actors in dimension d).

dims

a vector containing the number of possible actors for each dimension

Value

probs

a vector (with an element foreach row in the provided dataset) containing the probability of that event under the model with the provided parameters.

Author(s)

Christopher DuBois (<email: duboisc@ics.uci.edu>)

References

Christopher DuBois and Padhraic Smyth. Modeling Relational Events via Latent Classes. Proceedings of the 16th ACM SIGKDD, 2010.

See Also

mpmm.cgs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(enron)
dataset <- as.matrix(enron[,2:3])
N <- max(dataset)
dims <- c(N,N)
C <- 5
priors <- list(pi=1,phi=list(1/N,1/N))
fit <- mpmm.cgs(dataset,C,dims,priors,niter=50)

# Compute probability of edge (1,2) occurring under model
newdata <- matrix(c(1,2),1,2)
mpmm.predict(newdata,fit$params,dims)

# Compute loglikelihood of observed data
llk <- sum(log(mpmm.predict(dataset,fit$params,dims)))

mpmm documentation built on May 2, 2019, 4:55 p.m.