# permPower: Function to compute estimated probability of detecting... In GraphAT: Graph Theoretic Association Tests

## 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.

## Usage

 `1` ```permPower(psi=1,clsizes, nedge, nhyper=100, nperms=1000) ```

## Arguments

 `psi` 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.

## 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.

## Value

A list with four components:

 `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.

## Author(s)

Tom LaFramboise tlaframb@hsph.harvard.edu

`permEdgesM2M`, `permNodesM2M`, `makeClustM`
 `1` ```permPower(psi=5,clsizes=c(1,2,3,4),nedge=10,nhyper=100,nperms=100) ```