updateTheta: A function to update the initial values of theta, and a...

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

View source: R/initializeFRAN.r

Description

updateTheta copies the final values of any matching selected effects from a sienaFit object to a Siena effects object.
updateSpecification includes in a Siena effects object a set of effects that are included in another effects object.

Usage

1
2
updateTheta(effects, prevAns, varName=NULL)
updateSpecification(effects.to, effects.from, name.to=NULL, name.from=NULL)

Arguments

effects

Object of class sienaEffects.

prevAns

Object of class sienaFit as returned by siena07.

varName

Character string or vector of character strings; is this is not NULL, the update will only applied to this dependent variable / these dependent variables.

effects.to

Object of class sienaEffects.

effects.from

Object of class sienaEffects.

name.to

Character string, name of dependent variable in object.to.

name.from

Character string, name of dependent variable in object.from.

Details

The initial values of any selected effects in the input effects object which match an effect estimated in prevAns will be updated by updateTheta. If the previous run was conditional, the estimated rate parameters for the dependent variable on which the run was conditioned are added to the final value of theta. If varName is not NULL, this update is restricted to effects for the dependent variable/s specified by varName.
By updateSpecification, the effects included in effects.from are also included in effects.to; if name.to and/or name.from is specified, this is restricted to effects for those dependent variables. If name.to = "all" (should then not be used as variable name!), the effects for all dependent variables will be updated.
Correspondence between effects is defined by "name", "shortName" "type", "groupName", "interaction1", "interaction2", "period", "effect1", "effect2", and "effect3". This means that inclusion of user-defined interactions will be updated only if they were available (i.e., defined) already in effects.to.

Value

Updated effects object.

Note

Using updateTheta explicitly before calling siena07 rather than using it via the argument prevAns of siena07 will not permit the use of the previous derivative matrix. In most cases, using siena07 with prevAns will be more efficient.

Author(s)

Ruth Ripley, Tom A.B. Snijders

References

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

See Also

siena07, getEffects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## For updateTheta:
mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
mydata <- sienaDataCreate(mynet1)
myeff1 <- getEffects(mydata)
myeff1 <- includeEffects(myeff1, transTrip)
myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=100, projname=NULL)
ans <- siena07(myalgorithm, data=mydata, effects=myeff1, batch=TRUE)
ans$theta
(myeff <- updateTheta(myeff1, ans))
##
## For updateSpecification:
myeff2 <- getEffects(mydata)
myeff2 <- includeEffects(myeff2, inPop)
updateSpecification(myeff2, myeff1)
# Create (meaningless) two-dimensional dependent network
mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2)))
mynet2 <- sienaDependent(array(c(s503, s501), dim=c(50, 50, 2)))
mydata12 <- sienaDataCreate(mynet1, mynet2)
myeff12 <- getEffects(mydata12)
myeff.new <- getEffects(mydata12)
(myeff12 <- includeEffects(myeff12, inPop, outPop, outAct))
# update myeff.new only for mynet1:
updateSpecification(myeff.new, myeff12)
# update myeff.new for all dependent networks:
(myeff.updated <- updateSpecification(myeff.new, myeff12, "all"))
# use multivariate effects object to update univariate effects object:
myeff1 <- getEffects(sienaDataCreate(mynet1))
updateSpecification(myeff1, myeff.updated)

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