plot_expected: Plot predicted and observed frequencies.

Description Usage Arguments Examples

Description

Plot histograms of observed response frequencies separately for each item (via plot_responses), and adds the predictions from boeck_predict.

Usage

1
2
3
plot_expected(fit_sum, X = NULL, revItem = NULL, traitItem = NULL,
  points = 5, type = "b", col = "cyan", lwd = 2, ylim = NULL,
  measure = c("Median", "Mean"), ...)

Arguments

fit_sum

List. A summary of theta and beta parameters as returned from tidyup_irtree_fit.

X

an N x J matrix of observed responses for categories 1...5 (use mult_to_cat to transform a multinomial frequency matrix with 1s/0s to responses from 1...5)

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)

points

how many resposne categories in Likert scale

type

character indicating the type of plotting; actually any of the types as in plot.default.

col

Color of the prediction line.

lwd

The line width, a positive number, defaulting to 2. The interpretation is device-specific, and some devices do not implement line widths less than one. (See the help on the device for details of the interpretation.)

ylim

the y limits of the plot.

measure

Character vector that indicates whether the mean (default) or the median of the posterior distribution should be plotted.

...

Additional arguments passed to lines.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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, warmup = 200)
res2 <- summarize_irtree_fit(res1)
res3 <- tidyup_irtree_fit(res2)

# plot expected and observed frequencies
plot_expected(res3, X = dat$X)

## End(Not run)

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