formatting.covars: Reformat matrix of covariates.

Description Usage Arguments Details Value References See Also Examples

View source: R/formatting.covars.R

Description

This function reformats the matrix of input covariates into the required format for the link probabilities and for the mixing proportions.

Usage

1
formatting.covars(covars, link.vars, mix.vars, n)

Arguments

covars

The n x p data frame of node specific covariates passed in to the overall MEclustnet function. The first column should be a column of 1's and categorical variables should be factors.

link.vars

A vector detailing the column numbers of the matrix covars that should be included in the link probabilities model.

mix.vars

A vector detailing the column numbers of the matrix covars that should be included in the mixing proportions probabilities model.

n

The number of nodes in the network.

Details

For the link regression model, the difference in the link.vars covariates, for all pairs of nodes is calculated. For the mixing proportions model, the required representation of the mix.vars required is formed, where for categorical/factor variables a dummy value representation is used.

Value

A list with

x.link

A matrix with n^2 rows and length(link.vars) columns, detailing the differences in covariates for all pairs of nodes.

x.mix

A matrix with n rows and number of columns equal to the number of variables detailed in mix.vars, where dummy variable representations will be used for categorical.factor covariates.

References

Isobel Claire Gormley and Thomas Brendan Murphy. (2010) A Mixture of Experts Latent Position Cluster Model for Social Network Data. Statistical Methodology, 7 (3), pp.385-405.

See Also

MEclustnet

Examples

1
2
3
4
5
6
data(us.twitter.covariates)
link.vars = c(1)
mix.vars = c(1,5,7,8)
res = formatting.covars(us.twitter.covariates, link.vars, mix.vars, nrow(us.twitter.covariates))
dim(res$x.link)
dim(res$x.mix)

MEclustnet documentation built on Oct. 10, 2019, 5:04 p.m.