get_ss: Get sufficient statistics

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

Find sufficient statistics from a data set

Usage

1
get_ss(dat)

Arguments

dat

Data set with items as columns and examinees as rows. Missing responses should be coded as NA.

Value

Vector of sufficient statistics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(2524)

diff_1 <- rnorm(10)
diff_2 <- rnorm(10)

N <- 500

th <- MASS::mvrnorm(N, mu = c(0, -1),
                    Sigma = matrix(c(1, .5 * 2, .5 * 2, 4), nrow = 2))

probs_1 <- 1 / (1 + exp(-outer(th[, 1], diff_1, "-")))
probs_2 <- 1 / (1 + exp(-outer(th[, 2], diff_2, "-")))

probs <- cbind(probs_1, probs_2)

dat <- apply(probs, 2, function(p) as.numeric(p > runif(N)))

get_ss(dat)

scaleAlign documentation built on Aug. 10, 2020, 9:07 a.m.