permPower: Function to compute estimated probability of detecting preferential
connection of intracluster nodes
Description
This function simulates graphs from the alternative hypothesis
of preferential connection of intracluster nodes. For each graph, it runs a node and edge permutation test. The estimated ``power'' of each test is the proportion of graphs that the test rejects the null hypothesis of no preferential connection of intracluster edges.
The non-centrality parameter for the noncentral hypergeometric distribution used to simulate the graphs.
clsizes
A vector of cluster sizes.
nedge
The number of edges in each graph.
nhyper
The number of noncentral hypergeometric graphs simulated to estimate "power".
nperms
The number of permutations used for each run of the edge and node permutation tests.
Value
power.permedge
Estimated ``power'' for edge permutation test.
power.permnode
Estimated ``power'' for node permutation test.
CI.permedge
Vector giving 95% confidence interval for edge permutation test power.
CI.permnode
Vector giving 95% confidence interval for node permutation test power.
Details
The function first generates nhyper realizations of a noncentral hypergeometric(nedge,n,k,psi) random variable, where n is the number of node pairs and k is the number of intracluster node pairs. For each realization x, a graph with n edges, x of which are intracluster, is generated. The edge and node permutation tests (with nperms permutations each) are performed on each graph. The estimated ``power'' of each test is the proportion of graphs for which the test rejects the null hypothesis of no preferential connection of intracluster nodes (at the 5% level). The 95% confidence intervals for the power levels are also computed.