Learn R Programming

RSiena (version 1.1-232)

siena07: Function to estimate parameters in a Siena model

Description

Estimates parameters in a Siena model using method of moments, based on direct simulation, conditional or otherwise; 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 the ..., and the specification for the algorithm must be passed on as x, which is a sienaAlgorithm object as produced by sienaAlgorithmCreate (see examples).

Usage

siena07(x, batch=FALSE, verbose=FALSE, silent=FALSE,
        useCluster=FALSE, nbrNodes=2, initC=TRUE,
        clusterString=rep("localhost", nbrNodes), tt=NULL,
        parallelTesting=FALSE, clusterIter=!x$maxlike,
        clusterType=c("PSOCK", "FORK"), ...)

Arguments

x

A control object, of class sienaAlgorithm

batch

Desired interface: FALSE gives a gui (graphical user interface implemented as a tcl/tk screen), FALSE gives a small amount of printout to the console.

verbose

Produces various output to the console if TRUE.

silent

Produces no output to the console if TRUE, even if batch mode.

useCluster

Boolean: whether to use a cluster of processes (useful if multiple processors are available).

nbrNodes

Number of processes to use if useCluster is TRUE.

initC

Boolean: set to TRUE if the simulation will use C routines (currently always needed). Only for use if using multiple processors, to ensure all copies are initialised correctly. Ignored otherwise, so is set to TRUE by default.

clusterString

Definitions of clusters. Default set up to use the local machine only.

tt

A tcltk toplevel window. Used if called from the model options screen.

parallelTesting

Boolean. If TRUE, sets up random numbers to parallel those in Siena 3.

clusterIter

Boolean. If TRUE, multiple processes execute complete iterations at each call. If FALSE, multiple processes execute a single wave at each call.

clusterType

Either "PSOCK" or "FORK". On Windows, must be "PSOCK". On a single non-Windows machine may be "FORK", and subprocesses will be formed by forking. If "PSOCK", subprocesses are formed using R scripts.

Arguments for the simulation function, see simstats0c: usually, data and effects; possibly also prevAns if a previous reasonable provisional estimate was obtained for a similar model; possibly also returnDeps if the simulated dependent variables (networks, behaviour) should be returned.

Value

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.

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.

sf

Matrix of deviations from target in phase 3.

sf2

Array of statistics from simulations in phase 3.

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

sims

If returnDeps is TRUE: list of simulated dependent variables (networks, behaviour). Networks are given as a list of edgelists, one for each period.

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.

Details

Runs a Robbins-Monro algorithm for parameter estimation using 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 simulation function is called once for each iteration in these phases and also once to initialise the model fitting and once to complete it. Unless in batch mode, displays a tcl/tk screen to allow interruption and to show progress.

References

  • 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/ .

See Also

There are print, summary and xtable methods for sienaFit objects: xtable, print.sienaFit

Examples

Run this code
# NOT RUN {
myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100)
# nsub=2 and n3=100 is used here for having a brief computation, not for practice.
mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
mydata <- sienaDataCreate(mynet1)
myeff <- getEffects(mydata)
ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)

# or for conditional estimation
# }
# NOT RUN {
myalgorithm$condname <- 'mynet1'
myalgorithm$cconditional <- TRUE
ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)
        
# }
# NOT RUN {
# or if a previous 'on track' result ans was obtained
# }
# NOT RUN {
ans1 <- siena07(myalgorithm, data=mydata, effects=myeff, prevAns=ans)
         
# }

Run the code above in your browser using DataLab