interpret_size_dynamics: Functions to assess the dynamics of relative importance of...

View source: R/sienaRIDynamics.r

interpret_size_dynamicsR Documentation

Functions to assess the dynamics of relative importance of effects between observation moments

Description

The function interpret_size_dynamics returns the relative importance of effects in a SAOM according to the measure of relative importance described in Indlekofer and Brandes (2013). More precisely, it returns aggregates of relative importances over simulated ministeps between observation moments as described in Section 3.2 of this paper but only for the starting observation at each period. The measure is based on the influence of effects on simulated micro-steps and takes the complete model specification into account. Therefore, required arguments are the analysed data given as a siena data object (necessary for the micro-steps simulations) as well as the complete model specification represented either by an estimated sienaFit object or by the triple consisting of a suitable parameter vector theta and the corresponding sienaAlgorithm and sienaEffects objects.

Usage

  interpret_size_dynamics(data, ans=NULL, theta=NULL,
     algorithm=NULL, effects=NULL, depvar=NULL,
     intervalsPerPeriod=NULL, n3 = NULL, useChangeContributions=FALSE,
     silent=TRUE, seed=NULL)
  ## S3 method for class 'sienaRIDynamics'
plot(x, staticRI=NULL, col=NULL,
     ylim=NULL, width=NULL, height=NULL, legend=TRUE,
     legendColumns=NULL, legendHeight=NULL, cex.legend=NULL, ...)

Arguments

data

siena data object representing the analyzed data and resulting from a call to sienaDataCreate.

ans

sienaFit object resulting from a call to siena07. The sienaFit object contains all necessary information on the model specification, in particular, the vector of parameter values ans$theta, the used algorithm for estimation ans$x, and information on included model effects ans$effects. If ans is a valid sienaFit object, the calculations of relative importances are based on ans$theta, ans$x, and ans$effects. Alternatively, the necessary information can be given directly as a suitable parameter vector theta, a sienaAlgorithm object, and a sienaEffects object. In this case, ans has to be unspecified (i.e., ans=NULL).

theta

Vector of parameter values of effects included in the model. Length of theta has to be equal to the number of included effects (rate effects as well as evaluation effects).

algorithm

sienaAlgorithm object as resulting from a call to sienaAlgorithmCreate. Works only for estimation by Method of Moments (i.e., if maxlike = FALSE).

effects

sienaEffects object specifying which effects are included the model.

depvar

If the model contains more than one dependent variable, it has to be specified for which dependent variable the relative importances of associated effects should be determined. Only those simulated ministeps that refer to the selected dependent variable are considered in the aggregated values of relative importance of the corresponding effects. If depvar=NULL, relative importances will be determined for the first element in the list of dependent variables of data (attr(data$depvars,"names")[1]).

intervalsPerPeriod

For analyzing the dynamics of relative importances between observation moments, the time interval between observation moments is divided into
intervalsPerPeriod subintervals. The values of relative importance are aggregated over all ministeps of one subinterval. Default value is 10 subintervals per period.

n3

Integer specifying the number of chains to be simulated. Defaults to the value in algorithm or what was set when estimating ans. A very large value will result in a long computation time and large memory usage.

silent

Logical specifying whether output during internal siena calls should be suppressed. Default is TRUE.

seed

Integer specifying the seed for random number generation during internal siena calls.

useChangeContributions

Logical specifying whether previously extracted change contributions should be used instead of rerunning phase 3 simulations.

x

interpret_size_dynamics object resulting from a call to
interpret_size_dynamics.

staticRI

sienaRI object corresponding to the same model and data as x. If staticRI is specified, the expected relative importances of effects at observation moment are indicated in the plot by circlets at the beginning of each period.

col

Colors used in the plot. If col=NULL a default color scheme is used.

ylim

A vector of two numbers specifying the maximum and minimum value of the y-range visible in the plot. If ylim=NULL default values are used.

width

Width of the plot. If width=NULL a default value is used.

height

Height of the plot. If height=NULL a default value is used.

legend

Boolean: if TRUE a legend is added to the plot. x$effectNames are used as labels.

legendColumns

Number of columns in legend. If legendColumns=NULL a default value is used. Only effective if legend=TRUE.

legendHeight

Height of legend. If legendHeight=NULL a default value is used. Only effective if legend=TRUE.

cex.legend

Specifies the relative font size of legend labels.

...

Other arguments.

Details

interpret_size_dynamics takes the data as well as the complete model specification into account. Therefore, necessary arguments are the analyzed data given as a siena data object as well as the complete model specification represented either by an estimated sienaFit object or by the triple consisting of a suitable parameter vector theta and the corresponding sienaAlgorithm and sienaEffects objects.

