Description Usage Arguments Details Author(s) See Also Examples
View source: R/plot_traceline.R
This function plots item or test characteristic curve using the ggplot2 package. The item characteristic (or category) curve (ICC) or item score curve is drawn for an individual item. The test characteristic curve (TCC) is drawn based on a total test form.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | plot.traceline(
x,
item.loc = NULL,
score.curve = FALSE,
layout.col = 2,
xlab.text,
ylab.text,
main.text,
lab.size = 15,
main.size = 15,
axis.size = 15,
line.color,
line.size = 1,
strip.size = 12,
...
)
|
x |
An object of class |
item.loc |
A numeric value indicating that the nth item (or the location of item) is plotted. If NULL, the TCC based on a total test form is drawn. Default is NULL. |
score.curve |
Logical value. If TRUE, item score curve (i.e., a weighted sum of item category probabilities over the item scores) is plotted
in a panel. Otherwise, ICCs for all score categories are plotted in separate panels. For a dichotomous item, the item score curve is the same as
the ICC of score category 1. Ignored when |
layout.col |
An integer value indicating the number of columns in the panel when displaying ICCs for an item. |
xlab.text, ylab.text |
A title for the x and y axes. |
main.text |
An overall title for the plot. |
lab.size |
The size of xlab and ylab. Default is 15. |
main.size |
The size of |
axis.size |
The size of labels along the x and y axes. Default is 15. |
line.color |
A character string specifying the color for a line. See http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/ for more details about colors used in ggplot2. |
line.size |
The size of lines. Default is 1. |
strip.size |
The size of facet labels when ICCs for an item are plotted. |
... |
Further arguments passed from the function |
All of the plots are drawn using the ggplot2 package.
If item.loc = NULL
, the TCC based on the total test form is plotted. In the argument item.loc
,
a numeric value should be specified to indicate the nth item among the total test form. For example,
if there are ten items in the test form and the ICCs of the third item should be plotted, then item.loc = 3
.
Hwanggyu Lim hglim83@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## example
## using a "-prm.txt" file obtained from a flexMIRT
flex_prm <- system.file("extdata", "flexmirt_sample-prm.txt", package = "irtplay")
test_flex <- bring.flexmirt(file=flex_prm, "par")$Group1$full_df
# set theta values
theta <- seq(-3, 3, 0.1)
# compute the item category probabilities and item/test
# characteristic functions given the theta values
x <- traceline(x=test_flex, theta, D=1)
# plot TCC based on the toal test form
plot(x, item.loc=NULL)
# plot ICCs for the first item (dichotomous item)
plot(x, item.loc=1, score.curve=FALSE, layout.col=2)
# plot item score curve for the first item (dichotomous item)
plot(x, item.loc=1, score.curve=TRUE)
# plot ICCs for the last item (plolytomous item)
plot(x, item.loc=55, score.curve=FALSE, layout.col=2)
# plot item score curve for the last item (plolytomous item)
plot(x, item.loc=55, score.curve=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.