Description Usage Arguments Value Examples
View source: R/psketti_distractor.R
Implementation of a graphical (Asril and Marais, 2011) approach to assigning a partial credit scoring system to data previously estimated with a dichotomous Rasch model. The function console output prints object details, a list of items, and generic example of how to call the plot.
1 2 3 4 5 6 7 8 9 10 11 | psketti_distractor(
x,
ID,
Item,
K,
response_options,
eRm.obj,
p.style = "present",
distractor_colours = NULL,
ncut = 10
)
|
x |
A long formatted dataframe |
ID |
column name for ID column |
Item |
column name for Item column |
K |
column name for column containing multiple choice responses. |
response_options |
An ordered factor object to arrange column order in the distractor table. |
eRm.obj |
An object of class eRm and model RM. Use 'eRm::RM(score_data)' to create this object. To plot empirical values for PCM see 'pskettify', 'psketti' and 'psketto'. |
p.style |
Plot output style, "print" for black and white, or "present" for color. Defaults to "present". |
distractor_colours |
An optional vector of colours for distractor plot lines. Must be the same length as response_options. Defaults to 'NULL' for viridis color palette. |
ncut |
Number of cut points to use for the theta axis. Defaults to ncut = 10. You can also set ncut = "Raw" to use the raw theta scores; which is only advisable if the ability data is uniformly distributed. |
Plot.List is a list object containing plots of empirical distractor proportions plotted against the dichotomous Rasch IRF.
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 27 28 29 30 31 32 33 | library(eRm)
library(psketti)
data("FakeData")
Fake_Data_scores <- reshape(FakeData[, c("ID", "Item", "X")],
timevar = "Item",
idvar = "ID",
direction = "wide")
# set column names to be equal to original item names
names(Fake_Data_scores) <- c("ID",
paste0("i",
sprintf(fmt = "%02d", 1:23)))
row.names(Fake_Data_scores) <- Fake_Data_scores$ID # set ID as row names
Fake_Data_scores$ID <- NULL # drop the ID column
fake_rm <- RM(Fake_Data_scores) # fit a Rasch Model
# Prepare response options factor
r_o <- factor(sort(unique(FakeData$K)), # input var
levels = sort(unique(FakeData$K)), # factor levels
ordered = TRUE) # ordered
# multiple plots
spag_plot <- psketti_distractor(ID = "ID", # set ID column
Item = "Item", # set Item column
K= "K", # Set resp categories
x = FakeData, # select data
eRm.obj = fake_rm, # select eRm object
response_options = r_o, # set resp options
p.style = "present") # set plotting style
spag_plot # plot call instructions
spag_plot$Plot.List[['i01']][[1]] # plot item 1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.