simstats0c: Versions of FRAN

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/simstatsc.r

Description

The functions to be called as "FRAN" by siena07. They call compiled C++.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
simstats0c(z, x, data=NULL, effects=NULL, fromFiniteDiff=FALSE,
           returnDeps=FALSE, returnChains=FALSE, byWave=FALSE,
           returnDataFrame=FALSE, returnLoglik=FALSE)
maxlikec(z, x, data=NULL, effects=NULL,
           returnChains=FALSE, byGroup = FALSE, byWave=FALSE,
           returnDataFrame=FALSE, returnLoglik=FALSE,
           onlyLoglik=FALSE)
initializeFRAN(z, x, data, effects, prevAns = NULL, initC,
           profileData = FALSE, returnDeps = FALSE, returnChains =
           FALSE, byGroup = FALSE, returnDataFrame = FALSE,
           byWave = FALSE, returnLoglik = FALSE,  onlyLoglik = FALSE)
terminateFRAN(z, x)

Arguments

z

Control object, passed in automatically in siena07.

x

A sienaAlgorithm object, passed in automatically in siena07.

data

A sienaData object as returned by sienaDataCreate.

effects

A sienaEffects object as returned by getEffects.

fromFiniteDiff

Boolean used during calculation of derivatives by finite differences. Not for user use.

returnDeps

Boolean. Whether to return the simulated networks in Phase 3.

returnChains

Boolean. Whether to return the chains.

byWave

Boolean. Whether to return the finite difference or maximum likelihood derivatives by wave (uses a great deal of memory). Only necessary for sienaTimeTest

byGroup

Boolean. For internal use: allows different thetas for each group to be used in sienaBayes.

returnDataFrame

Boolean. Whether to return the chains as lists or data frames.

returnLoglik

Boolean. Whether to return the log likelihood of the simulated chain.

onlyLoglik

Boolean: whether to return just the likelihood for the simulated chain, plus details of steps accepted and rejected.

prevAns

An object of class "sienaFit" as returned by siena07, from which scaling information (derivative matrix and standard deviation of the deviations) will be extracted along with the latest version of the parameters which will be used as the initial values, unless the model requests the use of standard initial values. If the previous model is exactly the same as the current one, Phase 1 will be omitted. If not, any parameter estimates for effects which are included in the new model will be used as initial values, but phase 1 will still be carried out. If the results used as prevAns are a reasonable starting point, this will increase the efficiency of the algorithm.

initC

If TRUE, call is to setup the data and model in C++. For use with multiple processes only.

profileData

Boolean to force dumping of the data for profiling with sienaProfile.exe.

Details

Not for general users' use.
The name of simstats0c or maxlikec should be used for the element FRAN of the model object, the former when using estimation by forward simulation, the latter for maximum likelihood estimation. The arguments with no defaults must be passed in on the call to siena07. initializeFRAN and terminateFRAN are called in both cases.

Value

simstats0c returns a list containing:

fra

Simulated statistics.

sc

Scores with which to calculate the derivative (not phase 2 or if using finite differences or maximum likelihood).

dff

Contributions to the derivative if finite differences

ntim

For conditional processing, time taken.

feasible

Currently set to TRUE.

OK

Could be set to FALSE if serious error has occurred.

sims

A list of simulation results, one for each period. Each list consists of a list for each data object, each of which consists of a list for each network, each of which consists of a list for each period, each component of which is an edgelist in matrix form (the columns are from, to, value) (or vector for behavior variables). Only if returnDeps is TRUE.

maxlikec returns a list containing:

fra

Simulated scores.

dff

Simulated Hessians: stored as lower triangular matrices

ntim

NULL, compatibility only

feasible

Currently set to TRUE.

OK

Could be set to FALSE if serious error has occurred.

dff

Simulated Hessian

sims

NULL, for compatibility only

chain

A list of sampled chains, one for each period. Each list consists of a list for each data object, each of which consists of a list for each network, each of which consists of a list for each period, each component of which is a list or a data frame depending on the value of returnDataFrame. Only if returnChainss is TRUE.

accepts

Number of accepted MH steps by dependent variable (permute steps are counted under first dependent variable)

rejects

Number of rejected MH steps by dependent variable (permute steps are counted under first dependent variable)

aborts

Number of aborted MH steps counted under first dependent variable.

loglik

Loglikelihood of the simulations. Only if returnLoglik is TRUE. If onlyLoglik is TRUE, only loglik, accepts,rejects and aborts are returned.

initializeFRAN and terminateFRAN return the control object z.

Author(s)

Ruth Ripley

References

See http://www.stats.ox.ac.uk/~snijders/siena/

See Also

siena07

Examples

1
2
3
4
5
6
mynet1 <- sienaNet(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
mydata <- sienaDataCreate(mynet1)
myeff <- getEffects(mydata)
myeff <- includeEffects(myeff, transTrip)
myalgorithm <- sienaAlgorithmCreate(fn=simstats0c, nsub=2, n3=100, projname=NULL)
ans <- siena07(myalgorithm, data=mydata, effects=myeff,  batch=TRUE)

RSiena documentation built on Sept. 24, 2020, 3 p.m.