View source: R/sienaRIDynamics.r
| interpret_size_dynamics | R Documentation |
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.
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, ...)
data |
|
ans |
|
theta |
Vector of parameter values of effects included in the model.
Length of |
algorithm |
|
effects |
|
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 |
intervalsPerPeriod |
For analyzing the dynamics of relative
importances between observation moments, the time interval between
observation moments is divided into |
n3 |
Integer specifying the number of chains to be simulated.
Defaults to the value in |
silent |
Logical specifying whether output during internal
|
seed |
Integer specifying the seed for random number generation
during internal |
useChangeContributions |
Logical specifying whether previously extracted change contributions should be used instead of rerunning phase 3 simulations. |
x |
|
staticRI |
|
col |
Colors used in the plot. If |
ylim |
A vector of two numbers specifying the maximum and minimum
value of the y-range visible in the plot. If |
width |
Width of the plot. If |
height |
Height of the plot. If |
legend |
Boolean: if |
legendColumns |
Number of columns in legend. If
|
legendHeight |
Height of legend. If |
cex.legend |
Specifies the relative font size of legend labels. |
... |
Other arguments. |
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.
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:
intervalValuesthe relative importances of included effects for simulated ministeps of the considered dependent variable aggregated over subintervals.
dependentVariablethe name of the dependent variable the results refer to.
effectNamesthe names of considered effects.
Natalie Indlekofer
Indlekofer, N. and Brandes, U. (2013), Relative Importance of Effects in Stochastic Actor-oriented Models. Network Science, 1 (3), 275–297.
sienaRI and siena07
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.