BreakPointLoss: Compute the Average Loss of Hidden State Changes from...

View source: R/BreakPointLoss.R

BreakPointLossR Documentation

Compute the Average Loss of Hidden State Changes from Expected Break Points

Description

Compute the Average Loss of Hidden State Changes from Expected Break Points

Usage

BreakPointLoss(model.list, waic = FALSE, display = TRUE)

Arguments

model.list

MCMC output objects. These have to be of class mcmc and have a logmarglike attribute. In what follows, we let M denote the total number of models to be compared.

waic

If waic is TRUE, waic(Watanabe information criterion) will be reported.

display

If display is TRUE, a plot of ave.loss will be produced.

BreakPointLoss. ave.loss, logmarglike, State, Tau, Tau.samp

Value

BreakPointLoss returns five objects. They are: ave.loss the expected loss for each model computed by the mean sqaured distance of hidden state changes from the expected break points. logmarglike the natural log of the marginal likelihood for each model; State sampled state vectors; Tau expected break points for each model; and Tau.samp sampled break points from hidden state draws.

References

Jong Hee Park and Yunkyun Sohn. 2020. "Detecting Structural Change in Longitudinal Network Data." Bayesian Analysis. Vol.15, No.1, pp.133-157.

Examples

   ## Not run: 
   set.seed(1973)
   ## Generate an array (30 by 30 by 40) with block transitions
   from 2 blocks to 3 blocks
   Y <- MakeBlockNetworkChange(n=10, T=40, type ="split")
   G <- 100 ## Small mcmc scans to save time

   ## Fit multiple models for break number detection using Bayesian model comparison
   out0 <- NetworkStatic(Y, R=2, mcmc=G, burnin=G, verbose=G, Waic=TRUE)
   out1 <- NetworkChange(Y, R=2, m=1, mcmc=G, burnin=G, verbose=G, Waic=TRUE)
   out2 <- NetworkChange(Y, R=2, m=2, mcmc=G, burnin=G, verbose=G, Waic=TRUE)
   out3 <- NetworkChange(Y, R=2, m=3, mcmc=G, burnin=G, verbose=G, Waic=TRUE)

   ## The most probable model given break number 0 to 3 and data is out1 according to WAIC 
   out <- BreakPointLoss(out0, out1, out2, out3, waic=TRUE)

   print(out[["ave.loss"]])

## End(Not run)



NetworkChange documentation built on March 18, 2022, 7:52 p.m.