coCovar: Function to create a constant covariate object

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

View source: R/sienautils.r

Description

This function creates a constant covariate object from a vector.

Usage

1
coCovar(val, centered=TRUE, nodeSet="Actors", 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.

imputationValues

Vector of covariate values of same length as val, to be used for imputation of NA values (if any) in val. Must not contain any NA.

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 http://www.stats.ox.ac.uk/~snijders/siena/

See Also

sienaDataCreate, varCovar, coDyadCovar, varDyadCovar, sienaNodeSet

Examples

1
2
3
4
5
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")

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