knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(gremes)
Load the data.
#load("~/gremes/data/SeineData.RData") data("SeineData", package = "gremes") head(Seine)
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) #
Extract the nodes for which we do not observe realizations.
tobj<- Tree(seg, Seine) Uc<- getNoDataNodes(tobj)
Alternatively just do it manually.
Uc<- c("2", "5")
Create the set of coordinates, in this case only vectors with two non-zero entries.
tup<- Tuples() x<- rep(1,5) names(x)<- getNodesWithData(tobj) tup<- evalPoints(tup, tobj, x)
eks<- EKS(seg) eks<-estimate(eks, Seine, tup, k_ratio=0.2)
To apply ECE Version 2 we need to create subsets for local estimation. Create the subsets.
subs<- Neighborhood() subs<- subset(subs, 2, seg, Uc) # neighborhood of level two
Call the estimation method.
eks_part<- EKS_part(seg) eks_part<- suppressMessages(estimate(eks_part, Seine, subs, k_ratio=0.2, xx=x))
Because the method gives many messages we suppress them. The messages are informative. They inform you about certain things but as long as they do not stop the estimation they are not errors.
Compare estimates from the two versions.
eks$depParams eks_part$depParams
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.