Code - Note 1"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(gremes)

Load the data.

data("SeineData", package = "gremes")
head(Seine)

Generate the graph and name the nodes. Note that 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 the subsets. In the first step subsets are used for local estimation of the edge weights, as the second step the estimates are combined through a minimal distance procedeure to produce unique estimates.

subs<- Neighborhood()
subs<- subset(subs, 2, seg, U_bar=c("2", "5"))
subs 

Estimate using method of moment estimator.

mme<- MME(seg)
mme<- estimate(mme, Seine, subs,  k_ratio=0.2)

The messages are informative. They inform you about certain things along the estimation process, but as long as they do not stop the estimation they are not errors.

The estimates are squares of the parameters, hence take the square root.

sqrt(mme$depParams)


Try the gremes package in your browser

Any scripts or data that you put into this service are public.

gremes documentation built on Feb. 16, 2023, 8:06 p.m.