Item and Test Characteristic Curves for multiple groups

Hello,

I'm wondering if someone could help me plot individual ICCs and test CCs for three groups -- I'm starting with a base code that looks something like this:

library(haven)
library(tidyverse)
library(mirt)

newdat <- read_sav("/Users/baglolese/Downloads/IRTsampledata.sav")
newdata %>% head()

# create 'group' factor for use with 'multipleGroup()'
## extract indices of age range labels
age_indices <- 
  newdat %>% 
  pull(age)
age_indices %>% head()
## use indices to create 'group' vector of new age range labels
groups <- c("Early", 'Middle', "Late")
group <- groups[age_indices]
## convert to factor: necessary for use with 'multipleGroup()' to avoid
##  order of groups being implicitly determined
group <- factor(group, levels = groups)

# alternative approach to creating 'group' factor in 'newdat' itself
newdat <-
  newdat %>%
  # extract original age range labels and indices
  mutate(age_range = as_factor(age, levels = 'labels')) %>%
  mutate(age_index = as_factor(age, levels = 'values'))
newdat %>% head()
## create column with new age range labels
newdat <-
  newdat %>%
  mutate(age_label =
           case_when(
             age_index == 1 ~ "Early",
             age_index == 2 ~ "Middle",
             age_index == 3 ~ "Late"
           )
  )
newdat %>% head()
## drop age_index and age_range columns, and reorder columns
newdat <-
  newdat %>%
  select(age_label, Item_1:Item_20)
newdat %>% head()
## extract age_label column data and compare with 'group'
group.dup <- newdat %>% pull(age_label)
all(group == group.dup)

# create multigroup object
mg <- 
  multipleGroup(
    newdat %>% select(-age_label),
    mirt.model('F1 = 1-20'), 
    group
  )
## check ordering used for 'group' values
mg@Data$groupNames

# create table of results
Theta <- matrix(seq(-6,6,.1))

# Extract all items 
# Compute the probability trace lines
# Put into a list
traceline <- NULL
for(i in 1:length(dat)){
  extr.2 <- extract.item(mod, i)
  Theta <- matrix(seq(-6,6, by = .1))
  traceline[[i]] <- probtrace(extr.2, Theta)
}

# rename list
names(traceline) <- paste('item',1:length(traceline))

# rbind traceline
traceline.df <- do.call(rbind, traceline)

# create item names length based on length of theta provided
item <- rep(names(traceline),each=length(Theta))

# put them all together into a dataframe
l.format <- cbind.data.frame(Theta, item, traceline.df)


l.format$item<-as.factor(l.format$item)
aux<-l.format %>%
  group_by(item) %>%
  slice(which.min(abs(P.1-0.5))) # We are only using the P.1 column (dichotomous)

aux<-aux[order(aux$Theta),]
ord<-as.integer(aux$item)
l.format$item = factor(l.format$item,levels(l.format$item)[ord])

# plot chart
ggplot(l.format, aes(Theta, P.1, colour = item)) + 
  geom_line() + 
  ggtitle('Probability Tracelines') + 
  xlab(expression(theta)) + 
  ylab(expression(P(theta))) + 
  geom_hline(aes(yintercept = 0.5)) + theme_bw() + 
  theme(text = element_text(size=16),
        axis.text.x=element_text(colour="black"),
        axis.text.y=element_text(colour="black"),
        legend.title=element_blank())

The goal is to compare two of three groups in separate plots, and have consistent linetypes for each group (e.g., "early"=solid, "middle"=dashed, "late"=dotted).

Thanks for any suggestions!

1 Like

Great reprex!

Just to be clear, you have

And you are looking for five separate plots in the same format for each of the items, with the same line color?

Hi @technocrat,
Yes, I'm looking for ICCs with separate plots per item (which I will put into a table of three plots per row), as well as three TCCs comparing two groups at a time across three plots (same format as my question on TIFs: GGplot - Test Information Functions for multiple groups). This post also contains a link to a sample of my dataset.

I'm looking for the lines to be consistent, so the same linetype will be used for each group across plots, and they will be in black and white (solid, dashed, dotted). Thanks!

I don't know how the blazes I got it to run last time, but I'm getting hung up early on.

Could you post a representative l.format using

dput(l.format)

by cut and paste. That's all that's needed for the ggplot

The code for @baglolese's data was in the original post -- I'll repost it here:

library(mirt)
library(ggplot2)
library(dplyr)
dat <- expand.table(LSAT7)
mod <- mirt(dat, 1, verbose=FALSE)

# Extract all items 
# Compute the probability trace lines
# Put into a list
traceline <- NULL
for(i in 1:length(dat)){
 extr.2 <- extract.item(mod, i)
 Theta <- matrix(seq(-4,4, by = .1))
 traceline[[i]] <- probtrace(extr.2, Theta)
}

# rename list
names(traceline) <- paste('item',1:length(traceline))

# rbind traceline
traceline.df <- do.call(rbind, traceline)

# create item names length based on length of theta provided
item <- rep(names(traceline),each=length(Theta))

# put them all together into a dataframe
l.format <- cbind.data.frame(Theta, item, traceline.df)


l.format$item<-as.factor(l.format$item)
aux<-l.format %>%
 group_by(item) %>%
 slice(which.min(abs(P.1-0.5))) # We are only using the P.1 column (dichotomous)

aux<-aux[order(aux$Theta),]
ord<-as.integer(aux$item)
l.format$item = factor(l.format$item,levels(l.format$item)[ord])

# plot chart
ggplot(l.format, aes(Theta, P.1, colour = item)) + 
 geom_line() + 
 ggtitle('Probability Tracelines') + 
 xlab(expression(theta)) + 
 ylab(expression(P(theta))) + 
 geom_hline(aes(yintercept = 0.5)) + theme_bw() + 
 theme(text = element_text(size=16),
       axis.text.x=element_text(colour="black"),
       axis.text.y=element_text(colour="black"),
       legend.title=element_blank())

