Learn R Programming

ergm.ego (version 0.6.1)

mixingmatrix.egodata: Summarizing the mixing among groups in an egocentric dataset

Description

A mixingmatrix method for egodata objects, to return counts of how often a ego of each group nominates an alter of each group.

Usage

# S3 method for egodata
mixingmatrix(object, attrname, rowprob = FALSE, weight = TRUE, ...)

Arguments

object

A egodata object.

attrname

A character vector containing the name of the network attribute whose mixing matrix is wanted.

rowprob

Whether the counts should be normalized by row sums. That is, whether they should be proportions conditional on the ego's group.

weight

Whether sampling weights should be incorporated into the calculation (TRUE, the default) or ignored (FALSE).

...

Additional arguments, currently unused.

Value

A matrix with a row and a column for each level of attrname.

Note that, unlike mixingmatrix, what is counted are nominations, not ties. This means that under an egocentric census, the diagonal of mixingmatrix.egodata will be twice that returned by mixingmatrix for the original undirected network.

See Also

mixingmatrix, nodemix, summary method for egocentric data

Examples

Run this code
# NOT RUN {
data(faux.mesa.high)
fmh.ego <- as.egodata(faux.mesa.high)

(mm <- mixingmatrix(faux.mesa.high,"Grade"))
(mm.ego <- mixingmatrix(fmh.ego,"Grade"))

stopifnot(isTRUE(all.equal({tmp<-unclass(mm$matrix); diag(tmp) <- diag(tmp)*2;
tmp}, mm.ego, check.attributes=FALSE)))

# }

Run the code above in your browser using DataLab