View source: R/effectsMethods.r
| set_effect | R Documentation |
This function provides an interface to change the
specification of a Siena model by setting
various columns in an effects object.
The function set_effect combines the functionality
of setEffect and includeEffects.
set_effect now is preferred.
The oher two are kept for backward compatibility.
## S3 method for class 'sienaEffects'
set_effect(x, shortNames, type="eval",
depvar=x$name[1], covar1="", covar2="",
effect1=0, effect2=0, effect3=0, period=1, group=1,
parameter=NULL, initialValue = 0, random=FALSE,
timeDummy = ",",
include=TRUE, fix=FALSE, test=FALSE, verbose=TRUE, ...)
setEffect(x, shortName, parameter = NULL,
fix = FALSE, test = FALSE, random=FALSE, initialValue = 0,
timeDummy = ",", include = TRUE,
name = x$name[1], type = "eval", interaction1 = "",
interaction2 = "", effect1=0, effect2=0, effect3=0,
period=1, group=1, character=FALSE, verbose = TRUE)
x |
a Siena effects object as created by |
shortNames |
A shortName or list of shortNames (all with or all without quotes) to identify the effect which should be changed. |
shortName |
A shortName to identify the effect which should be changed. |
depvar |
Name of dependent variable (network or behavior) for which interactions are being defined. Defaults to the first in the effects object. |
covar1 |
Name of siena object where needed to completely identify the effect e.g. covariate name or behavior variable name. |
covar2 |
Name of siena object where needed to completely identify the effect e.g. covariate name or behavior variable name. |
parameter |
Value of internal effect parameter. If |
fix |
For fixing effects. Boolean required. Default |
test |
For testing effects by score-type tests. Boolean required.
Default |
random |
For specifying that effects will vary randomly;
used only in function |
initialValue |
Initial value for estimation. Default 0. |
timeDummy |
string: Comma delimited string of which periods to
dummy. Alternatively, use |
include |
Boolean. default |
name |
Name of dependent variable (network or behavior)
for which the effect is being modified.
Defaults to the first in the effects object, which is the
first dependent variable specified in |
type |
Character string indicating the type of the effect to be changed : "rate", "eval", "endow", or "creation". Default "eval". |
interaction1 |
Name of siena object where needed to completely identify the effect e.g. covariate name or behavior variable name. |
interaction2 |
Name of siena object where needed to completely identify the effect e.g. covariate name or behavior variable name. |
effect1 |
Only for |
effect2 |
See |
effect3 |
See |
period |
Number of period if basic rate. Use numbering within groups. |
group |
Number of group if basic rate.
Only relevant for |
character |
Boolean: whether the short name is a character string. |
verbose |
Boolean: should the print of altered effects be produced. |
... |
Additional arguments, not used now. |
Recall from the help page for make_specification
that a Siena effects object (class
sienaEffects or sienaGroupEffects)
is a data.frame;
the rows in the data frame are the effects for this data set;
some of the columns/variables of the data frame
are used to identify the effect, other columns/variables define how this
effect is used in the estimation.
The function set_effect can operate on several
effects simultaneously, but in a less detailed way.
Using set_effect for only one effect can change not only the
value of the column include, but also
those of initialValue and parm.
The arguments shortName, name, type,
interaction1, interaction2, effect1, effect2,
effect3, period, and group should identify one
effect completely.
(Not all of them are needed; see make_specification.)
The call of setEffect will set, for this effect,
the column elements of the resulting effects object for parm,
fix, test, randomEffects, initialValue,
timeDummy, and include to the values requested.
For setEffect the shortName must not
be set between quotes, unless character=TRUE.
The input names interaction1 and interaction2
for setEffect do not themselves
refer to created interactions, but to dependence of the base effects on
other variables in the data set.
They are used to completely identify the effects.
A value for parameter should be given only if only one effect
is specified in shortNames. If it is given,
the occurrences of # in the original effect and function names
are replaced by this value. If a value for parameter is not given,
the current value of the internal effect parameter of this effect is used.
An object of class sienaEffects or
sienaGroupEffects. This will be an updated version of the
input effects object, with one row updated.
Details of the rows altered will be printed, unless verbose=FALSE.
Ruth Ripley, Tom Snijders
See https://www.stats.ox.ac.uk/~snijders/siena/
make_specification,
set_interaction, includeGMoMStatistics,
update_specification,
print.sienaEffects, effectsDocumentation.
mynet <- as_dependent_rsiena(array(c(s501, s502, s503), dim=c(50, 50, 3)))
mybeh <- as_dependent_rsiena(s50a, type="behavior")
mydata <- make_data_rsiena(mynet, mybeh)
myeff <- make_specification(mydata)
myeff <- set_effect(myeff, gwespFF)
myeff <- set_effect(myeff, list(inPop, outAct))
myeff <- set_effect(myeff, "gwespFB")
myeff <- set_effect(myeff, simX, covar1="mybeh")
myeff
# Specify an effect parameter:
myeff <- set_effect(myeff, outTrunc, parameter=1)
myeff
# Set the initial rate parameter for one period:
myeff <- set_effect(myeff, Rate, initialValue=1.5, depvar="mybeh",
type="rate", period=2)
myeff
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.