Learn R Programming

sna (version 0.3)

netcancor: Canonical Correlation for Labeled Graphs

Description

netcancor finds the canonical correlation(s) between the graph sets x and y, testing the result using either conditional uniform graph (CUG) or quadratic assignment procedure (QAP) null hypotheses.

Usage

netcancor(y, x, mode="digraph", diag=FALSE, nullhyp="cugtie", 
    reps=1000)

Arguments

y
First data array to be analyzed. By assumption, the first dimension of the array indexes the graph, with the next two indexing the actors. Missing values are not allowed.
x
Second data array to be analyzed. By assumption, the first dimension of the array indexes the graph, with the next two indexing the actors. Missing values are not allowed.
mode
String indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. mode is set to "digraph" by default.
diag
Boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. diag is FALSE by default.
nullhyp
String indicating the particular null hypothesis against which to test the observed estimands. A value of "cug" implies a conditional uniform graph test (see cugtest) controlling for order only; "
reps
Integer indicating the number of draws to use for quantile estimation. (Relevant to the null hypothesis test only - the analysis itself is unaffected by this parameter.) Note that, as for all Monte Carlo procedures, convergence is slower for more extrem

Value

  • An object of class netcancor with the following properties:
  • xdistArray containing the distribution of the X coefficients under the null hypothesis test.
  • ydistArray containing the distribution of the Y coefficients under the null hypothesis test.
  • cdistArray containing the distribution of the canonical correlation coefficients under the null hypothesis test.
  • corVector containing the observed canonical correlation coefficients.
  • xcoefVector containing the observed X coefficients.
  • ycoefVector containing the observed Y coefficients.
  • cpgreqVector containing the estimated upper tail quantiles (p>=obs) for the observed canonical correlation coefficients under the null hypothesis.
  • cpleeqVector containing the estimated lower tail quantiles (p<=obs) for="" the="" observed="" canonical="" correlation="" coefficients="" under="" null="" hypothesis.<="" description="">
  • xpgreqMatrix containing the estimated upper tail quantiles (p>=obs) for the observed X coefficients under the null hypothesis.
  • xpleeqMatrix containing the estimated lower tail quantiles (p<=obs) for="" the="" observed="" x="" coefficients="" under="" null="" hypothesis.<="" description="">
  • ypgreqMatrix containing the estimated upper tail quantiles (p>=obs) for the observed Y coefficients under the null hypothesis.
  • ypleeqMatrix containing the estimated lower tail quantiles (p<=obs) for="" the="" observed="" y="" coefficients="" under="" null="" hypothesis.<="" description="">
  • cnamesVector containing names for the canonical correlation coefficients.
  • xnamesVector containing names for the X vars.
  • ynamesVector containing names for the Y vars.
  • xcenterValues used to adjust the X variables.
  • xcenterValues used to adjust the Y variables.
  • nullhypString indicating the null hypothesis employed.

Requires

mva

Details

The netcancor routine is actually a front-end to the mva library's cancor routine for computing canonical correlations between sets of vectors. netcancor itself vectorizes the network variables (as per its graph type) and manages the appropriate null hypothesis tests; the actual canonical correlation is handled by cancor.

Canonical correlation itself is a multivariate generalization of the product-moment correlation. Specifically, the analysis seeks linear combinations of the variables in y which are well-explained by linear combinations of the variables in x. The network version of this technique is performed elementwise on the adjacency matrices of the graphs in question; as usual, the result should be interpreted with an eye to the relationship between the type of data used and the assumptions of the underlying model.

Intelligent printing and summarizing of netcancor objects is provided by print.netcancor and summary.netcancor.

References

Butts, C.T., and Carley, K.M. (2001). ``Multivariate Methods for Interstructural Analysis.'' CASOS working paper, Carnegie Mellon University.

See Also

gcor, cugtest, qaptest, cancor

Examples

Run this code
#Generate a valued seed structure
cv<-matrix(rnorm(100),nrow=10,ncol=10)
#Produce two sets of valued graphs
x<-array(dim=c(3,10,10))
x[1,,]<-3*cv+matrix(rnorm(100,0,0.1),nrow=10,ncol=10)
x[2,,]<--1*cv+matrix(rnorm(100,0,0.1),nrow=10,ncol=10)
x[3,,]<-x[1,,]+2*x[2,,]+5*cv+matrix(rnorm(100,0,0.1),nrow=10,ncol=10)
y<-array(dim=c(2,10,10))
y[1,,]<--5*cv+matrix(rnorm(100,0,0.1),nrow=10,ncol=10)
y[2,,]<--2*cv+matrix(rnorm(100,0,0.1),nrow=10,ncol=10)
#Perform a canonical correlation analysis
nc<-netcancor(y,x,reps=100)
summary(nc)

Run the code above in your browser using DataLab