NCV.select | R Documentation |

selecting block models by NCV of Chen and Lei (2016)

```
NCV.select(A, max.K, cv = 3)
```

`A` |
adjacency matrix |

`max.K` |
largest number of communities to check |

`cv` |
fold of cross-validation |

Spectral clustering is used for fitting the block models

a list of

`dev ` |
the binomial deviance loss under SBM for each K |

`l2 ` |
the L_2 loss under SBM for each K |

`dc.dev ` |
the binomial deviance loss under DCSBM for each K |

`dc.l2 ` |
the L_2 loss under DCSBM for each K |

`dev.model ` |
the selected model by deviance loss |

`l2.model ` |
the selected model by L_2 loss |

`sbm.l2.mat, sbm.dev.mat,....` |
the corresponding matrices of loss for each fold (row) and each K value (column) |

Tianxi Li, Elizaveta Levina, Ji Zhu

Maintainer: Tianxi Li tianxili@virginia.edu

Chen, K. & Lei, J. Network cross-validation for determining the number of communities in network data Journal of the American Statistical Association, Taylor & Francis, 2018, 113, 241-251

`ECV.block`

```
dt <- BlockModel.Gen(30,300,K=3,beta=0.2,rho=0.9,simple=FALSE,power=TRUE)
A <- dt$A
ncv <- NCV.select(A,6,3)
ncv$l2.model
ncv$dev.model
which.min(ncv$dev)
which.min(ncv$l2)
which.min(ncv$dc.dev)
which.min(ncv$dc.l2)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.