coCovar {RSiena} | R Documentation |
Function to create a constant covariate object
Description
This function creates a constant covariate object from a vector.
Usage
coCovar(val, centered=TRUE, nodeSet="Actors", warn=TRUE, imputationValues=NULL)
Arguments
val |
Vector of covariate values |
centered |
Boolean: if TRUE, then the mean value is subtracted. |
nodeSet |
Name of node set: character string. If the entire data set contains more than one node set, then the node sets must be specified in all data objects. |
warn |
Logical: is a warning given if all values are |
imputationValues |
Vector of covariate values of same
length as |
Details
When part of a Siena data object,
the covariate is associated with the node set
nodeSet
of the Siena data object.
In practice, the node set needs to be specified only in the case of
the use of the covariate with a two-mode network.
If there are any NA
values in val
, and
imputationValues
is given, then the corresponding elements
of imputationValues
are used for imputation.
If imputationValues
is NULL
, imputation
is by the mean value. In both cases, cases with imputed values
are not used for calculating target statistics (see the manual).
Value
Returns the covariate as an object of class "coCovar", in which
form it can be used as an argument to sienaDataCreate
.
Author(s)
Ruth Ripley
References
See https://www.stats.ox.ac.uk/~snijders/siena/
See Also
sienaDataCreate
, varCovar
,
coDyadCovar
, varDyadCovar
,
sienaNodeSet
Examples
myconstCovar <- coCovar(s50a[,1])
senders <- sienaNodeSet(50, nodeSetName="senders")
receivers <- sienaNodeSet(30, nodeSetName="receivers")
senders.attribute <- coCovar(rep(1:10, each=5), nodeSet="senders")
receivers.attribute <- coCovar(rep(1:5, each=6), nodeSet="receivers")