Thanks, but I was having trouble with getting it to spit out the one object needed to answer the question, the data argument to ggplot. The problem, it has been said, with free advice is that no one values it. Since I can't start charging, I'll drop the topic.

I'm not sure I understand, but here's the code that will build the tibble l.format you were asking for:

library(mirt)
library(tidyverse)
dat <- expand.table(LSAT7) %>% as_tibble()
mod <- mirt(dat, 1, verbose=FALSE)

make_theta <- 
  function(limit, increment){
    matrix(seq(-limit, limit, by = increment))
  }

Theta <- make_theta(4, 0.1)

make_traceline <- 
  function(index, theta = matrix()){
    item <- extract.item(mod, index)
    probtrace(item, theta) %>% 
      as_tibble() %>% 
      mutate(item = paste('item', index)) %>% 
      mutate(Theta = theta) %>% 
      select(Theta, item, P.0, P.1)
  }

l.format <- map_dfr(1:length(dat), ~ make_traceline(.x, Theta))

I do understand, and I'm sorry I was petulant. All I am asking for is a minimal working example in reprex that includes not how to create the object, but the object itself.

All that required is to run the code to create the object and give it to

dput(l.format)

Using mtcars as an example,

dput(mtcars)
#> structure(list(mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, 
#> 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 32.4, 
#> 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, 26, 30.4, 15.8, 
#> 19.7, 15, 21.4), cyl = c(6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 
#> 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 4, 4, 4, 8, 6, 8, 4), 
#>     disp = c(160, 160, 108, 258, 360, 225, 360, 146.7, 140.8, 
#>     167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 440, 78.7, 75.7, 
#>     71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 95.1, 351, 145, 
#>     301, 121), hp = c(110, 110, 93, 110, 175, 105, 245, 62, 95, 
#>     123, 123, 180, 180, 180, 205, 215, 230, 66, 52, 65, 97, 150, 
#>     150, 245, 175, 66, 91, 113, 264, 175, 335, 109), drat = c(3.9, 
#>     3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 
#>     3.07, 3.07, 3.07, 2.93, 3, 3.23, 4.08, 4.93, 4.22, 3.7, 2.76, 
#>     3.15, 3.73, 3.08, 4.08, 4.43, 3.77, 4.22, 3.62, 3.54, 4.11
#>     ), wt = c(2.62, 2.875, 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 
#>     3.15, 3.44, 3.44, 4.07, 3.73, 3.78, 5.25, 5.424, 5.345, 2.2, 
#>     1.615, 1.835, 2.465, 3.52, 3.435, 3.84, 3.845, 1.935, 2.14, 
#>     1.513, 3.17, 2.77, 3.57, 2.78), qsec = c(16.46, 17.02, 18.61, 
#>     19.44, 17.02, 20.22, 15.84, 20, 22.9, 18.3, 18.9, 17.4, 17.6, 
#>     18, 17.98, 17.82, 17.42, 19.47, 18.52, 19.9, 20.01, 16.87, 
#>     17.3, 15.41, 17.05, 18.9, 16.7, 16.9, 14.5, 15.5, 14.6, 18.6
#>     ), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 
#>     0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1), am = c(1, 
#>     1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 
#>     0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), gear = c(4, 4, 4, 3, 
#>     3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 
#>     3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 4, 1, 1, 2, 1, 4, 
#>     2, 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2, 2, 4, 2, 1, 
#>     2, 2, 4, 6, 8, 2)), row.names = c("Mazda RX4", "Mazda RX4 Wag", 
#> "Datsun 710", "Hornet 4 Drive", "Hornet Sportabout", "Valiant", 
#> "Duster 360", "Merc 240D", "Merc 230", "Merc 280", "Merc 280C", 
#> "Merc 450SE", "Merc 450SL", "Merc 450SLC", "Cadillac Fleetwood", 
#> "Lincoln Continental", "Chrysler Imperial", "Fiat 128", "Honda Civic", 
#> "Toyota Corolla", "Toyota Corona", "Dodge Challenger", "AMC Javelin", 
#> "Camaro Z28", "Pontiac Firebird", "Fiat X1-9", "Porsche 914-2", 
#> "Lotus Europa", "Ford Pantera L", "Ferrari Dino", "Maserati Bora", 
#> "Volvo 142E"), class = "data.frame")

Created on 2020-02-24 by the reprex package (v0.3.0)

That, with l.format appropriately trimmed if it is too large is the minimum needed to answer the ggplot question; the rest is surplusage, unneeded and in the way.

The heart of the appeal is help us to help you by making addressing the problem as simply as possible. Think of it as the community's embrace of the R principle of lazy evaluation.

I see, and am sorry -- I didn't want to step on your toes and so thought to bridge the gap between you and the poster, but misunderstood. Since I'd helped the posted earlier, I now realize that part of what may be involved is the definition of the ordering the poster would like to use in the legend, so I'll make a suggestion along those lines below.

1 Like

It looks like you can resuse the code from GGplot - Test Information Functions for multiple groups by creating the analogue of groups immediately after you first create the table l.format -- you can leave the call to factor() until later:

items <- 
l.format %>%
group_by(item) %>%
arrange(abs(P.1-0.5)) %>% 
slice(1) %>% 
ungroup() %>% 
arrange(Theta) %>% 
pull(item)

Then just replace group and groups by item and items in the ggplot() section of the code from GGplot - Test Information Functions for multiple groups. Does this work for you?

Hi @dromano and @technocrat,

Sorry for the confusion here, I want to make this as easy as possible. Here is what I'm using at the moment (using the sample data here: https://easyupload.io/f329qu):

library(mirt)
library(ggplot2)
library(tidyverse)
library(dplyr)

