Title: | Optimization Frameworks for Tie-Oriented and Actor-Oriented Relational Event Models |
---|---|
Description: | A comprehensive set of tools designed for optimizing likelihood within a tie-oriented (Butts, C., 2008, <doi:10.1111/j.1467-9531.2008.00203.x>) or an actor-oriented modelling framework (Stadtfeld, C., & Block, P., 2017, <doi:10.15195/v4.a14>) in relational event networks. The package accommodates both frequentist and Bayesian approaches. The frequentist approaches that the package incorporates are the Maximum Likelihood Optimization (MLE) and the Gradient-based Optimization (GDADAMAX). The Bayesian methodologies included in the package are the Bayesian Sampling Importance Resampling (BSIR) and the Hamiltonian Monte Carlo (HMC). The flexibility of choosing between frequentist and Bayesian optimization approaches allows researchers to select the estimation approach which aligns the most with their analytical preferences. |
Authors: | Giuseppe Arena [aut, cre] , Rumana Lakdawala [aut], Fabio Generoso Vieira [aut], Marlyne Meijerink-Bosman [ctb], Diana Karimova [ctb], Mahdi Shafiee Kamalabad [ctb], Roger Leenders [ctb], Joris Mulder [ctb] |
Maintainer: | Giuseppe Arena <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.3.11 |
Built: | 2024-11-12 03:56:20 UTC |
Source: | https://github.com/tilburgnetworkgroup/remstimate |
A function that returns the AIC (Akaike's Information Criterion) value in a 'remstimate' object.
aic(object, ...) ## S3 method for class 'remstimate' aic(object, ...)
aic(object, ...) ## S3 method for class 'remstimate' aic(object, ...)
object |
is a |
... |
further arguments to be passed to the 'aic' method. |
AIC value of a 'remstimate' object.
aic(remstimate)
: AIC (Akaike's Information Criterion) value of a 'remstimate' object
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AIC aic(tie_mle) #
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AIC aic(tie_mle) #
A function that returns the AICC (Akaike's Information Corrected Criterion) value in a 'remstimate' object.
aicc(object, ...) ## S3 method for class 'remstimate' aicc(object, ...)
aicc(object, ...) ## S3 method for class 'remstimate' aicc(object, ...)
object |
is a |
... |
further arguments to be passed to the 'aicc' method. |
AICC value of a 'remstimate' object.
aicc(remstimate)
: AICC (Akaike's Information Corrected Criterion) value of a 'remstimate' object
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AICC aicc(tie_mle)
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # AICC aicc(tie_mle)
A randomly generated sequence of relational events with 5 actors and 100 events. The event sequence is generated by following an actor-oriented modeling approach (for more information on the algorithm used for the generation, refer to help(topic = remulateActor, package = "remulate")
or ?remulate::remulateActor
).
data(ao_data)
data(ao_data)
ao_data
is a list object containing the following objects:
edgelist
a data.frame
with the raw simulated edgelist. The columns of the data.frame
are:
time
the timestamp indicating the time at which each event occurred
actor1
the actor that generated the relational event
actor2
the actor that received the relational event
seed
the seed value used in remulate::remulateActor()
for generating the event sequence
true.pars
a list of two vectors named "rate_model"
and "choice_model"
, each containing the values of the parameters used in the generation of the event sequence
# (1) load the data into the workspace data(ao_data) # (2) process event sequence with \code{remify} ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor for the rate model rate_model <- ~ 1 + remstats::indegreeSender() ## linear predictror for the choice model choice_model <- ~ remstats::inertia() + remstats::reciprocity() ## calculate statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_ao <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_ao)
# (1) load the data into the workspace data(ao_data) # (2) process event sequence with \code{remify} ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor for the rate model rate_model <- ~ 1 + remstats::indegreeSender() ## linear predictror for the choice model choice_model <- ~ remstats::inertia() + remstats::reciprocity() ## calculate statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_ao <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_ao)
A function that returns the BIC (Bayesian Information Criterion) value in a 'remstimate' object.
bic(object, ...) ## S3 method for class 'remstimate' bic(object, ...)
bic(object, ...) ## S3 method for class 'remstimate' bic(object, ...)
object |
is a |
... |
further arguments to be passed to the 'bic' method. |
BIC value of a 'remstimate' object.
bic(remstimate)
: BIC (Bayesian Information Criterion) value of a 'remstimate' object
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # BIC bic(tie_mle)
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # BIC bic(tie_mle)
remstimate
objectA function that returns the diagnostics of a remstimate
object. The output object of the method diagnostics
contains the residuals of the model estimated in the remstimate
object, and the event rates estimated from the model at each tiem point. For tie-oriented modeling frameworks the object contains: a list residuals
with two objects, standardized_residuals
containing standardized Schoenfeld's residuals (Schoenfeld, D., 1982, <doi:10.2307/2335876>; Grambsch, P. M., & Therneau, T. M., 1994, <doi:10.2307/2337123>; Winnett, A., & Sasieni, P., 2001, <jstor.org/stable/2673500>), and smoothing_weights
(a matrix of weights used for the red smooth splines in the plot of the residuals), an array structure rates
with the event rates estimated from the optimized model parameters, and .reh.processed
which is a pseudo-hidden object containing a further processed remify
object that helps speed up the plotting function plot.remstimate
and that the user is not supposed to modify. As to the actor-oriented modeling frameworks, in the diagnostics output there are two main list objects named after sender_model
and receiver_model
. After selecting the model, the structure of diagnostics is the same as for the tie-oriented model. Each model's diagnostics (sender or receiver) is available only if the corresponding model is found in the remstimate
object.
diagnostics(object, reh, stats, ...) ## S3 method for class 'remstimate' diagnostics(object, reh, stats, ...)
diagnostics(object, reh, stats, ...) ## S3 method for class 'remstimate' diagnostics(object, reh, stats, ...)
object |
is a |
reh |
is a |
stats |
is a |
... |
further arguments to be passed to the 'diagnostics' method. |
a object of class "diagnostics" "remstimate"
with standardized Schoenfeld's residuals and estimated event rates given the optimized model parameters.
diagnostics(remstimate)
: diagnostics of a 'remstimate' object
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # diagnostics tie_diagnostics <- diagnostics(object = tie_mle, reh = tie_reh, stats = tie_reh_stats) names(tie_diagnostics)
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # diagnostics tie_diagnostics <- diagnostics(object = tie_mle, reh = tie_reh, stats = tie_reh_stats) names(tie_diagnostics)
remstimate
objectA function that returns a plot of diagnostics given a 'remstimate' object and depending on the 'approach' attribute.
## S3 method for class 'remstimate' plot( x, reh, diagnostics = NULL, which = c(1:4), effects = NULL, sender_effects = NULL, receiver_effects = NULL, ... )
## S3 method for class 'remstimate' plot( x, reh, diagnostics = NULL, which = c(1:4), effects = NULL, sender_effects = NULL, receiver_effects = NULL, ... )
x |
is a |
reh |
a |
diagnostics |
is a |
which |
one or more numbers between 1 and 2. Plots described in order: (1) two plots: a Q-Q plot of the waiting times where theoretical quantiles (Exponential distribution with rate 1) are plotted against observed quantiles (these are calculated as the multiplication at each time point between the sum of the event rates and the corresponding waiting time, which should be distributed as an exponential with rate 1). Next to the q-q plot, a density plot of the rescaled waiting times (in red) vs. the theoretical distribution (exponential distribution with rate 1, in black). The observed density is truncated at the 99th percentile of the waiting times, (2) standardized Schoenfeld's residuals (per each variable in the model, excluding the baseline) with smoothed weighted spline (line in red). The Schoenfeld's residuals help understand the potential presence of time dependence of the effects of statistics specified in the model, (3) distributions of posterior draws with histograms (only for BSIR and HMC method), (4) trace plots of posterior draws after thinning (only for HMC method). |
effects |
[optional] for tie-oriented modeling (model = "tie"), the names of the statistics which the user wants to plot the diagnostics for (default value is set to all the statistics available inside the object 'diagnostics'). The user can specify this argument for the standardized Schoenfeld's residuals ( |
sender_effects |
[optional] for actor-oriented modeling (model = "actor"), the names of the statistics as to the sender model which the user wants to plot the diagnostics for (default value is set to all the statistics available inside the object 'diagnostics'). The user can specify this argument for the standardized Schoenfeld's residuals ( |
receiver_effects |
[optional] for actor-oriented modeling (model = "actor"), the names of the statistics as to the receiver model which the user wants to plot the diagnostics for (default value is set to all the statistics available inside the object 'diagnostics'). The user can specify this argument for the standardized Schoenfeld's residuals ( |
... |
further arguments to be passed to the 'plot' method, for instance, the remstats object with statistics ('stats') when the object 'diagnostics' is not supplied. |
no return value. The function plots the diagnostics of a 'remstimate' object.
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # diagnostics tie_diagnostics <- diagnostics(object = tie_mle, reh = tie_reh, stats = tie_reh_stats) # plot plot(x = tie_mle, reh = tie_reh, diagnostics = tie_diagnostics)
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # diagnostics tie_diagnostics <- diagnostics(object = tie_mle, reh = tie_reh, stats = tie_reh_stats) # plot plot(x = tie_mle, reh = tie_reh, diagnostics = tie_diagnostics)
remstimate
objectA function that prints out the estimates returned by a 'remstimate' object.
## S3 method for class 'remstimate' print(x, ...)
## S3 method for class 'remstimate' print(x, ...)
x |
is a |
... |
further arguments to be passed to the print method. |
no return value. Prints out the main characteristics of a 'remstimate' object.
# ------------------------------------ # # method 'print' for the # # tie-oriented model: "BSIR" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # print tie_mle # ------------------------------------ # # method 'print' for the # # actor-oriented model: "BSIR" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # print ao_mle # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
# ------------------------------------ # # method 'print' for the # # tie-oriented model: "BSIR" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # print tie_mle # ------------------------------------ # # method 'print' for the # # actor-oriented model: "BSIR" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # print ao_mle # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
A function for the optimization of tie-oriented and actor-oriented likelihood. There are four optimization algorithms: two Frequentists, Maximum Likelihood Estimation (MLE
) and Adaptive Gradient Descent (GDADAMAX
), and two Bayesian, Bayesian Sampling Importance Resampling (BSIR
) and Hamiltonian Monte Carlo (HMC
).
remstimate( reh, stats, method = c("MLE", "GDADAMAX", "BSIR", "HMC"), ncores = attr(reh, "ncores"), prior = NULL, nsim = 1000L, nchains = 1L, burnin = 500L, thin = 10L, init = NULL, epochs = 1000L, L = 50L, epsilon = ifelse(method == "GDADAMAX", 0.001, 0.002), seed = NULL, WAIC = FALSE, silent = TRUE, ... )
remstimate( reh, stats, method = c("MLE", "GDADAMAX", "BSIR", "HMC"), ncores = attr(reh, "ncores"), prior = NULL, nsim = 1000L, nchains = 1L, burnin = 500L, thin = 10L, init = NULL, epochs = 1000L, L = 50L, epsilon = ifelse(method == "GDADAMAX", 0.001, 0.002), seed = NULL, WAIC = FALSE, silent = TRUE, ... )
reh |
a |
stats |
a |
method |
the optimization method to estimate model parameters. Methods available are: Maximum Likelihood Estimation ( |
ncores |
[optional] number of threads for the parallelization. (default value is |
prior |
[optional] prior distribution when |
nsim |
[optional] when |
nchains |
[optional] number of chains to generate in the case of |
burnin |
[optional] number of initial iterations to be added as burnin for |
thin |
[optional] number of steps to skip in the posterior draws for |
init |
[optional] vector of initial values if tie-oriented model, or a named list of two vectors ('sender_model' and 'receiver_model') if both models of the actor-oriented framework are specified. |
epochs |
[optional] It is the number of iteration used in the method |
L |
[optional] number of leap-frog steps to use in the method |
epsilon |
[optional] It is a parameter used in two methods: if |
seed |
[optional] seed value for reproducibility. If |
WAIC |
[optional] logical value. The Watanabe Akaike's Information Criterion (WAIC) will be calculated is |
silent |
[optional-not-yet-implemented] a |
... |
additional parameters. They can be parameters of other functions defined as input in some of the arguments above. (e.g., arguments of the |
'remstimate' S3 object.
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
# ------------------------------------ # # tie-oriented model: "MLE" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE", ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # actor-oriented model: "MLE" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "MLE", ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
remstimate
objectA function that returns the summary of a remstimate
object.
## S3 method for class 'remstimate' summary(object, ...)
## S3 method for class 'remstimate' summary(object, ...)
object |
is a |
... |
further arguments to be passed to the 'summary' method. |
no return value. Prints out the summary of a 'remstimate' object. The output can be save in a list, which contains the information printed out by the summary method.
# ------------------------------------ # # method 'summary' for the # # tie-oriented model: "BSIR" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # method 'summary' for the # # actor-oriented model: "BSIR" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
# ------------------------------------ # # method 'summary' for the # # tie-oriented model: "BSIR" # # ------------------------------------ # # loading data data(tie_data) # processing event sequence with remify tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # specifying linear predictor tie_model <- ~ 1 + remstats::indegreeSender()+ remstats::inertia()+ remstats::reciprocity() # calculating statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # running estimation tie_mle <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # summary summary(tie_mle) # ------------------------------------ # # method 'summary' for the # # actor-oriented model: "BSIR" # # ------------------------------------ # # loading data data(ao_data) # processing event sequence with remify ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor") # specifying linear predictor (for sender rate and receiver choice model) rate_model <- ~ 1 + remstats::indegreeSender() choice_model <- ~ remstats::inertia() + remstats::reciprocity() # calculating statistics ao_reh_stats <- remstats::remstats(reh = ao_reh, sender_effects = rate_model, receiver_effects = choice_model) # running estimation ao_mle <- remstimate::remstimate(reh = ao_reh, stats = ao_reh_stats, method = "BSIR", nsim = 100, ncores = 1) # summary summary(ao_mle) # ------------------------------------ # # for more examples check vignettes # # ------------------------------------ #
A randomly generated sequence of relational events with 5 actors and 100 events. The event sequence is generated by following a tie-oriented modeling approach (for more information run on console help(topic = remulateTie, package = "remulate")
or ?remulate::remulateTie
).
data(tie_data)
data(tie_data)
tie_data
is a list object containing the following objects:
edgelist
a data.frame
with the raw simulated edgelist. The columns of the data.frame
are:
time
the timestamp indicating the time at which each event occurred
actor1
the actor that generated the relational event
actor2
the actor that received the relational event
seed
the seed value used in remulate::remulateTie()
for generating the event sequence
true.pars
a vector containing the values of the parameters used in the generation of the event sequence
# (1) load the data into the workspace data(tie_data) # (2) process event sequence with \code{remify} tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor tie_model <- ~ 1 + remstats::indegreeSender() + remstats::inertia() + remstats::reciprocity() ## calculate statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_tie <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_tie)
# (1) load the data into the workspace data(tie_data) # (2) process event sequence with \code{remify} tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie") # (3) define linear predictor and claculate stastistcs with \code{remstats} package ## linear predictor tie_model <- ~ 1 + remstats::indegreeSender() + remstats::inertia() + remstats::reciprocity() ## calculate statistics tie_reh_stats <- remstats::remstats(reh = tie_reh, tie_effects = tie_model) # (4) estimate model using method = "MLE" and print out summary ## estimate model mle_tie <- remstimate::remstimate(reh = tie_reh, stats = tie_reh_stats, method = "MLE") ## print out a summary of the estimation summary(mle_tie)
A function that returns the WAIC (Watanabe-Akaike's Information Criterion) value in a 'remstimate' object.
waic(object, ...) ## S3 method for class 'remstimate' waic(object, ...)
waic(object, ...) ## S3 method for class 'remstimate' waic(object, ...)
object |
is a |
... |
further arguments to be passed to the 'waic' method. |
WAIC value of a 'remstimate' object.
waic(remstimate)
: WAIC (Watanabe-Akaike's Information Criterion) value of a 'remstimate' object
# No examples available at the moment
# No examples available at the moment