Estimates parameters in a Siena model using Method of Moments,
or Generalized Method of Moments, based on direct simulation;
or using Maximum Likelihood by MCMC simulation.
Estimation is done using a Robbins-Monro algorithm.
Note that the data and particular model to be used must be passed
in using named arguments as `...`

, and the specification for the
algorithm must be passed on as x, which is a `sienaAlgorithm`

object as produced by `sienaAlgorithmCreate`

; see examples below.

1 2 3 4 5 6 7 |

`x` |
A control object, of class |

`nThreads` |
Number of OpenMP threads each process can use. |

`logLevelConsole` |
Minimal level of logging output to the console. One of 'DEBUG', 'VERBOSE', 'INFO', 'WARNING', 'ERROR', 'FATAL'. Where 'DEBUG' prints all messages, 'FATAL' only the messages with highest priority. |

`logLevelFile` |
Like |

`logBaseName` |
Base name of the logging files. Each process logs into a separate file. The
final log file name is |

`logIncludeLocation` |
When |

`...` |
Arguments for |

`batch` |
Deprecated. See |

`verbose` |
Deprecated. See |

`silent` |
Deprecated. See |

`clusterString` |
Deprecated. The cluster setup is detected automatically via MPI. |

`useCluster` |
Deprecated. See |

`nbrNodes` |
Deprecated. See |

`clusterIter` |
Deprecated. See |

`clusterType` |
Deprecated. See |

`initC` |
Deprecated. C++ anyway. |

`tt` |
Deprecated. No GUI supported. |

This implementation is an alternative to `siena07`

.
In `sienacpp`

the algorithm is coded entirely in C++,
whereas for `siena07`

the 'front end' is coded in R.
The Generalized Method of Moments is available only in `sienacpp`

.
Objects produced by `siena07`

contain some more material
(usually not needed). For the rest, the two functions do the same.

`sienacpp`

runs a Robbins-Monro algorithm for parameter estimation using
for the Method of Moments the three-phase
implementation in Snijders (2001) and Snijders, Steglich and Schweinberger
(2007), with (if `findiff=TRUE`

in the `sienaAlgorithm`

object) derivative estimation as in Schweinberger and Snijders (2007). Phase 1
does a few iterations to estimate the derivative matrix of the targets with
respect to the parameter vector. Phase 2 does the estimation. Phase 3 runs a
simulation to estimate standard errors and check convergence of the model.

The Generalized Method of Moments is used if any of the effects
specified in the effects object is defined with `type=gmm`

.
For the Generalized Method of Moments the algorithm
of Amati, Schoenenberger, and Snijders (2015) is used,
which uses a three-phase Robbins-Monro algorithm as above,
but with an estimated optimal linear combination of the statistics.

If `maxlike=TRUE`

in the `sienaAlgorithm`

object,
estimation is done by Maximum Likelihood implemented as in
Snijders, Koskinen and Schweinberger (2010) also using the three-phase
Robbins-Monro algorithm.

The deprecated parameters are included to allow using the same syntax
as for `siena07`

.

The `Dolby`

option in `sienaAlgorithmCreate`

is not yet supported by `sienacpp`

.

`sienaFit`

objects created by `sienacpp`

cannot be used
for `sienaTimeTest`

or `sienaGOF`

.

The specification of the effects object for GMoM estimation requires
that in the effects object, apart from the basic rate effects,
some of the effects were specified
in `includeEffects`

with `type='eval'`

(the default, which means that this does not need to be stated)
and the others with `type='gmm'`

.
The first then are evaluation effects defining the model specification,
the second are statistics used for estimation.
The method requires that the number of statistics (`type='gmm'`

)
is equal to or larger than the number of
evaluation effects (`type='eval'`

).
See the example below.

Returns an object of class `sienaFit`

, some parts of which are:

`OK` |
Boolean indicating successful termination |

`termination` |
Character string, values: "OK", "Error", or "UserInterrupt". "UserInterrupt" indicates that the user asked for early termination before phase 3. |

`f` |
Various characteristics of the data and model definition. |

`theta` |
Fitted value of theta. |

`pp` |
Length of theta: number of parameters, excluding conditioning rate parameters (if any). |

`qq` |
Number of statistics used in estimation: equal to |

`covtheta` |
Estimated covariance matrix of theta; this is not available if the sienaAlgorithm object x was produced with simOnly=TRUE. |

`dfra` |
Matrix of estimated derivatives of expected statistics (linear combinations used in Robbins-Monro updates) by parameters. |

`gamma` |
Matrix of estimated derivatives of expected statistics (all) by parameters. |

`sf` |
Matrix of deviations from targets in phase 3. |

`sf2` |
Array of statistics from simulations in phase 3. |

`tstat` |
t-statistics for convergence. |

`targets` |
Observed statistics. |

`targets2` |
Observed statistics by wave, starting with the second wave . |

`ssc` |
Score function contributions for each wave for each simulation in phase 3. Zero if finite difference method is used |

`Phase3nits` |
Number of iterations actually performed in phase 3. |

Writes text output to the file named "projname.out", where projname is defined
in the `sienaAlgorithm`

object `x`

.

Felix Schoenenberger, some modifications by Tom Snijders

Amati, Viviana, Schoenenberger, Felix, and Snijders, Tom A.B. (2015). Estimation of stochastic actor-oriented models for the evolution of networks by generalized method of moments.

*Journal de la Societe Francaise de Statistique*, 156, 140-165.Schweinberger, Michael, and Snijders, Tom A.B. (2007). Markov models for digraph panel data: Monte Carlo-based derivative estimation.

*Computational Statistics and Data Analysis*51, 4465-4483.Snijders, Tom A.B. (2001). The statistical evaluation of social network dynamics.

*Sociological Methodology*, 31, 361-395.Snijders, Tom A.B., Steglich, Christian E.G., and Schweinberger, Michael (2007). Modeling the co-evolution of networks and behavior. Pp. 41-71 in

*Longitudinal models in the behavioral and related sciences*, edited by Kees van Montfort, Han Oud and Albert Satorra; Lawrence Erlbaum.Steglich, Christian E. G., Snijders, Tom A. B., and Pearson, Michael A. (2010). Dynamic networks and behavior: Separating selection from influence.

*Sociological Methodology*, 40, 329-393.Further see http://www.stats.ox.ac.uk/~snijders/siena/

`sienaAlgorithmCreate`

, `siena07`

.

There are print, summary and xtable methods for `sienaFit`

objects: `xtable`

, `print.sienaFit`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
# Method of Moments:
algo <- sienaAlgorithmCreate(nsub=2, n3=100)
net <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
dataset <- sienaDataCreate(net)
eff <- getEffects(dataset)
eff
(ans <- sienacpp(algo, data=dataset, effects=eff))
# or if a previous 'on track' result ans was obtained
(ans <- sienacpp(algo, data=dataset, effects=eff, prevAns=ans))
# Generalized Method of Moments:
algo <- sienaAlgorithmCreate(nsub=2, n3=100, dolby=FALSE)
eff <- includeEffects(eff, density)
eff <- includeEffects(eff, density, type='gmm')
eff <- includeEffects(eff, recip)
eff <- includeEffects(eff, recip, realrecip, persistrecip, type='gmm')
eff
(ans <- sienacpp(algo, data=dataset, effects=eff))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.