newdat <- read_sav("Downloads/IRTsampledata.sav")
newdat %>% head()

# create 'group' factor for use with 'multipleGroup()'
## extract indices of age range labels
age_indices <- 
  newdat %>% 
  pull(age)
age_indices %>% head()
## use indices to create 'group' vector of new age range labels
groups <- c("Early", 'Middle', "Late")
group <- groups[age_indices]
## convert to factor: necessary for use with 'multipleGroup()' to avoid
##  order of groups being implicitly determined
group <- factor(group, levels = groups)

# alternative approach to creating 'group' factor in 'newdat' itself
newdat <-
  newdat %>%
  # extract original age range labels and indices
  mutate(age_range = as_factor(age, levels = 'labels')) %>%
  mutate(age_index = as_factor(age, levels = 'values'))
newdat %>% head()
## create column with new age range labels
newdat <-
  newdat %>%
  mutate(age_label =
           case_when(
             age_index == 1 ~ "Early",
             age_index == 2 ~ "Middle",
             age_index == 3 ~ "Late"
           )
  )
newdat %>% head()
## drop age_index and age_range columns, and reorder columns
newdat <-
  newdat %>%
  select(age_label, Item_1:Item_20)
newdat %>% head()
## extract age_label column data and compare with 'group'
group.dup <- newdat %>% pull(age_label)
all(group == group.dup)

# create multigroup object
mg <- 
  multipleGroup(
    newdat %>% select(-age_label),
    mirt.model('F1 = 1-20'), 
    group
  )
## check ordering used for 'group' values
mg@Data$groupNames

make_theta <- 
  function(limit, increment){
    matrix(seq(-limit, limit, by = increment))
  }

Theta <- make_theta(4, 0.1)

make_traceline <- 
  function(index, theta = matrix()){
    item <- extract.item(mg, index)
    probtrace(item, theta) %>% 
      as_tibble() %>% 
      mutate(item = paste('item', index)) %>% 
      mutate(Theta = theta) %>% 
      select(Theta, item, P.0, P.1)
  }

l.format <- map_dfr(1:length(newdat), ~ make_traceline(.x, Theta))

I hope this is correct. When I hit this part, before adding @dromano's code above, I get the error

Error: Which group are you trying to extract from? 

It seems to have trouble spitting out results based upon my grouping variable, and I'm not sure how to redirect it. Let me know if/how I can help further.

I'm a little confused by the mixing of the TIF code and the TCC code, so maybe it would be good to work out the example with the ready-made LSAT7 data you started with. Can you start from here:

library(mirt)
library(tidyverse)
dat <- expand.table(LSAT7) %>% as_tibble()
mod <- mirt(dat, 1, verbose=FALSE)

make_theta <- 
  function(limit, increment){
    matrix(seq(-limit, limit, by = increment))
  }

Theta <- make_theta(4, 0.1)

make_traceline <- 
  function(index, theta = matrix()){
    item <- extract.item(mod, index)
    probtrace(item, theta) %>% 
      as_tibble() %>% 
      mutate(item = paste('item', index)) %>% 
      mutate(Theta = theta) %>% 
      select(Theta, item, P.0, P.1)
  }

l.format <- map_dfr(1:length(dat), ~ make_traceline(.x, Theta))

and then modify the ggplot-related code from your TIF question:

# exclude 'Late' group
tI %>% 
  mutate(group = factor(group, levels = groups)) %>% 
  filter(group != 'Late') %>% 
  ggplot(aes(x=xAxis, y=information)) +
  geom_line(aes(linetype = group)) +
  irt_theme +
  labs(x="\nθ", y = "Information\n") +
  scale_x_continuous(breaks=c(-6,-4,-2,0,2,4,6)) +
  ggtitle("Test Information Curve\n")

by replacing tI, group, and groups with their analogues, and see whether that yields the kind of graph you're looking for? If so, then maybe you could bring in the sample data you linked to.

Hi @dromano,

Sorry for the late reply -- for the early part of the code, before modifying the tI pipe, I'm getting an 'unused arguments' error:

Error in select(., Theta, item, P.0, P.1) : 
  unused arguments (Theta, item, P.0, P.1)

The error I keep running into (with and without including groups) is with the l.format command. Using my original sample data from above with the grouping variable, I still get the error

> l.format <- map_dfr(1:length(newdat), ~ make_traceline(.x, Theta))
 Error: Which group are you trying to extract from? 

When I try to specify a group or all groups, I get the same error.
I'll keep buggering away at this today to call the dput(l.format) code @technocrat was looking for, since I need this l.format <- to work to send the output.

1 Like

Just to make sure I understand you correctly: Are you saying that you got the first error when you tried to run the code to build l.format by substituting your own data for the LSAT7 data? Or that you even got the error when you ran the code as it appears above, verbatim?

And in terms of dput(), you would want first to extract a small, representative sample of your bigger table so that the output of dput() fits roughly within a screenshot. In the meantime, I'll see if I can track down my local copy of your sample IRT data to see I can suggest anything...

Hi @technocrat,

I managed to get the dput(l.format) to run. My code was simplified (I am not familiar with tidyverse or ggplot really at all), as I couldn't suss how to modify code kindly provided by @dromano:

rm(list=ls()) # clear out old junk
library(haven)
library(tidyverse)
library(mirt)
library(ggplot2)

# Summon data
newdat <- read_sav("/Downloads/IRTsampledata.sav")

# Group order
group <- c(rep('Early', sum(newdat$age == "1")),
           rep('Middle', sum(newdat$age == "2")),
           rep('Late', sum(newdat$age == "3")))
group <- factor(group, levels = c("Early", 'Middle', "Late"))
# Remove age column
dat <- newdat[,c(2-21)]

