set.seed(1)
z <- matrix(rnorm(40), ncol = 2) # 20 persons
w <- matrix(rnorm(30), ncol = 2) # 15 items
## 1) Point-estimate strengths for person 5 (default gradient, ungrouped)
strengthplot(z, w, person_index = 5, gamma = 2,
title = "Strengths for person 5 (gradient)")
## 2) Turn off gradient and use a single color
strengthplot(z, w, person_index = 5, gamma = 2,
use_gradient = FALSE, single_fill_color = "tomato",
title = "Strengths for person 5 (single color)")
## 3) Posterior example with credible intervals and item groups
draws_z <- replicate(50, z + matrix(rnorm(length(z), sd = 0.1),
nrow(z), ncol(z)), simplify = FALSE)
draws_w <- replicate(50, w + matrix(rnorm(length(w), sd = 0.1),
nrow(w), ncol(w)), simplify = FALSE)
grp <- rep(c("Core", "Peripheral"), length.out = nrow(w))
strengthplot(draws_z, draws_w, person_index = 3,
item_group = grp, ci_level = 0.9, vertical = FALSE,
title = "Posterior strength profile for respondent 3")
Run the code above in your browser using DataLab