Skip to contents

Compute the deviance residuals under the binomial model averaged over all entries as the prediction error.

Usage

psd_error(G, result)

Arguments

G

The I x J matrix of counts; all entries of G should be taken from {0,1,2}.

result

Output of psd_fit_em, psd_fit_sqp, or psd_fit_vi.

Value

A value indicates the accuracy of the prediction.

Examples

G <- matrix(c(0,0,1, 0,2,1, 1,0,1, 0,1,0, 1,0,0), 3, 5)
result <- psd_fit_em(G, 2, 1e-5, 10)
psd_error(G, result)
#> [1] 0.1686011