mod <- mirt(dat, 1, verbose=FALSE)
# Extract all items 
# Compute the probability trace lines
# Put into a list
traceline <- NULL
for(i in 1:length(dat)){
  extr.2 <- extract.item(mod, i)
  Theta <- matrix(seq(-4,4, by = .5))
  traceline[[i]] <- probtrace(extr.2, Theta)
}

# rename list
names(traceline) <- paste('item',1:length(traceline))
# rbind traceline
traceline.df <- do.call(rbind, traceline)
# create item names length based on length of theta provided
item <- rep(names(traceline),each=length(Theta))
# put them all together into a dataframe
l.format <- cbind.data.frame(Theta, item, traceline.df)

dput(l.format)

The issue is, my original dataset (not linked above) has about 5000 participants, and even reducing Theta to .5 increments, this spits out a result that's extremely long.

> dput(l.format)
structure(list(Theta = c(-4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 
0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, 
-1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, 
-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, 
-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 
4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 
2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 
1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, 
-0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, 
-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, 
-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 
4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 
2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 
1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, 
-0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, 
-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, 
-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 
4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 
2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 
1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, -2, -1.5, -1, 
-0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, -3, -2.5, 
-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, -4, -3.5, 
-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 
4, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 
2.5, 3, 3.5, 4), item = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 14L, 
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 
14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 
17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
18L, 18L, 18L, 18L, 18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
11L, 11L, 11L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
13L, 13L, 13L, 13L, 13L, 13L, 13L), .Label = c("item 1", "item 10", 
"item 11", "item 12", "item 13", "item 14", "item 15", "item 16", 
"item 17", "item 18", "item 19", "item 2", "item 20", "item 3", 
"item 4", "item 5", "item 6", "item 7", "item 8", "item 9"), class = "factor"), 
    P.1 = c(0.200118186078579, 0.225988192158921, 0.254139947680198, 
    0.284509553999383, 0.316966042933678, 0.351307145843956, 
    0.38725939242117, 0.424483325424149, 0.462584077758321, 0.501126870500897, 
    0.539656275675558, 0.577717495874043, 0.614877581606692, 
    0.650744517630828, 0.68498245887565, 0.717321999591108, 0.747565076592345, 
    0.992394113388282, 0.9861653343889, 0.974964233887823, 0.955107111719014, 
    0.920780037723831, 0.863944027806002, 0.776240465804061, 
    0.654604058038137, 0.50869609935126, 0.361291436134043, 0.236075990577557, 
    0.144443239826544, 0.0844460014292873, 0.0479723949795176, 
    0.0267913472713227, 0.0148167295385528, 0.0081494499401713, 
    0.98686185928437, 0.976757299128715, 0.959202584552502, 0.92934821133154, 
    0.880371889343258, 0.804583734820772, 0.697290723256495, 
    0.563078638702859, 0.418947030133841, 0.287437756481625, 
    0.184128282806036, 0.112107949510031, 0.0659796769085196, 
    0.0380187709618151, 0.0216327143096666, 0.012219325518536, 
    0.00687335790600263, 0.985280119743177, 0.971515333978013, 
    0.945589700056473, 0.898532052415914, 0.818584040474725, 
    0.696893356008727, 0.539495502845531, 0.373805823279976, 
    0.233230339121201, 0.134191512259061, 0.0731939450471064, 
    0.0386843574376721, 0.0200926617533994, 0.0103400241957331, 
    0.00529556966353628, 0.00270536086212281, 0.00138033632425794, 
    0.990902781955384, 0.982217263658585, 0.965527778686266, 
    0.934223784000934, 0.878082325208501, 0.785048144975203, 
    0.649369200597367, 0.484306220609807, 0.322597742734359, 
    0.194517011153224, 0.109098199145086, 0.0584668746627857, 
    0.0305278448122109, 0.0157169168824018, 0.00803214361734172, 
    0.00408922330910721, 0.00207779937052088, 0.972466774977879, 
    0.951795789422295, 0.916931394083013, 0.860545425808341, 
    0.775266078808291, 0.658530134043098, 0.51879427247639, 0.376055239074164, 
    0.252020692544902, 0.158503865709653, 0.0952683478886088, 
    0.0555940943518759, 0.0318602467526807, 0.0180648763326287, 
    0.0101800408540637, 0.00571668917954526, 0.00320392150200122, 
    0.947023088408773, 0.900263810015068, 0.820074335735178, 
    0.697103590250787, 0.537488294237861, 0.36980046215564, 0.228573959669926, 
    0.130143676084671, 0.0702407499976581, 0.0367453863370856, 
    0.0188981333759135, 0.00963261549434591, 0.00488723565059934, 
    0.00247376475413852, 0.00125064390496743, 0.000631896180851466, 
    0.000319171935513007, 0.942781085520461, 0.914896985406794, 
    0.87522276759143, 0.8206780156898, 0.74912429215208, 0.660819139378065, 
    0.559700374223807, 0.453372265742173, 0.351134748453087, 
    0.260946366798789, 0.187238245528313, 0.130668976142415, 
    0.0893125832923706, 0.0601398781716314, 0.0400766917204054, 
    0.0265179103603669, 0.0174628972054626, 0.978337069688509, 
    0.956970891556338, 0.916333410177258, 0.843589884598081, 
    0.726478639084737, 0.566718177739015, 0.391769126457064, 
    0.240811171080442, 0.135100657067138, 0.0714286202644513, 
    0.0364984530031179, 0.0183130272685552, 0.0091029202136319, 
    0.00450357052146155, 0.00222287926977538, 0.00109590069726828, 
    0.000539980289600006, 0.976833063762373, 0.959102949182024, 
    0.928792768249571, 0.878856097464348, 0.801388127339267, 
    0.69175643317981, 0.555197721977714, 0.409760688859905, 0.278562365465707, 
    0.176789355513988, 0.106699898436205, 0.0622951549133836, 
    0.0356329644327633, 0.0201370760521239, 0.011300994664043, 
    0.00631715961480173, 0.00352340567786169, 0.942518165514344, 
    0.903771809809897, 0.843251532740829, 0.754987363837469, 
    0.638338395733248, 0.502731947931675, 0.366722388671217, 
    0.249078048311586, 0.159659051187708, 0.0981457986989067, 
    0.0586774468051837, 0.0344741842187408, 0.0200417230600476, 
    0.0115788878604891, 0.00666527109032256, 0.00382871974993815, 
    0.0021966551384861, 0.858187467105633, 0.809745425504801, 
    0.749584433611696, 0.677965442240404, 0.596879024089633, 
    0.510128124737807, 0.422762883781347, 0.339975954944538, 
    0.26593199060594, 0.203053058807698, 0.151963864086213, 0.111923707485524, 
    0.0814206096552608, 0.0586813577759898, 0.0420023676156409, 
    0.0299133936354724, 0.0212267311316623, 0.986827694571107, 
    0.977026476052853, 0.960226325529088, 0.931995632535611, 
    0.886104005823307, 0.81537796196457, 0.714865517202995, 0.587326929598819, 
    0.446880800822928, 0.314429985479169, 0.20657478823579, 0.128767061323777, 
    0.0774069334574859, 0.0454633528802845, 0.026325806950544, 
    0.0151165282645528, 0.00863771326094653, 0.971584409310144, 
    0.951238054711472, 0.917559311664789, 0.863946432633449, 
    0.783687470117243, 0.673951061455007, 0.541140273784748, 
    0.402215559240309, 0.27739543284525, 0.179668634062062, 0.111078658490976, 
    0.0665492329907409, 0.0390859373107165, 0.0226807177338116, 
    0.0130674884981338, 0.00749757110985894, 0.00429146514333445, 
    0.952899309935298, 0.916500042554516, 0.856215985898919, 
    0.763633571936217, 0.636729965511677, 0.487426050816731, 
    0.340332687949929, 0.218689862516552, 0.131835852519265, 
    0.0761159459867391, 0.042785248010569, 0.0236758295470757, 
    0.0129855741526033, 0.00708720923399686, 0.0038575546520605, 
    0.00209655209409376, 0.00113854154799264, 0.964290660880858, 
    0.933260595463436, 0.878659555680114, 0.789465357146336, 
    0.660071789056128, 0.501380636290737, 0.34241084581034, 0.212376319297615, 
    0.122522974777377, 0.0674306534533987, 0.036091625271217, 
    0.0190206350073361, 0.00994078688064937, 0.00517251575883571, 
    0.0026852254462435, 0.00139231614273927, 0.000721479442767681, 
    0.842986190985014, 0.771988173765107, 0.681033767622363, 
    0.573826748473445, 0.459200038504703, 0.348734021825543, 
    0.252437598779706, 0.175563577957583, 0.118392259972764, 
    0.0780753610897645, 0.0506983115709472, 0.0325817336586905, 
    0.0207971225084589, 0.0132166997298689, 0.00837566065552242, 
    0.00529828632954144, 0.00334777961333266, 0.967931854080685, 
    0.956004879831574, 0.939917308817298, 0.918448859426968, 
    0.890205482280821, 0.85373833753554, 0.807774431395168, 0.751569234979543, 
    0.685331928524834, 0.610584727158459, 0.530252143542345, 
    0.448320809515051, 0.369101848206011, 0.296361233035036, 
    0.232669215521375, 0.179179786864631, 0.13581084581522, 0.955736328082368, 
    0.930199134644131, 0.891599736327571, 0.835431476442915, 
    0.758056885431659, 0.659145882130793, 0.544116182819849, 
    0.424179152173541, 0.312553966145213, 0.219125181970129, 
    0.14762677706195, 0.0965724278517864, 0.0618923476084406, 
    0.0391268429328275, 0.0245162066129789, 0.0152747031031096, 
    0.00948296397353121, 0.970055685867997, 0.950362302439108, 
    0.91880135576261, 0.8699198277652, 0.798078632078603, 0.700232965187421, 
    0.579930027229248, 0.449315890990069, 0.325335962298331, 
    0.22178786762937, 0.144155134242827, 0.0905349671092808, 
    0.0555645618313907, 0.0336028816537736, 0.0201363985558285, 
    0.0119996491695337, 0.00712689684608081), P.2 = c(0.602706112823896, 
    0.600148688061986, 0.593077749995742, 0.581647029286554, 
    0.566105773930048, 0.54679364175724, 0.524132495810648, 0.498614499459964, 
    0.470786281154049, 0.441229513169373, 0.41053889743428, 0.379299114203905, 
    0.348062617784401, 0.317330166905991, 0.287535650665591, 
    0.259036194083259, 0.23210783606583, 0.00671711518630455, 
    0.0122090310192867, 0.0220641664030242, 0.0394669708218284, 
    0.0693327472186838, 0.118105496216894, 0.191385028305211, 
    0.287688117925822, 0.390504287364861, 0.468453428164985, 
    0.490887137794428, 0.448155200874427, 0.358347207279717, 
    0.254746330145761, 0.164918814921628, 0.0998953814035062, 
    0.0579605570892359, 0.011479306069186, 0.0202815632778454, 
    0.0355169823385429, 0.0612526090097298, 0.102951415776027, 
    0.165994640918141, 0.251311699672175, 0.348626541907465, 
    0.433493445776889, 0.476268628058338, 0.459774673502395, 
    0.390787327643129, 0.295445858275372, 0.202480219254412, 
    0.128864165775766, 0.0779579132298328, 0.0456653317407004, 
    0.0129097809981067, 0.024938465402251, 0.0474744394650291, 
    0.0879463641734367, 0.155220344187712, 0.252961263275981, 
    0.366623842118618, 0.457219416748613, 0.48154170151461, 0.426615788330094, 
    0.320980915301524, 0.210300704400087, 0.124424408727965, 
    0.0689155782321691, 0.0367220543818162, 0.0191550289856454, 
    0.0098792498068957, 0.00835596736826006, 0.0163220204021339, 
    0.0315957301887865, 0.0601195061867694, 0.110823475909668, 
    0.193307178253695, 0.308826386500103, 0.436473364271269, 
    0.532347150104668, 0.554778762739612, 0.49337877195226, 0.376093955967163, 
    0.249902060094271, 0.149295861920842, 0.0830529873528887, 
    0.0442704805389348, 0.0230438283193901, 0.0236748646769811, 
    0.0413233630838712, 0.0708266716444209, 0.117765781808482, 
    0.186589832388515, 0.275231140259249, 0.368602039780954, 
    0.438951788147668, 0.459204220750101, 0.420772193472095, 
    0.339668644559932, 0.245251514133173, 0.162047964403144, 
    0.100472839251937, 0.0597418789690884, 0.034615872836866, 
    0.0197517724117848, 0.0483970636563578, 0.0907067195335195, 
    0.162200451736265, 0.268392685875872, 0.39641580003789, 0.507268156071842, 
    0.554156698762562, 0.515133401652551, 0.408530713330424, 
    0.280107365348271, 0.17086018692488, 0.0961191064519198, 
    0.0514614722249427, 0.0267956621129705, 0.0137460758221331, 
    0.00699724564146986, 0.00354772100268974, 0.0493720069442373, 
    0.0731264820471121, 0.106537713474981, 0.151636098857228, 
    0.20905950032888, 0.276487505552981, 0.34731746406874, 0.410843326552085, 
    0.454791392519307, 0.469473279342923, 0.451467736401694, 
    0.404958435132423, 0.340099801005224, 0.26918290814728, 0.202565086454119, 
    0.146376580428154, 0.102555990528631, 0.0201361276910083, 
    0.0399335788844142, 0.0774006457795228, 0.143767824292489, 
    0.248179499857336, 0.383131251021608, 0.511397728787368, 
    0.580398160762635, 0.558329895593346, 0.455508071120609, 
    0.31772984834491, 0.194364641724851, 0.108304290490662, 0.0569776440893088, 
    0.0290289496262991, 0.0145422143872662, 0.0072226742259941, 
    0.0208206513309425, 0.0366864223556858, 0.063662067472804, 
    0.10765923327438, 0.174625161605502, 0.265926530233591, 0.371203419408059, 
    0.465252267919682, 0.517096451826053, 0.507321840567224, 
    0.439686580403951, 0.338880675660504, 0.235829077399259, 
    0.151528797812314, 0.0920516456932789, 0.0539297992289319, 
    0.0309057996247798, 0.0487375396077539, 0.0810610307038752, 
    0.130565331415424, 0.200176824570402, 0.285918622525911, 
    0.372104180761315, 0.43341944778333, 0.447266184740329, 0.408100934958334, 
    0.331201680117207, 0.242489825623202, 0.163504273682509, 
    0.10383619395004, 0.063342413346842, 0.0376680667370269, 
    0.0220553175913405, 0.0127953076373922, 0.0948585621396306, 
    0.124789714492654, 0.159835765478896, 0.197983688929459, 
    0.235510329999043, 0.267292348575617, 0.287927041073263, 
    0.293411664001235, 0.282618991136248, 0.257742100255078, 
    0.223440281523932, 0.185193940086519, 0.147746337235249, 
    0.114251743931033, 0.0862007650281303, 0.063818202728062, 
    0.0465811892283405, 0.00978718793053312, 0.0170257234638499, 
    0.0293434312237524, 0.0497755240855099, 0.0822242294982925, 
    0.130143922865665, 0.192990248420494, 0.260997953764055, 
    0.313599632357275, 0.328730399879724, 0.299149995957696, 
    0.238651464652917, 0.170554386014966, 0.112199350454426, 
    0.0697220252128424, 0.0417694828026591, 0.0244692174791677, 
    0.0246626947878025, 0.0422026519549566, 0.0710004860927564, 
    0.116173150826399, 0.18198123183054, 0.267391204415346, 0.360395934991318, 
    0.437112270947003, 0.471373861936553, 0.450020451774139, 
    0.381348717147601, 0.289748670114895, 0.200920378394719, 
    0.129988063651208, 0.0801474919156253, 0.0479028984394085, 
    0.0280869518205321, 0.0433264944405649, 0.0765654119509683, 
    0.131076532764485, 0.213192253470028, 0.321373965981264, 
    0.437985898230403, 0.530321244639302, 0.566344191301015, 
    0.532737479833568, 0.441935273885821, 0.325572324385981, 
    0.216671739097711, 0.133519376403879, 0.0781063926355704, 
    0.0442372301284331, 0.0245834834517925, 0.0135151205204042, 
    0.0329202201157573, 0.061367278314872, 0.111017945878049, 
    0.190790596437237, 0.302488692974577, 0.428755247962235, 
    0.530914589052952, 0.568810386926772, 0.526444511228028, 
    0.421674115236835, 0.295348359835591, 0.185256887435187, 
    0.107399397115645, 0.0592347279490477, 0.031736283149492, 
    0.0167332968189733, 0.00874741646416999, 0.133153593959952, 
    0.190697451912162, 0.26106127678941, 0.337363731298741, 0.40693543312819, 
    0.454426801331624, 0.467695688341964, 0.44314673825714, 0.387365655256179, 
    0.314139313542771, 0.238545909729204, 0.171641897281972, 
    0.118499096656831, 0.0793918269786127, 0.0520940290259867, 
    0.0337065801839725, 0.0216092013629062, 0.0185928175158396, 
    0.0253749407480552, 0.0344044963085872, 0.0462358492301539, 
    0.0614049307553288, 0.0802884840622437, 0.102879254590813, 
    0.128493934630545, 0.155497752855787, 0.181213695843781, 
    0.202216924657501, 0.215099037653153, 0.21750543286956, 0.208974399840559, 
    0.191111817057674, 0.166997535442225, 0.140167431909396, 
    0.0205926708219106, 0.0320034178278717, 0.0485626362305073, 
    0.0710874078998864, 0.0987829435168447, 0.127818132910531, 
    0.151001633785509, 0.160397655527973, 0.15226052350802, 0.129851455320445, 
    0.100970777460641, 0.0729984561311423, 0.0500316742741733, 
    0.0330446000506599, 0.0212934603223303, 0.0135035860817437, 
    0.00847678846006172, 0.0221083903185882, 0.0364506890053691, 
    0.0590877772208344, 0.0932320262994679, 0.141123983994051, 
    0.201050126500754, 0.263720133747811, 0.311966041303336, 
    0.328014464461174, 0.30515548814817, 0.252829910512251, 0.189565220886712, 
    0.131395378779614, 0.0860409481947082, 0.0542124927565224, 
    0.03331939159232, 0.0201629546291686), P.3 = c(0.197175701097525, 
    0.173863119779093, 0.152782302324061, 0.133843416714063, 
    0.116928183136273, 0.101899212398804, 0.0886081117681818, 
    0.0769021751158876, 0.0666296410876299, 0.0576436163297297, 
    0.049804826890162, 0.042983389922052, 0.0370598006089071, 
    0.0319253154631812, 0.0274818904587593, 0.0236418063256324, 
    0.0203270873418254, 0.000888771425413253, 0.00162563459181374, 
    0.00297159970915293, 0.00542591745915765, 0.00988721505748508, 
    0.0179504759771039, 0.0323745058907278, 0.0577078240360409, 
    0.100799613283879, 0.170255135700972, 0.273036871628015, 
    0.40740155929903, 0.557206791290996, 0.697281274874721, 0.808289837807049, 
    0.885287889057941, 0.933889992970593, 0.0016588346464438, 
    0.00296113759343936, 0.00528043310895561, 0.00939917965872975, 
    0.0166766948807144, 0.0294216242610875, 0.05139757707133, 
    0.0882948193896762, 0.14755952408927, 0.236293615460036, 
    0.356097043691569, 0.497104722846841, 0.638574464816108, 
    0.759501009783773, 0.849503119914568, 0.909822761251631, 
    0.947461310353297, 0.00181009925871606, 0.00354620061973625, 
    0.0069358604784981, 0.0135215834106497, 0.0261956153375631, 
    0.0501453807152919, 0.0938806550358509, 0.168974759971412, 
    0.285227959364189, 0.439192699410845, 0.60582513965137, 0.751014938162241, 
    0.855482929518636, 0.920744397572098, 0.957982375954648, 
    0.978139610152232, 0.988740413868846, 0.000741250676355764, 
    0.0014607159392816, 0.0028764911249477, 0.00565670981229621, 
    0.0110941988818304, 0.0216446767711023, 0.0418044129025303, 
    0.0792204151189238, 0.145055107160973, 0.250704226107164, 
    0.397523028902654, 0.565439169370051, 0.719570095093518, 
    0.834987221196756, 0.90891486902977, 0.951640296151958, 0.974878372310089, 
    0.00385836034514033, 0.00688084749383382, 0.0122419342725661, 
    0.0216887923831768, 0.0381440888031934, 0.0662387256976527, 
    0.112603687742656, 0.184992972778167, 0.288775086704996, 
    0.420723940818252, 0.565063007551459, 0.699154391514951, 
    0.806091788844176, 0.881462284415434, 0.930078080176848, 
    0.959667437983589, 0.977044306086214, 0.00457984793486927, 
    0.00902947045141283, 0.0177252125285577, 0.0345037238733406, 
    0.0660959057242492, 0.122931381772518, 0.217269341567512, 
    0.354722922262778, 0.521228536671917, 0.683147248314644, 
    0.810241679699207, 0.894248278053734, 0.943651292124458, 
    0.970730573132891, 0.9850032802729, 0.992370858177679, 0.996133107061797, 
    0.00784690753530129, 0.0119765325460942, 0.0182395189335894, 
    0.0276858854529722, 0.0418162075190395, 0.0626933550689535, 
    0.0929821617074527, 0.135784407705742, 0.194073859027607, 
    0.269580353858287, 0.361294018069993, 0.464372588725162, 
    0.570587615702405, 0.670677213681089, 0.757358221825475, 
    0.827105509211479, 0.879981112265906, 0.00152680262048252, 
    0.00309552955924769, 0.00626594404321952, 0.0126422911094298, 
    0.0253418610579267, 0.0501505712393768, 0.0968331447555683, 
    0.178790668156923, 0.306569447339515, 0.473063308614939, 
    0.645771698651972, 0.787322331006593, 0.882592789295707, 
    0.93851878538923, 0.968748171103926, 0.984361884915466, 0.992237345484406, 
    0.0023462849066842, 0.00421062846229066, 0.00754516427762525, 
    0.0134846692612728, 0.0239867110552314, 0.0423170365865991, 
    0.0735988586142264, 0.124987043220413, 0.20434118270824, 
    0.315888803918788, 0.453613521159844, 0.598824169426112, 
    0.728537958167978, 0.828334126135562, 0.896647359642678, 
    0.939753041156266, 0.965570794697359, 0.00874429487790193, 
    0.0151671594862282, 0.0261831358437474, 0.0448358115921286, 
    0.0757429817408413, 0.12516387130701, 0.199858163545453, 
    0.303655766948085, 0.432240013853958, 0.570652521183887, 
    0.698832727571614, 0.802021542098751, 0.876122082989912, 
    0.925078698792669, 0.955666662172651, 0.974115962658721, 
    0.985008037224122, 0.0469539707547364, 0.0654648600025448, 
    0.0905798009094081, 0.124050868830137, 0.167610645911324, 
    0.222579526686576, 0.28931007514539, 0.366612381054227, 0.451449018257812, 
    0.539204840937225, 0.624595854389855, 0.702882352427957, 
    0.77083305310949, 0.827066898292977, 0.871796867356229, 0.906268403636466, 
    0.932192079639997, 0.00338511749835959, 0.00594780048329733, 
    0.0104302432471599, 0.0182288433788786, 0.0316717646784007, 
    0.0544781151697657, 0.0921442343765113, 0.151675116637126, 
    0.239519566819798, 0.356839614641106, 0.494275215806514, 
    0.632581474023306, 0.752038680527548, 0.842337296665289, 
    0.903952167836614, 0.943113988932788, 0.966893069259886, 
    0.00375289590205336, 0.00655929333357091, 0.0114402022424549, 
    0.0198804165401524, 0.0343312980522168, 0.0586577341296471, 
    0.0984637912239332, 0.160672169812687, 0.251230705218197, 
    0.370310914163799, 0.507572624361423, 0.643702096894364, 
    0.759993684294565, 0.847331218614981, 0.906785019586241, 
    0.944599530450733, 0.967621583036133, 0.00377419562413719, 
    0.00693454549451568, 0.0127074813365955, 0.0231741745937548, 
    0.0418960685070593, 0.0745880509528656, 0.129346067410769, 
    0.214965946182433, 0.335426667647167, 0.48194878012744, 0.63164242760345, 
    0.759652431355213, 0.853495049443517, 0.914806398130433, 
    0.951905215219506, 0.973319964454114, 0.985346337931603, 
    0.00278911900338427, 0.00537212622169207, 0.0103224984418364, 
    0.0197440464164269, 0.037439517969295, 0.0698641157470282, 
    0.126674565136708, 0.218813293775613, 0.351032513994595, 
    0.510895231309766, 0.668560014893192, 0.795722477557477, 
    0.882659816003706, 0.935592756292117, 0.965578491404265, 
    0.981874387038287, 0.990531104093062, 0.0238602150550334, 
    0.0373143743227311, 0.0579049555882269, 0.0888095202278135, 
    0.133864528367107, 0.196839176842833, 0.27986671287833, 0.381289683785277, 
    0.494242084771057, 0.607785325367465, 0.710755778699849, 
    0.795776369059338, 0.86070378083471, 0.907391473291518, 0.939530310318491, 
    0.960995133486486, 0.975043019023761, 0.0134753284034752, 
    0.0186201794203706, 0.0256781948741152, 0.0353152913428785, 
    0.0483895869638505, 0.0659731784022162, 0.0893463140140194, 
    0.119936830389913, 0.159170318619379, 0.208201576997759, 
    0.267530931800153, 0.336580152831796, 0.413392718924429, 
    0.494664367124405, 0.576218967420951, 0.653822677693144, 
    0.724021722275385, 0.0236710010957218, 0.0377974475279973, 
    0.0598376274419221, 0.0934811156571985, 0.143160171051496, 
    0.213035984958676, 0.304882183394642, 0.415423192298486, 
    0.535185510346768, 0.651023362709426, 0.75140244547741, 0.830429116017071, 
    0.888075978117386, 0.927828557016513, 0.954190333064691, 
    0.971221710815147, 0.982040247566407, 0.00783592381341516, 
    0.0131870085555233, 0.0221108670165555, 0.0368481459353322, 
    0.0607973839273464, 0.098716908311825, 0.156349839022942, 
    0.238718067706595, 0.346649573240495, 0.47305664422246, 0.603014955244921, 
    0.719899812004007, 0.813040059388995, 0.880356170151518, 
    0.925651108687649, 0.954680959238146, 0.972710148524751)), class = "data.frame", row.names = c(NA, 
-340L))

