mean_fnr: Calculates average FNR when ground truth is available

Description Usage Arguments Value Examples

View source: R/error_rates.R

Description

Calculates average FNR when ground truth is available

Usage

1
mean_fnr(zm, id)

Arguments

zm

Matrix with posterior samples of cluster assignments

id

Vector of true cluster assignments (ground truth)

Value

Average FNR over posterior samples

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
truePartition <- c(50,50,50,50)
maxPartitionSize<- length(truePartition)
uniqueNumberRecords <- sum(truePartition)
id <- rep(1:uniqueNumberRecords, times=rep(1:maxPartitionSize, times=truePartition))
numberFields <- 5
numberCategories <- rep(10,5)
trueBeta <- 0.01
simulatedData <- SimData(truePartition, numberFields, numberCategories, trueBeta)
posteriorESCD <- SampleCluster(data=simulatedData, Prior="ESCD", burn=0, nsamples=10)
mean_fnr(zm = posteriorESCD$Z, id)

microclustr documentation built on Jan. 13, 2021, 8:58 p.m.