NetSurv: NetSurv

Description Usage Arguments Value Author(s) References Examples

View source: R/NetSurv.R

Description

Moving range surveillance control chart and plots for a desired collection of statistics

Usage

1
2
3
4
NetSurv(Statistics, phase1.length, plot = c(FALSE, TRUE),
  directory = getwd(), height = 7, width = 7, xlab = "Time",
  ylab = "Value", xaxis.old = c(1:dim(Statistics)[1]),
  xaxis.new = c(1:dim(Statistics)[1]))

Arguments

Statistics:

a data frame whose rows represent time and columns represent a desired statistic to be monitored

phase1.length:

number of networks to use in phase 1 of monitoring

plot:

a logical specifying whether or not to plot (and save) the control chart for each statistic

directory:

the directory where a .pdf version of the plot is stored (if plot == TRUE). Default is the current directory

height:

height (in inches) of the printed plot

width:

width (in inches) of the printed plot

xlab:

the label on the x axis. Default is "Time"

ylab:

the label on the y axis. Default is "Value"

xaxis.old:

the old labels for the time variable on the x axis. Default is 1:T

xaxis.new:

the new labels that you wish to have on the x axis. Default is 1:T. Note that this must have the same length as xaxis.old

Value

a list containing the objects

Author(s)

James D. Wilson and Nathaniel T. Stevens

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Generate a collection of 50 networks with a change at time 25. The change is a local 
#change in connection propensity in community 1
n <- 100
P.old <- cbind(c(0.10, 0.01), c(0.02, 0.075))
P.new <- cbind(c(0.20, 0.025), c(0.02, 0.075))
P.array <- array(c(replicate(25, P.old), replicate(25, P.new)), dim = c(2, 2, 50))
community.array <- array(rep(c(rep(1, 50), rep(2, 50)), 50), dim = c(1, 100, 50))
delta.array <- array(rep(rep(0.2, 2), 50), dim = c(1, 2, 50))

dynamic.net <- dynamic.DCSBM(n = 100, T = 50, P.array = P.array,
                             community.array = community.array,
                             delta.array = delta.array, edge.list = FALSE)
image(Matrix(dynamic.net$Adjacency.list[[1]]))
image(Matrix(dynamic.net$Adjacency.list[[30]]))

#Estimate the MLEs
MLEs.example <- MLE.DCSBM(dynamic.net$Adjacency.list, community.array = community.array,
                           T = 50, k = 2)
#Store the statistics in a data frame
statistics.df <- data.frame(Phat_11 = MLEs.example$P.hat.array[1, 1, ], 
                            Phat_12 = MLEs.example$P.hat.array[1, 2, ],
                            delta_hat = MLEs.example$delta.hat.global)
control.chart <- NetSurv(statistics.df, phase1.length = 20, plot = TRUE)

jdwilson4/NetSurv documentation built on May 18, 2019, 11:40 p.m.