examine {goldfish} | R Documentation |
Diagnostic functions
Description
Provide diagnostic functions for an object of class result.goldfish
.
outliers
helps to identify outliers events.
changepoints
helps to identify where a change point
in the events sequence is presented using the log-likelihood.
Usage
examineOutliers(
x,
method = c("Hampel", "IQR", "Top"),
parameter = 3,
window = NULL
)
examineChangepoints(
x,
moment = c("mean", "variance"),
method = c("PELT", "AMOC", "BinSeg"),
window = NULL,
...
)
Arguments
x |
an object of class |
method |
Choice of |
parameter |
An integer that represents the number of absolute outliers
to identify, the threshold for the Hampel filter, i.e. |
window |
The window half-width for the Hampel filter. By default it is half the width of the event sequence. |
moment |
character argument to choose between "mean" or "variance". See section Change point for details. |
... |
additional arguments to be passed to the functions in the
|
Value
NULL
if neither outliers nor change points are identified.
An object of class ggplot
object from a call of ggplot2::ggplot()
.
It can be modified using the ggplot2
syntax.
Outliers
examineOutliers
creates a plot with the log-likelihood of the events
in the y-axis and the event index in the x-axis, identifying observations
with labels indicating the sender and recipient.
Change point
The parameter moment
controls which method from the package
changepoint
is used:
"mean"
It uses the
cpt.mean
function to investigate optimal positioning and (potentially) number of change points for the log-likelihood of the events in mean."variance"
It uses the
cpt.var
function to investigate optimal positioning and (potentially) number of change points for the log-likelihood of the events in variance
The function call creates a plot with the log-likelihood of the events in the y-axis and the event index in the x-axis, highlighting the change point sections identified by the method.
Examples
# A multinomial receiver choice model
data("Social_Evolution")
callNetwork <- defineNetwork(nodes = actors, directed = TRUE)
callNetwork <- linkEvents(
x = callNetwork, changeEvent = calls,
nodes = actors
)
callsDependent <- defineDependentEvents(
events = calls, nodes = actors,
defaultNetwork = callNetwork
)
mod01 <- estimate(callsDependent ~ inertia + recip + trans,
model = "DyNAM", subModel = "choice",
estimationInit = list(
returnIntervalLogL = TRUE,
engine = "default_c"
)
)
examineOutliers(mod01)
examineChangepoints(mod01)