Code - Note 4

Cliquewise likelihood estimation for models on trees

Stefka Asenova

2021-12-20

# devtools::load_all("~/gremes", export_all=FALSE)
library(gremes)

Load the data.

#load("~/gremes/data/SeineData.RData")
data("SeineData", package = "gremes")

head(Seine)
#>       Paris      Meaux      Melun   Nemours     Sens
#> 1  2.124338  -1.736640  9.0907845 0.5187825 14.26062
#> 2  9.646991   2.632994  8.7440743 0.6394548 15.47040
#> 3 19.172176  21.584171  9.1692941 2.1770178 15.26537
#> 4  5.357301 -14.759895 -0.4941262 1.5233623 13.47500
#> 5  6.044298 -20.772417  1.0182723 2.1690976 13.39804
#> 6  3.805912 -40.779572 -7.3982814 1.2666607 14.60144

Generate the graph and name the nodes. Assigning names to nodes is crucial. The names of the nodes should correspond to the names of the columns in the dataset.

seg<- graph(c(1,2,
              2,3,
              2,4,
              4,5,
              5,6,
              5,7), directed = FALSE)
name_stat<- c("Paris", "2", "Meaux", "Melun", "5", "Nemours", "Sens")
seg<- set.vertex.attribute(seg, "name", V(seg), name_stat)

Create a list of subsets on the node set. These sets should cover all the vertex set, but every two subsets are allowed to have at most one node in common.

subs<- list(c("Paris", "2", "Meaux", "Melun"), c("Melun", "5", "Nemours", "Sens"))

In addition to this we require that within the induced subgraph of a given subset all edge parameters are identifiable. This is key in this estimator. We can check this requirement with the function is_identifiable. To use this function we need however to create an object of class RootDepSet and an object of class Tree. If it is clear that the criterion is satisfied there is no need from this step and the two additional objects created below.

rdsobj<- RootDepSet()
rdsobj<- setRootDepSet(rdsobj, subs, c("Paris", "Melun"))
#> From setRootDepSet.RootDepSet: The order of the subset must correspond to the
#>             order of its corresponding root
tobj<- Tree(seg, Seine)
#> From validate.Network: Edges have been assigned names
#> From validate.Network: There are nodes with latent variables
#> From validate.Network: Edges have been assigned names
#> From validate.Network: There are nodes with latent variables
is_identifiable(rdsobj, tobj)

Since we get no messages from the function is_identifiable the identifiability criterion is satisfied.

Estimate using the cliquewise likelihood method of Engelke and Hitz (2020).

ehobj<- EngHitz(seg)
#> From HRMnetwork: Edges have been assigned names
ehobj<- suppressMessages(estimate(ehobj, Seine, subs, k_ratio=0.2))
ehobj$depParams
#>        e1        e2        e3        e4        e5        e6 
#> 0.3653028 1.0398823 0.5751127 0.6949520 1.0905722 0.6667259

Messages are suppressed.

References

Engelke, Sebastian, and Adrien S. Hitz. 2020. “Graphical Models for Extremes.” J. R. Statist. Soc. B 82 (3): 1–38.