Description Usage Arguments Value Examples
Generates score report for dataframe.
1 | ingrediente(x, ID, Item, Score, K, K_options, Index = NULL)
|
x |
a dataframe. |
ID |
column name for ID column |
Item |
column name for Item column |
Score |
a column name for response scores |
K |
column name for column containing multiple choice responses |
K_options |
An ordered factor object to arrange column order in the score table. |
Index |
Column name for order of administration per participant. This can also be an ordered factor for the item names. Orders the Response string. Defaults to 'NULL', using the items to order the response string. |
Score reports for participants, with counts of category selection and a score string ordered by score string index
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # Example 1
# For dichotomous Rasch model
library(psketti)
data("FakeData")
K_opt <- factor(LETTERS[1:5], levels = LETTERS[1:5], ordered = TRUE)
score_report <- ingrediente(x = FakeData,
Item = "Item",
ID = "ID",
Score = "X",
K = "K",
K_options = K_opt,
Index = "Index")
# show score report for values with a total score <= 5
score_report[score_report$total_score <= 1, ]
# Score report ordering response string by item difficulty
data("FakeItems")
FI2 <- FakeItems[order(FakeItems$Beta),]
row.names(FI2)<- NULL
FI_factor <- factor(FI2$Item, levels = FI2$Item, ordered = TRUE)
score_report2 <- ingrediente(x = FakeData,
Item = "Item",
ID = "ID",
Score = "X",
K = "K",
K_options = K_opt,
Index = FI_factor)
# show score report for values with a total score <= 5
score_report2[score_report2$total_score == 21, ]
## Not run:
# Example 2
# For Rasch partial credit model
library(dplyr)
library(tidyr)
data("FakePCMData")
data("FakePCMItems")
# Arrange Data, wide to long
fpcm <- FakePCMData %>%
pivot_longer(cols = -ID, values_to = "Response", names_to = "Item") %>%
mutate(X = Response) %>%
mutate(K = as.character(Response)) %>%
mutate(K = recode(K, "0" = "A", "1" = "B", "2" = "C", "3" = "D"))
# factor variable: Index for item order
F2 <- FakePCMItems[, c("Item", "Beta")] # extract relevant cols
F2 <- F2[order(F2$Beta),] # order dataframe
row.names(F2) <- NULL # drop rownames
# create factor variable
F_factor <- factor(F2$Item,
levels = F2$Item,
ordered = TRUE)
#apply factor to data frame
fpcm$Index <- fpcm$Item # Item -> Index
fpcm$Index <- factor(fpcm$Index,
levels = levels(F_factor),
ordered = TRUE)
fpcm <- as.data.frame(fpcm) # ensure this is a dataframe!!
# factor variable for K categories
K_opt <- factor(LETTERS[1:4],
levels = LETTERS[1:4],
ordered = TRUE)
# produce score report
score_pcm <- ingrediente(x = fpcm,
Item = "Item",
ID = "ID",
Score = "X",
K = "K",
Index = "Index",
K_options = K_opt)
score_pcm[score_pcm$total_score < 2, ] # print out score report
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.