tidyup_irtree_fit: Summarize and tidy up a fitted model.

Description Usage Arguments Value Examples

Description

Function takes a fitted model returned from fit_irtree and returns a tidy summary of the fitted parameters.

Usage

1
2
3
tidyup_irtree_fit(fit, S = NULL, N = NULL, J = NULL,
  revItem = NULL, traitItem = NULL, fitModel = NULL,
  fitMethod = NULL, plot = TRUE, ...)

Arguments

fit

a fitted object from fit_irtree or preferably from summarize_irtree_fit.

S

number of latent processes to be measured

N

number of persons

J

number of items

revItem

vector of length J specifying reversed items (1=reversed, 0=regular)

traitItem

vector of length J specifying the underlying traits (e.g., indexed from 1...5). Standard: only a single trait is measured by all items. If the Big5 are measured, might be something like c(1,1,1,2,2,2,...,5,5,5,5)

fitModel

Character. Either "2012" (Boeckenholt Model without acquiescence) or "ext" (Acquiescence Model). Details about all implemented models are described in the section Models below.

fitMethod

whether to use JAGS or Stan

plot

Logical. Whether a plot should be produced using plot_irtree and returned. NB: When you save the output including the plot, the file will require much more space on disk compared to space required in memory (see also https://stackoverflow.com/a/21836959/).

...

Further arguments passed to plot_irtree.

Value

The function returns a list for each of the core parameters (e.g., theta, beta), which are each summarized with the posterior mean, median and 95% CI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# generate data
N <- 20
J <- 10
betas <- cbind(rnorm(J, .5), rnorm(J, .5), rnorm(J, 1.5), rnorm(J, 0))
dat <- generate_irtree_ext(N = N, J = J, betas = betas, beta_ARS_extreme = .5)

# fit model
res1 <- fit_irtree(dat$X, revItem = dat$revItem, M = 200)
res2 <- summarize_irtree_fit(res1)
res3 <- tidyup_irtree_fit(res2)
names(res3)
res3$plot
cor(res3$theta$Median, dat$theta)
cor(res3$beta$Median, dat$betas)

## End(Not run)

hplieninger/mpt2irt documentation built on May 17, 2019, 4:54 p.m.