outlierTable: List observations with Pareto values larger than a given...

View source: R/fit.R

outlierTableR Documentation

List observations with Pareto values larger than a given threshold

Description

The function prepCleanData compresses observations into the most efficient format for evaluation by Stan. This function maps indices of observations back to the actual observations, filtering by the largest Pareto k values. It is assumed that data was processed by normalizeData or is in the same order as seen by prepCleanData.

Usage

outlierTable(data, x, threshold = 0.5)

Arguments

data

a data list prepared for processing by Stan

x

An object created by loo

threshold

threshold is the minimum k value to include

Value

A data.frame (one row per observation) with the following columns:

pa1

Name of object 1

pa2

Name of object 2

item

Name of item

pick

Observed response

k

Associated Pareto k value

See Also

toLoo, pareto_k_ids

Examples

palist <- letters[1:10]
df <- twoLevelGraph(palist, 300)
theta <- rnorm(length(palist))
names(theta) <- palist
df <- generateItem(df, theta, th=rep(0.5, 4))

df <- filterGraph(df)
df <- normalizeData(df)
dl <- prepCleanData(df)
dl$scale <- 1.5


m1 <- pcStan("unidim_ll", dl)

loo1 <- toLoo(m1, cores=1)
ot <- outlierTable(dl, loo1, threshold=.2)
df[df$pa1==ot[1,'pa1'] & df$pa2==ot[1,'pa2'], 'i1']


pcFactorStan documentation built on Sept. 14, 2023, 1:09 a.m.