But here it is! Hope it's useful and I've done it correctly.

The rest of the code basically is:


l.format$item<-as.factor(l.format$item)
aux<-l.format %>%
  group_by(item) %>%
  slice(which.min(abs(P.1-0.5))) 

aux<-aux[order(aux$Theta),]
ord<-as.integer(aux$item)
l.format$item = factor(l.format$item,levels(l.format$item)[ord])

# plot chart
ggplot(l.format, aes(Theta, P.1, colour = item)) + 
  geom_line() + 
  ggtitle('Probability Tracelines') + 
  xlab(expression(theta)) + 
  ylab(expression(P(theta))) + 
  geom_hline(aes(yintercept = 0.5)) + theme_bw() + 
  theme(text = element_text(size=16),
        axis.text.x=element_text(colour="black"),
        axis.text.y=element_text(colour="black"),
        legend.title=element_blank())

Which yielded the following plot:
Initial_ICC.pdf (7.1 KB)
Which is a good start, though I'm unsure why the curve is backwards. My next steps are comparing items by group for each item (on individual plots), formatting the lines themselves, and combining items to create TCCs.

Great! Thanks, I'll see what I can come up with that to meet the requirement

Hi @baglolese

To make sure I have it right, you are looking to produce a grid of P(\theta) vs ~ \theta plots along the lines of this?

Yes exactly. Ideally it would be B&W lines indicating each group per plot, with a plot per item.

Although it's odd they're coming out backwards for you too -- it should be that the higher expected scores (P(theta) = 1.00) should match with higher levels of the trait (Theta = +4).

That could be due either to l.format's calculation, the fact that I converted item from factor to be able to subset or something else. In the meantime, I'll concentrate on the layout part.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.