Note that interpret_size_dynamics works only with Method of Moments
(i.e., for sienaAlgorithm objects with maxlike = FALSE).

If ans is a valid sienaFit object that resulted from a call to siena07 with unconditional estimation (i.e., for sienaAlgorithm objects with cond = FALSE), the calculations of relative importances are based on ans$theta, ans$x, and ans$effects. (Note that if the estimation of ans has been conditional on a dependent variable, it is necessary to give the associated sienaEffects object explicitly to interpret_size_dynamics).

Alternatively, the necessary information can be given directly as a suitable parameter vector theta (containing necessary rate and evaluation parameters), a sienaAlgorithm object,
and a sienaEffects object. In this case, ans has to be unspecified, i.e., ans=NULL.

If the sienaFit object ans was already estimated with returnChangeContributions=TRUE, the change contributions are stored in ans$changeContributions and can be used to estimate the relative importances of effects in interpret_size_dynamics without running any additional simulations. In this case, useChangeContributions has to be set to TRUE and n3 is ignored, since the number of chains is determined by the previous siena07 run. If useChangeContributions=FALSE, new chains are simulated internally with siena07 and the change contributions are calculated from these chains. The number of simulations is determined by the value of n3 or the value of algorithm$n3 if algorithm is specified. Otherwise, it defaults to the value of ans$n3 if ans is specified.

Value

interpret_size_dynamics returns an object of class sienaRIDynamics.

A returned interpret_size_dynamics object stores the relative importances of effects in simulated mini-steps aggregated to intervalsPerPeriod averages per period. For details, see Section 3.2 of Indlekofer and Brandes (2013).

A interpret_size_dynamics object consists of following components:

intervalValues

the relative importances of included effects for simulated ministeps of the considered dependent variable aggregated over subintervals.

dependentVariable

the name of the dependent variable the results refer to.

effectNames

the names of considered effects.

Author(s)

Natalie Indlekofer

References

Indlekofer, N. and Brandes, U. (2013), Relative Importance of Effects in Stochastic Actor-oriented Models. Network Science, 1 (3), 275–297.

See Also

sienaRI and siena07

Examples


myalgo <- set_algorithm_saom(nsub=1, n3=32, seed=1777, cond=FALSE)
myout <- set_output_saom(returnChangeContributions=TRUE)
mynet1 <- as_dependent_rsiena(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
mydata <- make_data_rsiena(mynet1)
mymodel <- make_specification(mydata)
mymodel <- set_effect(mymodel, list(inPop, outAct, transTrip))
(ans <- siena(mydata, effects=mymodel,
            control_algo=myalgo, control_out=myout, batch=TRUE))

RIDynamics1 <- interpret_size_dynamics(mydata, ans=ans,
                 useChangeContributions=TRUE)
RIDynamics1
## Not run: 
plot(RIDynamics1)


myalgo2 <- set_algorithm_saom(nsub=1, n3=32, seed=1777, cond=TRUE)
(ans2 <- siena(mydata, effects=mymodel, control_algo=myalgo2,
            control_out=myout, batch=TRUE))

RIDynamics2 <- interpret_size_dynamics(mydata, ans=ans2, effects=mymodel)
RIDynamics2


myalgo3 <- sienaAlgorithmCreate(nsub=1, n3=32, seed=1777, cond=TRUE)
RIDynamics3 <- interpret_size_dynamics(data=mydata,
             theta=c(ans2$rate,ans2$theta),
             algorithm=myalgo3, effects=mymodel, intervalsPerPeriod=4)
RIDynamics3

myalgo4 <- set_algorithm_saom(nsub=1, n3=32)
mynet2 <-  as_dependent_rsiena(array(c(s501, s502, s503), dim=c(50, 50, 3)))
mybeh <-  as_dependent_rsiena(s50a, type="behavior")
mydata2 <- make_data_rsiena(mynet2, mybeh)
mymodel2 <- make_specification(mydata2)
mymodel2 <- set_effect(mymodel2, list(inPop, outAct, transTrip))

(ans3 <- siena(mydata2, effects=mymodel2, control_algo=myalgo4,
            control_out=myout,  batch=TRUE))

RIDynamics4 <- interpret_size_dynamics(mydata2, ans=ans3, depvar="mybeh")
RIDynamics4

RI5 <- interpret_size(ans3, data=mydata2)

RIDynamics5 <- interpret_size_dynamics(mydata2, ans=ans3,
                                       depvar="mynet2", n3 = 50)
RIDynamics5
plot(RIDynamics5, staticRI=RI5[[1]])

## End(Not run)

RSiena documentation built on April 20, 2026, 5:07 p.m.