### Data

For demonstration purposes, 20-item dataset GMAT from difNLR R package is used. On this page, you may select one of several toy datasets, mostly offered by ShinyItemAnalysis and difNLR packages or you may upload your own dataset (see below). To return to demonstration dataset, click on Unload data button.

#### Training datasets

Main data file should contain responses of individual respondents (rows) to given items (columns). Data need to be either binary, nominal (e.g. in ABCD format), or ordinal (e.g. in Likert scale). Header may contain item names, no row names should be included. In all data sets header should be either included or excluded. Columns of dataset are by default renamed to Item and number of particular column. If you want to keep your own names, check box Keep item names below. Missing values in scored dataset are by default evaluated as 0. If you want to keep them as missing, check box Keep missing values below.

Data specification
Missing values

For nominal data, it is necessary to upload key of correct answers.

For ordinal data, you are advised to include vector containing cut-score which is used for binarization of uploaded data, i.e., values greater or equal to provided cut-score are set to 1, otherwise to 0. You can either upload dataset of item-specific values, or you can provide one value for whole dataset.

Note: In case that cut-score is not provided, vector of maximal values is used.

For nominal data, it is necessary to upload key of correct answers.

For ordinal data, you are advised to include vector containing cut-score which is used for binarization of uploaded data, i.e., values greater or equal to provided cut-score are set to 1, otherwise to 0. You can either upload dataset of item-specific values, or you can provide one value for whole dataset.

Note: In case that cut-score is not provided, vector of maximal values is used.

For ordinal data, it is optional to upload minimal and maximal values of answers. You can either upload datasets of item-specific values, or you can provide one value for whole dataset.

Note: If no minimal or maximal values are provided, these values are set automatically based on observed values.

Group is binary vector, where 0 represents reference group and 1 represents focal group. Its length needs to be the same as number of individual respondents in the main dataset. If the group is not provided then it won't be possible to run DIF and DDF detection procedures in DIF/Fairness section. Missing values are not supported for group membership vector and such cases/rows of the data should be removed.

Criterion variable is either discrete or continuous vector (e.g. future study success or future GPA in case of admission tests) which should be predicted by the measurement. Its length needs to be the same as number of individual respondents in the main dataset. If the criterion variable is not provided then it wont be possible to run validity analysis in Predictive validity section on Validity page.

DIF matching variable is a vector of the same length as number of observations in your data. If not supplied, total score is automatically computed and utilized by default.

### Data exploration

Here you can explore uploaded dataset. Rendering of tables can take some time.

### Analysis of total scores

Total score, also known as raw score or sum score, is the easiest measure of latent trait being measured. The total score is calculated as the sum of their item scores. In binary items, the total score corresponds to the total number of correct answers.

#### Summary table

Table below summarizes basic descriptive statistics for the total scores including number of respondents $$n$$, minimum and maximum, median, $$\textrm{SD}$$, and The skewness for normally distributed scores is near the value of 0 and the kurtosis is near the value of 3.

#### Histogram of total score

For selected cut-score, blue part of histogram shows respondents with total score above the cut-score, grey column shows respondents with total score equal to the cut-score and red part of histogram shows respondents below the cut-score.

#### Selected R code

library(difNLR)library(ggplot2)library(psych)# loading datadata(GMAT)data <- GMAT[, 1:20]# total score calculationscore <- rowSums(data)# summary of total score tab <- describe(score)[, c("n", "min", "max", "mean", "median", "sd", "skew", "kurtosis")]tab$kurtosis <- tab$kurtosis + 3tab# colors by cut-scorecut <- median(score) # cut-score color <- c(rep("red", cut - min(score)), "gray", rep("blue", max(score) - cut))df <- data.frame(score)# histogramggplot(df, aes(score)) +   geom_histogram(binwidth = 1, fill = color, col = "black") +   xlab("Total score") +   ylab("Number of respondents") +   theme_app()

### Standard scores

Total score is calculated as the
Percentile indicates the value below which a percentage of observations falls, e.g., an individual score at the 80th percentile means that the individual score is the same or higher than the scores of 80% of all respondents.
Success rate is the percentage of scores obtained, e.g., if the maximum points of test is equal to 20, minimum is 0, and individual score is 12 then success rate is $$12 / 20 = 0.6$$, i.e., 60%.
Z-score or also standardized score is with mean of 0 and and standard deviation of 1.
T-score is with a mean of 50 and standard deviation of 10.

#### Selected R code

library(difNLR) # loading datadata(GMAT) data <- GMAT[, 1:20] # scores calculations (unique values)score <- rowSums(data)               # Total score tosc <- sort(unique(score))          # Levels of total score perc <- ecdf(sc)(tosc)               # Percentiles sura <- 100 * (tosc / max(score))    # Success rate zsco <- sort(unique(scale(score)))   # Z-score tsco <- 50 + 10 * zsco               # T-score

### Reliability

We are typically interested in unobserved true score $$T$$, but have available only the observed score $$X$$ which is contaminated by some measurement error $$e$$, such that $$X = T + e$$ and error term is uncorrelated with the true score.

#### Equation

Reliability is defined as squared correlation of the true and observed score

$$\text{rel}(X) = \text{cor}(T, X)^2$$

Equivalently, reliability can be re-expressed as the ratio of the true score variance to total observed variance

$$\text{rel}(X) = \frac{\sigma^2_T}{\sigma^2_X}$$

### Spearman-Brown formula

#### Equation

For test with $$I$$ items total score is calculated as $$X = X_1 + ... + X_I$$. Let $$\text{rel}(X)$$ be the reliability of the test. For a test consisting of $$I^*$$ items (equally precise, measuring the same construct), that is for test which is $$m = \frac{I^*}{I}$$ times longer/shorter, the reliability would be

$$\text{rel}(X^*) = \frac{m\cdot \text{rel}(X)}{1 + (m - 1)\cdot\text{rel}(X)}.$$

Spearman-Brown formula can be used to determine reliability of a test with similar items but of different number of items. It can also be used to determine necessary number of items to achieve desired reliability.

In calculations below reliability of original data is by default set to value of Cronbach's $$\alpha$$ of the dataset currentli in use. Number of items in original data is by default set to number of items of dataset currently in use.

#### Estimate of reliability with different number of items

Here you can calculate estimate of reliability of a test consisting of different number of items (equally precise, measuring the same construct).

#### Necessary number of items for required level of reliability

Here you can calculate necessary number of items (equally precise, measuring the same construct) to gain required level of reliability.

#### Selected R code

library(psychometrics)library(ShinyItemAnalysis)# loading datadata(HCI)data <- HCI[, 1:20]# reliability of original datarel.original <- psychometric::alpha(data)# number of items in original dataitems.original <- ncol(data)# number of items in new dataitems.new <- 30# ratio of tests lengthsm <- items.new/items.original# determining reliabilitypsychometric::SBrel(Nlength = m, rxx = rel.original)# desired reliabilityrel.new <- 0.8# determining test length(m.new <- psychometric::SBlength(rxxp = rel.new, rxx = rel.original))# number of required itemsm.new*items.original

### Split-half method

Split-half method uses correlation between two subscores for estimation of reliability. The underlying assumption is that the two halves of the test (or even all items on the test) are equally precise and measure the same underlying construct. Spearman-Brown formula is then used to correct the estimate for the number of items.

#### Equation

For test with $$I$$ items total score is calculated as $$X = X_1 + ... + X_I$$. Let $$X^*_1$$ and $$X^*_2$$ be total scores calculated from items only in the first and second subsets. Then estimate of reliability is given by Spearman-Brown formula (Spearman, 1910; Brown, 1910) with $$m = 2$$.

$$\text{rel}(X) = \frac{m\cdot \text{cor}(X^*_1, X^*_2)}{1 + (m - 1)\cdot\text{cor}(X^*_1, X^*_2)} = \frac{2\cdot \text{cor}(X^*_1, X^*_2)}{1 + \text{cor}(X^*_1, X^*_2)}$$

Below you can choose from different split-half approaches. First-last method uses correlation between the first half of items and the second half of items. Even-odd includes even items into the first subset and odd items into the second one. Random method performs random split of items, thus the resulting estimate may be different for each call. Revelle's $$\beta$$ is actually the worst split-half (Revelle, 1979). Estimate is here calculated as the lowest split-half reliability of by default 10,000 random splits. Finally, Average considers by default 10,000 split halves and averages the resulting estimates. Number of split halves can be changed below. In case of odd number of items, first subset contains one more item than second one.

#### Reliability estimate with confidence interval

Estimate of reliability for First-last , Even-odd , Random and Revelle's $$\beta$$ is calculated using Spearman-Brown formula. Confidence interval is based on confidence interval of correlation using delta method. Estimate of reliability for Average method is mean value of sampled reliabilities and confidence interval is confidence interval of this mean.

#### Histogram of reliability estimates

Histogram is based on selected number of split halves estimates (10,000 by default). The current estimate is highlighted by red colour.

### Criterion validity

This section requires criterion variable (e.g. future study success or future GPA in case of admission tests) which should correlate with the measurement. Criterion variable can be uploaded in Data section.

#### Descriptive plots of criterion variable on total score

Total scores are plotted according to criterion variable. Boxplot or scatterplot is displayed depending on the type of criterion variable - whether it is discrete or continuous. Scatterplot is provided with red linear regression line.

#### Correlation of criterion variable and total score

Test for association between total score and criterion variable is based on Spearmans $$\rho$$. This rank-based measure has been recommended if bivariate normal distribution is not guaranteed. The null hypothesis is that correlation is 0.

#### Selected R code

library(ShinyItemAnalysis) library(difNLR) # loading datadata(GMAT) data01 <- GMAT[, 1:20] # total score calculationscore <- apply(data01, 1, sum) # criterion variablecriterion <- GMAT[, "criterion"] # number of respondents in each criterion levelsize <- as.factor(criterion)levels(size) <- table(as.factor(criterion))size <- as.numeric(paste(size))df <- data.frame(score, criterion, size)# descriptive plots ### boxplot, for discrete criterionggplot(df, aes(y = score, x = as.factor(criterion), fill = as.factor(criterion))) +  geom_boxplot() +  geom_jitter(shape = 16, position = position_jitter(0.2)) +  scale_fill_brewer(palette = "Blues") +  xlab("Criterion group") +  ylab("Total score") +  coord_flip() +  theme_app()### scatterplot, for continuous criterionggplot(df, aes(x = score, y = criterion)) +   geom_point() +   ylab("Criterion variable") +   xlab("Total score") +   geom_smooth(method = lm,              se = FALSE,              color = "red") +   theme_app()# correlation cor.test(criterion, score, method = "spearman", exact = FALSE)

### Criterion validity

This section requires criterion variable (e.g. future study success or future GPA in case of admission tests) which should correlate with the measurement. Criterion variable can be uploaded in Data section. Here you can explore how the criterion correlates with individual items.

#### Item difficulty / criterion validity plot

The following plot intelligibly depicts the criterion validity of every individual item (blue) together with its difficulty (red). Items are ordered by difficulty. You can choose from two indices of criterion validity – item-criterion correlation and so-called "item validity index". The former refers to simple Pearson product-moment correlation (or, in the case of binary dataset, point-biserial correlation), the later also takes into account the item varinace (see Allen & Yen, 1979, for details). Further item analysis can be performed in Item Analysis tab.

Threshold:

#### Distractor plot

In distractor analysis based on criterion variable, we are interested in how test takers select the correct answer and the distractors (wrong answers) with respect to group based on criterion variable.

With option Combinations all item selection patterns are plotted (e.g. AB, ACD, BC). With option Distractors answers are splitted into distractors (e.g. A, B, C, D).

#### Correlation of criterion variable and scored item

Test for association between total score and criterion variable is based on Spearmans $$\rho$$. This rank-based measure has been recommended if bivariate normal distribution is not guaranteed. The null hypothesis is that correlation is 0.

#### Selected R code

library(ShinyItemAnalysis) library(difNLR) # loading datadata("GMAT", "GMATtest", "GMATkey") data <- GMATtest[, 1:20] data01 <- GMAT[, 1:20] key <- GMATkey criterion <- GMAT[, "criterion"] # item difficulty / criterion validity plotDDplot(data01, criterion = criterion, val_type = "simple")# distractor plot for item 1 and 3 groups plotDistractorAnalysis(data, key, num.groups = 3, item = 1, matching = criterion) # correlation for item 1 cor.test(criterion, data01[, 1], method = "spearman", exact = F)

Traditional item analysis uses proportions of correct answers or correlations to estimate item properties.

#### Item difficulty/discrimination plot

Displayed is difficulty (red) and discrimination (blue) for all items. Items are ordered by difficulty.
Difficulty of the item is by default estimated as its average scaled score, i.e. average item score divided by its range. Below you can change the estimate of difficulty to average score of the item. For binary items both estimates are equivalent and can be interpreted as percent of respondents who answered the item correctly.
Discrimination is by default estimated as difference in (scaled) item score in upper and lower third of respondents (Upper-Lower Index, ULI). ULI can be customized by changing number of groups and by changing which groups should be compared (see also Martinkova, Stepanek et al., 2017). Other options for discrimination index include coRrelation between Item and Total score (RIT index) and coRrelation between Item and total score based on Rest of the items (RIR index). By rule of thumb, all items with discrimination lower than 0.2 (threshold in the plot), should be checked for content. Lower discrimination is excpectable in case of very easy or very difficult items, or in ULI based on more homogeneous groups (such as 4th and last fifth). Threshold may be adjusted for these cases or may be set to 0.

Threshold:

#### Selected R code

library(difNLR) library(psych)library(ShinyItemAnalysis) # loading datadata(GMAT) data <- GMAT[, 1:20] # difficulty and discrimination plot DDplot(data, discrim = 'ULI', k = 3, l = 1, u = 3) # Cronbach alpha psych::alpha(data) # traditional item analysis table ItemAnalysis(data)

### Distractor analysis

In distractor analysis, we are interested in how test takers select the correct answer and how the distractors (wrong answers) were able to function effectively by drawing the test takers away from the correct answer.

#### Distractors plot

With option Combinations all item selection patterns are plotted (e.g. AB, ACD, BC). With option Distractors answers are splitted into distractors (e.g. A, B, C, D).

#### Selected R code

library(difNLR)library(ShinyItemAnalysis) # loading datadata(GMATtest) data <- GMATtest[, 1:20] data(GMATkey) key <- unlist(GMATkey) # combinations - plot for item 1 and 3 groups plotDistractorAnalysis(data, key, num.group = 3, item = 1, multiple.answers = TRUE) # distractors - plot for item 1 and 3 groups plotDistractorAnalysis(data, key, num.group = 3, item = 1, multiple.answers = FALSE) # table with counts and margins - item 1 and 3 groups DA <- DistractorAnalysis(data, key, num.groups = 3)[[1]] dcast(as.data.frame(DA), response ~ score.level, sum, margins = TRUE, value.var = "Freq") # table with proportions - item 1 and 3 groups DistractorAnalysis(data, key, num.groups = 3, p.table = TRUE)[[1]]

### Logistic regression on total scores

Various regression models may be fitted to describe item properties in more detail. Logistic regression can model dependency of probability of correctly answering item $$i$$ by respondent $$p$$ on their total score $$X_p$$ by S-shaped logistic curve. Parameter $$\beta_{i0}$$ describes horizontal position of the fitted curve and parameter $$\beta_{i1}$$ describes its slope.

#### Plot with estimated logistic curve

Points represent proportion of correct answers with respect to total score. Their size is determined by count of respondents who achieved given level of total score.

#### Equation

$$\mathrm{P}(Y_{pi} = 1|X_p) = \mathrm{E}(Y_{pi}|X_p) = \frac{e^{\left(\beta_{i0} + \beta_{i1} X_p\right)}}{1 + e^{\left(\beta_{i0} + \beta_{i1} X_p\right)}}$$

#### Selected R code

library(ggplot2)# loading datadata(GMAT, package = "difNLR")data <- GMAT[, 1:20]score <- rowSums(data) # total score# logistic model for item 1fit <- glm(data[, 1] ~ score, family = binomial)# coefficientscoef(fit)# function for plotfun <- function(x, b0, b1) {  exp(b0 + b1 * x) / (1 + exp(b0 + b1 * x))}# empirical probabilities calculationdf <- data.frame(  x = sort(unique(score)),  y = tapply(data[, 1], score, mean),  size = as.numeric(table(score)))# plot of estimated curveggplot(df, aes(x = x, y = y)) +  geom_point(aes(size = size),    color = "darkblue",    fill = "darkblue",    shape = 21, alpha = 0.5  ) +  stat_function(    fun = fun, geom = "line",    args = list(      b0 = coef(fit)[1],      b1 = coef(fit)[2]    ),    size = 1,    color = "darkblue"  ) +  xlab("Total score") +  ylab("Probability of correct answer") +  ylim(0, 1) +  ggtitle("Item 1") +  theme_app()

### Logistic regression on standardized total scores

Various regression models may be fitted to describe item properties in more detail. Logistic regression can model dependency of probability of correctly answering item $$i$$ by respondent $$p$$ on their standardized total score $$Z_p$$ (Z-score) by S-shaped logistic curve. Parameter $$\beta_{i0}$$ describes horizontal position of the fitted curve and parameter $$\beta_{i1}$$ describes its slope.

#### Plot with estimated logistic curve

Points represent proportion of correct answers with respect to standardized total score. Their size is determined by count of respondents who achieved given level of standardized total score.

#### Equation

$$\mathrm{P}(Y_{pi} = 1|Z_p) = \mathrm{E}(Y_{pi}|Z_p) = \frac{e^{\left(\beta_{i0} + \beta_{i1} Z_p\right)}}{1 + e^{\left(\beta_{i0} + \beta_{i1} Z_p\right)}}$$

#### Selected R code

library(ggplot2)# loading datadata(GMAT, package = "difNLR")data <- GMAT[, 1:20]zscore <- scale(rowSums(data)) # standardized total score# logistic model for item 1fit <- glm(data[, 1] ~ zscore, family = binomial)# coefficientscoef(fit)# function for plotfun <- function(x, b0, b1) {  exp(b0 + b1 * x) / (1 + exp(b0 + b1 * x))}# empirical probabilities calculationdf <- data.frame(  x = sort(unique(zscore)),  y = tapply(data[, 1], zscore, mean),  size = as.numeric(table(zscore)))# plot of estimated curveggplot(df, aes(x = x, y = y)) +  geom_point(aes(size = size),    color = "darkblue",    fill = "darkblue",    shape = 21, alpha = 0.5  ) +  stat_function(    fun = fun, geom = "line",    args = list(      b0 = coef(fit)[1],      b1 = coef(fit)[2]    ),    size = 1,    color = "darkblue"  ) +  xlab("Standardized total score") +  ylab("Probability of correct answer") +  ylim(0, 1) +  ggtitle("Item 1") +  theme_app()

### Logistic regression on standardized total scores with IRT parameterization

Various regression models may be fitted to describe item properties in more detail. Logistic regression can model dependency of probability of correctly answering item $$i$$ by respondent $$p$$ on their standardized total score $$Z_p$$ (Z-score) by S-shaped logistic curve. Note change in parametrization - the IRT parametrization used here corresponds to the parametrization used in IRT models. Parameter $$b_{i}$$ describes horizontal position of the fitted curve (difficulty) and parameter $$a_{i}$$ describes its slope at inflection point (discrimination).

#### Plot with estimated logistic curve

Points represent proportion of correct answers with respect to standardized total score. Their size is determined by count of respondents who achieved given level of standardized total score.

#### Equation

$$\mathrm{P}(Y_{pi} = 1|Z_p) = \mathrm{E}(Y_{pi}|Z_p) = \frac{e^{a_i\left(Z_p - b_i\right)}}{1 + e^{a_i\left(Z_p - b_i\right)}}$$

#### Selected R code

library(ggplot2)# loading datadata(GMAT, package = "difNLR")data <- GMAT[, 1:20]zscore <- scale(rowSums(data)) # standardized total score# logistic model for item 1fit <- glm(data[, 1] ~ zscore, family = binomial)# coefficients(coef <- c(a = coef(fit)[2], b = -coef(fit)[1] / coef(fit)[2]))# function for plotfun <- function(x, a, b) {  exp(a * (x - b)) / (1 + exp(a * (x - b)))}# empirical probabilities calculationdf <- data.frame(  x = sort(unique(zscore)),  y = tapply(data[, 1], zscore, mean),  size = as.numeric(table(zscore)))# plot of estimated curveggplot(df, aes(x = x, y = y)) +  geom_point(aes(size = size),    color = "darkblue",    fill = "darkblue",    shape = 21, alpha = 0.5  ) +  stat_function(    fun = fun, geom = "line",    args = list(      a = coef[1],      b = coef[2]    ),    size = 1,    color = "darkblue"  ) +  xlab("Standardized total score") +  ylab("Probability of correct answer") +  ylim(0, 1) +  ggtitle("Item 1") +  theme_app()

### Nonlinear three parameter regression on standardized total scores with IRT parameterization

Various regression models may be fitted to describe item properties in more detail. Nonlinear regression can model dependency of probability of correctly answering item $$i$$ by respondent $$p$$ on their standardized total score $$Z_p$$ (Z-score) by S-shaped logistic curve. The IRT parametrization used here corresponds to the parametrization used in IRT models. Parameter $$b_{i}$$ describes horizontal position of the fitted curve (difficulty) and parameter $$a_{i}$$ describes its slope at inflection point (discrimination). This model allows for nonzero lower left asymptote $$c_i$$ (pseudo-guessing parameter).

#### Plot with estimated nonlinear curve

Points represent proportion of correct answers with respect to standardized total score. Their size is determined by count of respondents who achieved given level of standardized total score.

#### Equation

$$\mathrm{P}(Y_{pi} = 1|Z_p) = \mathrm{E}(Y_{pi}|Z_p) = c_i + \left(1 - c_i\right) \cdot \frac{e^{a_i\left(Z_p - b_i\right)}}{1 + e^{a_i\left(Z_p - b_i\right)}}$$

#### Selected R code

library(difNLR)library(ggplot2)# loading datadata(GMAT, package = "difNLR")data <- GMAT[, 1:20]zscore <- scale(rowSums(data)) # standardized total score# NLR 3P model for item 1fun <- function(x, a, b, c) {  c + (1 - c) * exp(a * (x - b)) / (1 + exp(a * (x - b)))}fit <- nls(data[, 1] ~ fun(zscore, a, b, c),  algorithm = "port",  start = startNLR(    data, GMAT[, "group"],    model = "3PLcg",    parameterization = "classic"  )[[1]][1:3],  lower = c(-Inf, -Inf, 0),  upper = c(Inf, Inf, 1))# coefficientscoef(fit)# empirical probabilities calculationdf <- data.frame(  x = sort(unique(zscore)),  y = tapply(data[, 1], zscore, mean),  size = as.numeric(table(zscore)))# plot of estimated curveggplot(df, aes(x = x, y = y)) +  geom_point(aes(size = size),    color = "darkblue",    fill = "darkblue",    shape = 21, alpha = 0.5  ) +  stat_function(    fun = fun, geom = "line",    args = list(      a = coef(fit)[1],      b = coef(fit)[2],      c = coef(fit)[3]    ),    size = 1,    color = "darkblue"  ) +  xlab("Standardized total score") +  ylab("Probability of correct answer") +  ylim(0, 1) +  ggtitle("Item 1") +  theme_app()

### Nonlinear four parameter regression on standardized total scores with IRT parameterization

Various regression models may be fitted to describe item properties in more detail. Nonlinear regression can model dependency of probability of correctly answering item $$i$$ by respondent $$p$$ on their standardized total score $$Z_p$$ (Z-score) by S-shaped logistic curve. The IRT parametrization used here corresponds to the parametrization used in IRT models. Parameter $$b_{i}$$ describes horizontal position of the fitted curve (difficulty), parameter $$a_{i}$$ describes its slope at inflection point (discrimination), pseudo-guessing parameter $$c_i$$ describes its lower asymptote and inattention parameter $$d_i$$ describes its upper asymptote.

#### Plot with estimated nonlinear curve

Points represent proportion of correct answers with respect to standardized total score. Their size is determined by count of respondents who achieved given level of standardized total score.

#### Equation

$$\mathrm{P}(Y_{pi} = 1|Z_p) = \mathrm{E}(Y_{pi}|Z_p) = c_i + \left(d_i - c_i\right) \cdot \frac{e^{a_i\left(Z_p - b_i\right)}}{1 + e^{a_i\left(Z_p - b_i\right)}}$$

#### Selected R code

library(difNLR)library(ggplot2)# loading datadata(GMAT, package = "difNLR")data <- GMAT[, 1:20]zscore <- scale(rowSums(data)) # standardized total score# NLR 4P model for item 1fun <- function(x, a, b, c, d) {  c + (d - c) * exp(a * (x - b)) / (1 + exp(a * (x - b)))}fit <- nls(data[, 1] ~ fun(zscore, a, b, c, d),  algorithm = "port",  start = startNLR(    data, GMAT[, "group"],    model = "4PLcgdg",    parameterization = "classic"  )[[1]][1:4],  lower = c(-Inf, -Inf, 0, 0),  upper = c(Inf, Inf, 1, 1))# coefficientscoef(fit)# empirical probabilities calculationdf <- data.frame(  x = sort(unique(zscore)),  y = tapply(data[, 1], zscore, mean),  size = as.numeric(table(zscore)))# plot of estimated curveggplot(df, aes(x = x, y = y)) +  geom_point(aes(size = size),    color = "darkblue",    fill = "darkblue",    shape = 21, alpha = 0.5  ) +  stat_function(    fun = fun, geom = "line",    args = list(      a = coef(fit)[1],      b = coef(fit)[2],      c = coef(fit)[3],      d = coef(fit)[4]    ),    size = 1,    color = "darkblue"  ) +  xlab("Standardized total score") +  ylab("Probability of correct answer") +  ylim(0, 1) +  ggtitle("Item 1") +  theme_app()

### Logistic regression model selection

Here you can compare classic 2PL logistic regression model to non-linear models item by item using some information criteria:

• AIC is the Akaike information criterion (Akaike, 1974),
• BIC is the Bayesian information criterion (Schwarz, 1978)

#### Table of comparison statistics

Rows BEST indicate which model has the lowest value of given information criterion.

#### Selected R code

library(difNLR)# loading datadata(GMAT, package = "difNLR")Data <- GMAT[, 1:20]zscore <- scale(rowSums(Data)) # standardized total score# function for fitting modelsfun <- function(x, a, b, c, d) {  c + (d - c) * exp(a * (x - b)) / (1 + exp(a * (x - b)))}# starting values for item 1start <- startNLR(Data, GMAT[, "group"], model = "4PLcgdg", parameterization = "classic")[[1]][, 1:4]# 2PL model for item 1fit2PL <- nls(Data[, 1] ~ fun(zscore, a, b, c = 0, d = 1),  algorithm = "port",  start = start[1:2])# NLR 3P model for item 1fit3PL <- nls(Data[, 1] ~ fun(zscore, a, b, c, d = 1),  algorithm = "port",  start = start[1:3],  lower = c(-Inf, -Inf, 0),  upper = c(Inf, Inf, 1))# NLR 4P model for item 1fit4PL <- nls(Data[, 1] ~ fun(zscore, a, b, c, d),  algorithm = "port",  start = start,  lower = c(-Inf, -Inf, 0, 0),  upper = c(Inf, Inf, 1, 1))# comparison### AICAIC(fit2PL)AIC(fit3PL)AIC(fit4PL)### BICBIC(fit2PL)BIC(fit3PL)BIC(fit4PL)

### Cumulative logit regression

Various regression models may be fitted to describe item properties in more detail. Cumulative logit regression can model cumulative probabilities, i.e., probabilities to obtain item score higher than or equal to 1, 2, 3, etc.

Cumulative logit model can be fitted on selected matching criterion - total scores or standardized scores, using classical (intercept/slope) or IRT parametrization.

#### Plot of cumulative probabilities

Lines determine the cumulative probabilities $$\mathrm{P}(Y_{pi} \geq k)$$. Circles represent proportion of answers with at least $$k$$ points with respect to the matching criterion, i.e., the empirical cumulative probabilities. The size of the points is determined by the count of respondents who achieved given level of the matching criterion.

#### Plot of category probabilities

Lines determine the category probabilities $$\mathrm{P}(Y_{pi} = k)$$. Circles represent proportion of answers with $$k$$ points with respect to the matching criterion, i.e., the empirical category probabilities. The size of the points is determined by the count of respondents who achieved given level of the matching criterion.

#### Selected R code

library(ShinyItemAnalysis)library(VGAM)# loading datadata(Science, package = "mirt")# total score calculationscore <- rowSums(Science)Science[, 1] <- factor(Science[, 1], levels = sort(unique(Science[, 1])), ordered = TRUE)# cumulative logit model for item 1fit <- vglm(Science[, 1] ~ score, family = cumulative(reverse = TRUE, parallel = TRUE))# coefficients for item 1coef(fit)# plotting cumulative probabilitiesplotCumulative(fit, type = "cumulative", matching.name = "Total score")# plotting category probabilitiesplotCumulative(fit, type = "category", matching.name = "Total score")

Models for ordinal responses need not use cumulative probabilities. Adjacent categories model assumes linear form of logarithm of ratio of probabilities of two successive scores (e.g., 1 vs. 2, 2 vs. 3, etc.), i.e., of the adjacent category logits.

Adjacent category logit model can be fitted on selected matching criterion - total scores or standardized scores, using classical (intercept/slope) or IRT parametrization.

#### Plot with category probabilities

Lines determine the category probabilities $$\mathrm{P}(Y_{pi} = k)$$. Circles represent the proportion of answers with $$k$$ points with respect to the total score, i.e., the empirical category probabilities. The size of the circles is determined by the count of respondents who achieved given level of the total score.

#### Selected R code

library(ShinyItemAnalysis)library(VGAM)# loading datadata(Science, package = "mirt")# total score calculationscore <- rowSums(Science)Science[, 1] <- factor(Science[, 1], levels = sort(unique(Science[, 1])), ordered = TRUE)# adjacent category logit model for item 1fit <- vglm(Science[, 1] ~ score, family = acat(reverse = FALSE, parallel = TRUE))# coefficients for item 1coef(fit)# plotting category probabilitiesplotAdjacent(fit, matching.name = "Total score")

### Multinomial regression on standardized total scores

Various regression models may be fitted to describe item properties in more detail. Multinomial regression allows for simultaneous modelling of probability of choosing given distractors on selected matching criterion - total scores or standardized scores, using classical (intercept/slope) or IRT parametrization.

#### Plot with estimated curves of multinomial regression

Points represent proportion of selected option with respect to the matching criterion. Their size is determined by count of respondents who achieved given level of the matching criterion and who selected given option.

#### Selected R code

library(nnet)library(ShinyItemAnalysis)# loading datadata(GMAT, GMATtest, GMATkey, package = "difNLR")zscore <- scale(rowSums(GMAT[, 1:20])) # standardized total score# multinomial model for item 1fit <- multinom(relevel(GMATtest[, 1], ref = paste(GMATkey[1])) ~ zscore)# coefficientscoef(fit)# plot for item 1plotMultinomial(fit, zscore, matching.name = "Z-score")

### Rasch model

Item Response Theory (IRT) models are mixed-effect regression models in which respondent ability $$\theta_p$$ is assumed to be latent and is estimated together with item paramters.

In Rasch model (Rasch, 1960), all items are assumed to have the same slope in inflection point while they may differ in location of the item characteristic curves and their inflection points. Model parameters are estimated using marginal maximum likelihood method. Ability $$\theta_p$$ of respondent $$p$$ is assumed to follow normal distribution with freely estimated variance.

#### Equations

Item characteristic function $$\pi_{pi} = \mathrm{P}\left(Y_{pi} = 1\vert \theta_{p}\right)$$ describes probability of correct answer for given item $$i$$. Item information function $$\mathrm{I}_i(\theta_p)$$ describes how well item discriminates from two nearby ability levels, i.e., how much information it provides for the given ability. Test information function $$\mathrm{T}(\theta_p)$$ sums up all item informations and thus describes the information of the whole test. The inverse of the test information is standard error (SE) of measurement.

Equation and estimated item parameters can be displayed using the IRT or classical - intercept/slope parametrization.

$$\mathrm{I}_i(\theta_p) = \pi_{pi} (1 - \pi_{pi})$$ $$\mathrm{T}(\theta_p) = \sum_{i = 1}^m \mathrm{I}_i(\theta_p) = \sum_{i = 1}^m \pi_{pi} (1 - \pi_{pi})$$

#### Table of estimated parameters

Estimates of item parameters can be displayed using the IRT or classical - intercept/slope parametrization, which can be selected at the top of this tab. Parameter estimates are completed by SX2 item fit statistics (Orlando & Thissen, 2000). SX2 statistics are computed only when no missing data are present.

#### Ability estimates

This table shows the response and factor scores of only six respondents. If you want to see scores for all respondents, click on Download abilities button.

#### Wright map

Wright map (Wilson, 2005; Wright & Stone, 1979), also called item-person map, is a graphical tool to display person ability estimates and item parameters. The person side (left) represents histogram of estimated abilities of respondents. The item side (right) displays estimates of difficulty parameters of individual items.

### 2PL IRT model

Item Response Theory (IRT) models are mixed-effect regression models in which respondent ability $$\theta_p$$ is assumed to be latent and is estimated together with item paramters.

Two Parameter Logistic (2PL) IRT model allows for different slopes in inflection point, i.e., different discrimination parameters $$a_i$$. Items can also differ in location of their inflection point, i.e., in item difficulty parameters $$b_i$$. Model parameters are estimated using marginal maximum likelihood method. Ability $$\theta_p$$ is assumed to follow standard normal distribution.

#### Equations

$$\mathrm{P}\left(Y_{pi} = 1\vert \theta_{p}\right) = \pi_{pi} = \frac{e^{a_i\left(\theta_{p} - b_{i}\right)}}{1 + e^{a_i\left(\theta_{p} - b_{i}\right)}}$$ $$\mathrm{I}_i(\theta_p) = a_i^2 \pi_{pi} (1 - \pi_{pi})$$

#### Table of estimated parameters

Estimates of parameters are completed by SX2 item fit statistics (Orlando & Thissen, 2000). SX2 statistics are computed only when no missing data are present.

### 3PL IRT model

Item Response Theory (IRT) models are mixed-effect regression models in which respondent ability $$\theta_p$$ is assumed to be latent and is estimated together with item paramters.

Three Parameter Logistic (3PL) IRT model allows for different discriminations of items $$a_i$$, different item difficulties $$b_i$$ and allows also for nonzero left asymptote, pseudo-guessing $$c_i$$. Model parameters are estimated using marginal maximum likelihood method. Ability $$\theta_p$$ is assumed to follow standard normal distribution.

#### Equations

$$\mathrm{P}\left(Y_{pi} = 1\vert \theta_{p}\right) = \pi_{pi} = c_i + (1 - c_i) \cdot \frac{e^{a_i\left(\theta_{p} - b_{i}\right)}}{1 + e^{a_i\left(\theta_{p} - b_{i}\right)}}$$ $$\mathrm{I}_i(\theta_p) = \frac{a_i^2 (\pi_{pi} - c_i)^2 (1 - \pi_{pi})}{(1 - c_i^2) \pi_{pi}}$$ $$\mathrm{T}(\theta_p) = \sum_{i = 1}^m \mathrm{I}_i(\theta_p) = \sum_{i = 1}^m \frac{a_i^2 (\pi_{pi} - c_i)^2 (1 - \pi_{pi})}{(1 - c_i^2) \pi_{pi}}$$

#### Table of estimated parameters

Estimates of parameters are completed by SX2 item fit statistics (Orlando & Thissen, 2000). SX2 statistics are computed only when no missing data are present.

#### Ability estimates

This table shows the response score of only six respondents. If you want to see scores for all respondents, click on Download abilities button.

### Generalized logistic regression

Generalized logistic regression models are extensions of logistic regression method which account for possibility of guessing by allowing for nonzero lower asymptote - pseudo-guessing $$c_i$$ (Drabinova & Martinkova, 2017) or upper asymptote lower than one - inattention $$d_i$$. Similarly to logistic regression, its extensions also provide detection of uniform and non-uniform DIF by letting the difficulty parameter $$b_i$$ (uniform) and the discrimination parameter $$a_i$$ (non-uniform) differ for groups and by testing for difference in their values. Moreover, these extensions allow for testing differences in pseudo-guessing and inattention parameters and they can be seen as proxies of 3PL and 4PL IRT models for DIF detection.

#### Method specification

Here you can specify the assumed model. In 3PL and 4PL models, the abbreviations $$c_{g}$$ or $$d_{g}$$ mean that parameters $$c_i$$ or $$d_i$$ are assumed to be the same for both groups, otherwise they are allowed to differ. With type you can specify the type of DIF to be tested by choosing the parameters in which difference between groups should be tested. You can also select correction method for multiple comparison or item purification.

Finally, you may change the DIF matching variable. While matching on standardized total score is typical, upload of other DIF matching variable is possible in section Data. Using a pre-test (standardized) total score allows for testing differential item functioning in change (DIF-C) to provide proofs of instructional sensitivity (Martinkova et al., 2020), also see Learning To Learn 9 toy dataset.

#### Equation

Displayed equation is based on model selected below

#### Summary table

Summary table contains information about DIF test statistic $$LR(\chi^2)$$, corresponding $$p$$-values considering selected adjustement, and significance codes. Table also provides estimated parameters for the best fitted model for each item. Note that $$a_{iG_p}$$ (and also other parameters) from the equation above consists of parameter for the reference group and parameter for the difference between focal and reference groups, i.e., $$a_{iG_p} = a_{i} + a_{iDif}G_{p}$$, where $$G_{p} = 0$$ for the reference group and $$G_{p} = 1$$ for the focal group, as stated in the table below.

#### Selected R code

library(difNLR)# Loading datadata(GMAT, package = "difNLR")Data <- GMAT[, 1:20]group <- GMAT[, "group"]# Generalized logistic regression DIF method# using 3PL model with the same guessing parameter for both groups(fit <- difNLR(Data = Data, group = group, focal.name = 1, model = "3PLcg", match = "zscore", type = "all", p.adjust.method = "none", purify = FALSE))# Loading datadata(LearningToLearn, package = "ShinyItemAnalysis")Data <- LearningToLearn[, 87:94]        # item responses from Grade 9 from subscale 6group <- LearningToLearn$track # school track - group membership variablematch <- scale(LearningToLearn$score_6) # standardized test score from Grade 6# Detecting differential item functioning in change (DIF-C) using# generalized logistic regression DIF method with 3PL model# with the same guessing parameter for both groups# and standardized total score from Grade 6 as matching criterion(fit <- difNLR(Data = Data, group = group, focal.name = "AS", model = "3PLc", match = match, type = "all", p.adjust.method = "none", purify = FALSE))

### Generalized logistic regression

Generalized logistic regression models are extensions of logistic regression method which account for possibility of guessing by allowing for nonzero lower asymptote - pseudo-guessing $$c_i$$ (Drabinova & Martinkova, 2017) or upper asymptote lower than one - inattention $$d_i$$. Similarly to logistic regression, its extensions also provide detection of uniform and non-uniform DIF by letting the difficulty parameter $$b_i$$ (uniform) and the discrimination parameter $$a_i$$ (non-uniform) differ for groups and by testing for difference in their values. Moreover, these extensions allow for testing differences in pseudo-guessing and inattention parameters and they can be seen as proxies of 3PL and 4PL IRT models for DIF detection.

#### Method specification

Here you can specify the assumed model. In 3PL and 4PL models, the abbreviations $$c_{g}$$ or $$d_{g}$$ mean that parameters $$c$$ or $$d$$ are assumed to be the same for both groups, otherwise they are allowed to differ. With type you can specify the type of DIF to be tested by choosing the parameters in which difference between groups should be tested. You can also select correction method for multiple comparison or item purification.

Finally, you may change the DIF matching variable. While matching on standardized total score is typical, upload of other DIF matching variable is possible in section Data. Using a pre-test (standardized) total score allows for testing differential item functioning in change (DIF-C) to provide proofs of instructional sensitivity (Martinkova et al., 2020), also see Learning To Learn 9 toy dataset. For selected item you can display plot of its characteristic curves and table of its estimated parameters with standard errors.

#### Plot with estimated DIF generalized logistic curve

Points represent proportion of correct answer (empirical probabilities) with respect to the DIF matching variable. Their size is determined by count of respondents who achieved given level of DIF matching variable with respect to the group membership.

#### Table of parameters

Table summarizes estimated item parameters together with standard errors. Note that $$a_{iG_p}$$ (and also other parameters) from the equation above consists of parameter for the reference group and parameter for the difference between focal and reference groups, i.e., $$a_{iG_p} = a_{i} + a_{iDif}G_{p}$$, where $$G_{p} = 0$$ for the reference group and $$G_{p} = 1$$ for the focal group, as stated in the table below.

#### Selected R code

library(difNLR)# Loading datadata(GMAT, package = "difNLR")Data <- GMAT[, 1:20]group <- GMAT[, "group"]# Generalized logistic regression DIF method# using 3PL model with the same guessing parameter for both groups(fit <- difNLR(Data = Data, group = group, focal.name = 1, model = "3PLcg", match = "zscore", type = "all", p.adjust.method = "none", purify = FALSE))# Plot of characteristic curve of item 1plot(fit, item = 1)# Estimated coefficients for item 1 with standard errorscoef(fit, SE = TRUE)

### Lord test for IRT models

To detect DIF, Lord test (Lord, 1980) compares item parameters of selected IRT model, fitted separately on data of the two groups. Model is either 1PL, 2PL, or 3PL with guessing which is the same for the two groups. In case of 3PL model, the guessing parameter is estimated based on the whole dataset and is subsequently considered fixed. In statistical terms, Lord statistic is equal to Wald statistic.

#### Method specification

Here you can choose underlying IRT model used to test DIF. You can also select correction method for multiple comparison, and/or item purification.

#### Summary table

Summary table contains information about Lord's $$\chi^2$$-statistics, corresponding $$p$$-values considering selected adjustement, and significance codes. Table also provides estimated parameters for both groups. Note that item parameters might slightly differ even for non-DIF items as two seperate models are fitted, however this difference is non-significant. Also note that under the 3PL model, the guessing parameter $$c$$ is estimated from the whole dataset, and is considered fixed in the final models, thus no standard error is displayed.

#### Selected R code

library(difR)library(ltm)# Loading datadata(GMAT, package = "difNLR")Data <- GMAT[, 1:20]group <- GMAT[, "group"]# 1PL IRT MODEL(fit1PL <- difLord(Data = Data, group = group, focal.name = 1, model = "1PL", p.adjust.method = "none", purify = FALSE))# 2PL IRT MODEL(fit2PL <- difLord(Data = Data, group = group, focal.name = 1, model = "2PL", p.adjust.method = "none", purify = FALSE))# 3PL IRT MODEL with the same guessing for groupsguess <- itemParEst(Data, model = "3PL")[, 3](fit3PL <- difLord(Data = Data, group = group, focal.name = 1, model = "3PL", c = guess, p.adjust.method = "none", purify = FALSE))

### Lord test for IRT models

To detect DIF, Lord test (Lord, 1980) compares item parameters of selected IRT model, fitted separately on data of the two groups. Model is either 1PL, 2PL, or 3PL with guessing which is the same for the two groups. In case of 3PL model, the guessing parameter is estimated based on the whole dataset and is subsequently considered fixed. In statistical terms, Lord statistic is equal to Wald statistic.

#### Method specification

Here you can choose underlying IRT model used to test DIF. You can also select correction method for multiple comparison, and/or item purification. For selected item you can display plot of its characteristic curves and table of its estimated parameters with standard errors.

#### Plot with estimated DIF characteristic curve

Note that plots might slightly differ even for non-DIF items as two seperate models are fitted, however this difference is non-significant.

#### Table of parameters

Table summarizes estimated item parameters together with standard errors. Note that item parameters might slightly differ even for non-DIF items as two seperate models are fitted, however this difference is non-significant. Also note that under the 3PL model, the guessing parameter $$c$$ is estimated from the whole dataset, and is considered fixed in the final models, thus no standard error is displayed.

### SIBTEST

The SIBTEST method (Shealy & Stout, 1993) allows for detection of uniform DIF without requiring an item response model. Its modified version, the Crossing-SIBTEST (Chalmers, 2018; Li & Stout, 1996), focuses on detection of non-uniform DIF.

#### Method specification

Here you can choose type of DIF to test. With uniform DIF, SIBTEST is applied, while with non-uniform DIF, the Crossing-SIBTEST method is used instead. You can also select correction method for multiple comparison or item purification.

#### Summary table

Summary table contains estimates of $$\beta$$ together with standard errors (only available when testing uniform DIF), corresponding $$\chi^2$$-statistics with $$p$$-values considering selected adjustement, and significance codes.

#### Selected code

library(difR)# Loading datadata(GMAT, package = "difNLR")Data <- GMAT[, 1:20]group <- GMAT[, "group"]# SIBTEST (uniform DIF)(fit_udif <- difSIBTEST(Data = Data, group = group, focal.name = 1, type = "udif", p.adjust.method = "none", purify = FALSE))# Crossing-SIBTEST (non-uniform DIF)(fit_nudif <- difSIBTEST(Data = Data, group = group, focal.name = 1, type = "nudif", p.adjust.method = "none", purify = FALSE))

### Method comparison

Here you can compare all offered DIF detection methods. In the table below, columns represent DIF detection methods, and rows represent item number. If the method detects item as DIF, value 1 is assigned to that item, otherwise 0 is assigned. In case that any method fail to converge or cannot be fitted, NA is displayed instead of 0/1 values. Available methods:

• Delta is delta plot method (Angoff & Ford, 1973; Magis & Facon, 2012),
• MH is Mantel-Haenszel test (Mantel & Haenszel, 1959),
• LR is logistic regression (Swaminathan & Rogers, 1990),
• NLR is generalized (non-linear) logistic regression (Drabinova & Martinkova, 2017),
• LORD is Lord chi-square test (Lord, 1980),
• RAJU is Raju area method (Raju, 1990),
• SIBTEST is SIBTEST (Shealy & Stout, 1993) and crossing-SIBTEST method (Chalmers, 2018; Li & Stout, 1996).

### Table with method comparison

Settings for individual methods (DIF matching criterion, type of DIF to be tested, correction method, item purification) are taken from subsection pages of given methods. In case your settings are not unified, you can set some of them below. Note that changing the options globaly can be computationaly demanding. This especially applies for purification request. To see the complete setting of all analyses, please refer to the note below the table. The last column shows how many methods detect certain item as DIF. The last row shows how many items are detected as DIF by a certain method.

### Cumulative logit regression model for DIF detection

Cumulative logit regression allows for detection of uniform and non-uniform DIF among ordinal data by adding a group specific intercept $$b_{i2}$$ (uniform DIF) and interaction $$b_{i3}$$ between group and DIF matching variable (non-uniform DIF) into model for item $$i$$ and by testing for their significance.

#### Method specification

Here you can change DIF matching variable and choose type of DIF to be tested. You can also select correction method for multiple comparison or item purification.

#### Equation

The probability that person $$p$$ with DIF matching variable (e.g., standardized total score) $$Z_p$$ and group membership $$G_p$$ obtained at least $$k$$ points in item $$i$$ is given by the following equation:

The probability that person $$p$$ with DIF matching variable (e.g., standardized total score) $$Z_p$$ and group membership $$G_p$$ obtained exactly $$k$$ points in item $$i$$ is then given as differnce between probabilities of obtaining at least $$k$$ and $$k + 1$$ points:

#### Summary table

Summary table contains information about $$\chi^2$$-statistics, corresponding $$p$$-values considering selected adjustement, and significance codes. Table also provides estimated parameters for the best fitted model for each item.

#### Selected R code

library(difNLR)# Loading datadata(dataMedicalgraded, package = "ShinyItemAnalysis")Data <- dataMedicalgraded[, 1:100]group <- dataMedicalgraded[, 101]# DIF with cumulative logit regression model(fit <- difORD(Data = Data, group = group, focal.name = 1, model = "cumulative",               type = "both", match = "zscore", p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))

### Cumulative logit regression model for DIF detection

Cumulative logit regression allows for detection of uniform and non-uniform DIF among ordinal data by adding a group specific intercept $$b_{i2}$$ (uniform DIF) and interaction $$b_{i3}$$ between group and DIF matching variable (non-uniform DIF) into model for item $$i$$ and by testing for their significance.

#### Method specification

Here you can change DIF matching variable and choose type of DIF to be tested. You can also select correction method for multiple comparison or item purification. For selected item you can display plot of its characteristic curves and table of its estimated parameters with standard errors.

#### Plot with estimated DIF curves

Points represent proportion of obtained score with respect to DIF matching variable. Their size is determined by count of respondents who achieved given level of DIF matching variable and who selected given option with respect to the group membership.

#### Table of parameters

Table summarizes estimated item parameters together with standard errors.

#### Selected R code

library(difNLR)# Loading datadata(dataMedicalgraded, package = "ShinyItemAnalysis")Data <- dataMedicalgraded[, 1:100]group <- dataMedicalgraded[, 101]# DIF with cumulative logit regression model(fit <- difORD(Data = Data, group = group, focal.name = 1, model = "cumulative",               type = "both", match = "zscore", p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))# Plot of characteristic curves for item X2003, cumulative probabilitiesplot(fit, item = "X2003", plot.type = "cumulative")# Plot of characteristic curves for item X2003, category probabilitiesplot(fit, item = "X2003", plot.type = "category")# Estimated coefficients for all items with standard errorscoef(fit, SE = TRUE)

### Adjacent category logit regression model for DIF detection

Adjacent category logit regression model allows for detection of uniform and non-uniform DIF among ordinal data by adding a group specific intercept $$b_{i2}$$ (uniform DIF) and interaction $$b_{i3}$$ between group and DIF matching variable (non-uniform DIF) into model for item $$i$$ and by testing for their significance.

#### Method specification

Here you can change DIF matching variable and choose type of DIF to be tested. You can also select correction method for multiple comparison or item purification.

#### Equation

The probability that person $$p$$ with DIF matching variable (e.g., standardized total score) $$Z_p$$ and group membership $$G_p$$ obtained $$k$$ points in item $$i$$ is given by the following equation:

#### Summary table

Summary table contains information about $$\chi^2$$-statistics, corresponding $$p$$-values considering selected adjustement, and significance codes. Table also provides estimated parameters for the best fitted model for each item.

#### Selected R code

library(difNLR)# Loading datadata(dataMedicalgraded, package = "ShinyItemAnalysis")Data <- dataMedicalgraded[, 1:100]group <- dataMedicalgraded[, 101]# DIF with cumulative logit regression model(fit <- difORD(Data = Data, group = group, focal.name = 1, model = "adjacent",                type = "both", match = "zscore", p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))

### Adjacent category logit regression model for DIF detection

Adjacent category logit regression model allows for detection of uniform and non-uniform DIF among ordinal data by adding a group specific intercept $$b_{i2}$$ (uniform DIF) and interaction $$b_{i3}$$ between group and DIF matching variable (non-uniform DIF) into model for item $$i$$ and by testing for their significance.

#### Method specification

Here you can change DIF matching variable and choose type of DIF to be tested. You can also select correction method for multiple comparison or item purification. For selected item you can display plot of its characteristic curves and table of its estimated parameters with standard errors.

#### Plot with estimated DIF curves

Points represent proportion of obtained score with respect to DIF matching variable. Their size is determined by count of respondents who achieved given level of DIF matching variable and who selected given option with respect to the group membership.

#### Table of parameters

Table summarizes estimated item parameters together with standard errors.

#### Selected R code

library(difNLR)# Loading datadata(dataMedicalgraded, package = "ShinyItemAnalysis")Data <- dataMedicalgraded[, 1:100]group <- dataMedicalgraded[, 101]# DIF with cumulative logit regression model(fit <- difORD(Data = Data, group = group, focal.name = 1, model = "cumulative",                type = "both", match = "zscore", p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))# Plot of characteristic curves for item X2003plot(fit, item = "X2003")# Estimated coefficients for all items with standard errorscoef(fit, SE = TRUE)

### Multinomial regression model for DDF detection

Differential Distractor Functioning (DDF) occurs when people from different groups but with the same knowledge have different probability of selecting at least one distractor choice. DDF is here examined by multinomial log-linear regression model with Z-score and group membership as covariates.

#### Method specification

Here you can change DFF matching variable and choose type of DDF to be tested. You can also select correction method for multiple comparison or item purification.

#### Equation

For $$K_i$$ possible test choices is the probability of the correct answer $$K_i$$ for person $$p$$ with DIF matching variable (e.g., standardized total score) $$Z_p$$ and group membership $$G_p$$ in item $$i$$ given by the following equation:

$$\mathrm{P}(Y_{ip} = K_i|Z_p, G_p) = \frac{1}{1 + \sum_l e^{\left( b_{il0} + b_{il1} Z_p + b_{il2} G_p + b_{il3} Z_p:G_p\right)}}$$

The probability of choosing distractor $$k$$ is then given by:

$$\mathrm{P}(Y_{ip} = k|Z_p, G_p) = \frac{e^{\left( b_{ik0} + b_{ik1} Z_p + b_{ik2} G_p + b_{ik3} Z_p:G_p\right)}} {1 + \sum_l e^{\left( b_{il0} + b_{il1} Z_p + b_{il2} G_p + b_{il3} Z_p:G_p\right)}}$$

#### Summary table

Summary table contains information about $$\chi^2$$-statistics, corresponding $$p$$-values considering selected adjustement, and significance codes.

#### Summary table - item parameters

Table provides estimated parameters for the fitted model for each item and distractor (incorrect option).

#### Selected R code

library(difNLR)# Loading datadata(GMATtest, GMATkey, package = "difNLR")Data <- GMATtest[, 1:20]group <- GMATtest[, "group"]key <- GMATkey# DDF with multinomial  regression model(fit <- ddfMLR(Data, group, focal.name = 1, key, type = "both", match = "zscore",                p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))

### Multinomial regression model for DDF detection

Differential Distractor Functioning (DDF) occurs when people from different groups but with the same knowledge have different probability of selecting at least one distractor choice. DDF is here examined by Multinomial Log-linear Regression model with Z-score and group membership as covariates.

#### Method specification

Here you can change DDF matching variable and choose type of DDF to be tested. You can also select correction method for multiple comparison or item purification. For selected item you can display plot of its characteristic curves and table of its estimated parameters with standard errors.

#### Plot with estimated DDF curves

Points represent proportion of selected answer with respect to DIF matching variable. Their size is determined by count of respondents who achieved given level of DIF matching variable and who selected given option with respect to the group membership.

#### Table of parameters

Table summarizes estimated item parameters together with standard errors.

#### Selected R code

library(difNLR)# Loading datadata(GMATtest, GMATkey, package = "difNLR")Data <- GMATtest[, 1:20]group <- GMATtest[, "group"]key <- GMATkey# DDF with multinomial  regression model(fit <- ddfMLR(Data, group, focal.name = 1, key, type = "both", match = "zscore",                p.adjust.method = "none", purify = FALSE,               parametrization = "classic"))# Plot of characteristic curves for item 1plot(fit, item = 1)# Estimated coefficients for all items with standard errorscoef(fit, SE = TRUE)

### DIF training

In this section, you can explore differential item functioning for two groups - reference and focal.

#### Parameters

Select parameters $$a$$ (discrimination) and $$b$$ (difficulty) for an item given by 2PL IRT model for reference and focal group. When parameters for reference and focal group differ, we can observe phenomenon of differential item functioning.

Select also the value of latent ability $$\theta$$ to see the interpretation of the item characteristic curves.

#### Exercise 1

Consider item following 2PL model with the following parameters

Reference group: $$a_R = 1, b_R = 0$$

Focal group: $$a_F = 1, b_F = 1$$

For this item, fill in the following exercises with an accuracy of up to 0.05. Then click on Submit answers button. If you need a hint, click on blue button with question mark.

• Sketch item characteristic curves for both groups.
• What type of DIF is displayed?
• What are the probabilities of correct answer for latent abilities $$\theta = -2, 0, 2$$ for reference and focal group?
Reference:
Focal:
• Which group is favored?

#### Exercise 2

Consider item following 2PL model with the following parameters

Reference group: $$a_R = 0.8, b_R = -0.5$$

Focal group: $$a_F = 1.5, b_F = 1$$

For this item fill in the following exercises with an accuracy of up to 0.05. Then click on Submit answers button. If you need a hint, click on blue button with question mark.

• Sketch item characteristic curves for both groups.
• What type of DIF is displayed?
• What are the probabilities of correct answer for latent abilities $$\theta = -1, 0, 1$$ for reference and focal group?
Reference:
Focal:
• Which group is favored?

### Corrections for multiple comparisons

#### Settings of report

ShinyItemAnalysis offers an option to download a report in HTML or PDF format. PDF report creation requires latest version of MiKTeX (or other TeX distribution). If you don't have the latest installation, please, use the HTML report.

There is an option to use customized settings. When checking the Customize settings local settings will be offered and used for each selected section of the report. Otherwise, the settings will be taken from sections of the application. You may also include your name into the report, as well as the name of analyzed dataset.

#### Content of report

Reports by default contain summary of total scores, table of standard scores, item analysis, distractor plots for each item and multinomial regression plots for each item. Other analyses can be selected below.

Validity

Difficulty/discrimination plot

Distractors plots

DIF method selection

Delta plot settings

Mantel-Haenszel test settings

Logistic regression settings

Multinomial regression settings

Recommendation: Report generation can be faster and more reliable when you first check sections of intended contents. For example, if you wish to include a 3PL IRT model, you can first visit IRT models section and 3PL subsection.

### Welcome

Welcome to ShinyItemAnalysis!

ShinyItemAnalysis is an interactive online application for psychometric analysis of educational and other psychological tests and their items, built on R and shiny. You can simply start using the application by choosing toy dataset (or upload your own one) in section Data and run analysis including:

• Exploration of total and standard scores in Summary section
• Analysis of measurement error in Reliability section
• Correlation structure and criterion validity analysis in Validity section
• Item and distractor analysis in Item analysis section
• Item analysis with regression models in Regression section
• Item analysis by item response theory models in IRT models section
• Differential item functioning (DIF) and differential distractor functioning (DDF) methods in DIF/Fairness section

All graphical outputs and selected tables can be downloaded via download button. Moreover, you can automatically generate HTML or PDF report in Reports section. All offered analyses are complemented by selected R code which is ready to be copy-pasted into your R console, hence a similar analysis can be run and modified in R.

#### Availability

It is also available online at Czech Academy of Sciences and shinyapps.io .

#### Versions

Current CRAN version is 1.3.4.
Version available online is 1.3.4-1.
The newest development version available on GitHub is 1.3.4-1.

#### Feedback

If you discover a problem with this application please contact the project maintainer at martinkova(at)cs.cas.cz or use GitHub. We also encourage you to provide your feedback using Google form.

This program is free software and you can redistribute it and or modify it under the terms of the GNU GPL 3 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability of fitness for a particular purpose.

To cite ShinyItemAnalysis in publications, please use:

Martinkova P., & Drabinova A. (2018).
ShinyItemAnalysis for teaching psychometrics and to enforce routine analysis of educational tests.
The R Journal, 10(2), 503-515. doi: 10.32614/RJ-2018-074

#### Acknowledgments

Project was supported by Czech Science Foundation grant GJ15-15856Y 'Estimation of psychometric measures as part of admission test development' and by Charles University under project PRIMUS/17/HUM/11 'Center for Educational Measurement and Psychometrics (CEMP)'.

### R packages

• cowplot Claus O. Wilke (2018). cowplot: Streamlined Plot Theme and Plot Annotations for "ggplot2". R package version 0.9.3. See online.
• data.table Dowle, M. & Srinivasan, A. (2019). data.table: Extension of "data.frame". R package version 1.12.8. See online.
• deltaPlotR Magis, D. & Facon, B. (2014). deltaPlotR: An R Package for Differential Item Functioning Analysis with Angoffs Delta Plot. Journal of Statistical Software, Code Snippets, 59(1), 1-19. See online.
• difNLR Hladka, A., Martinkova, P. (2020). difNLR: Generalized Logistic Regression Models for DIF and DDF Detection. The R Journal, 12(1), 300-323. See online.
• difR Magis, D., Beland, S., Tuerlinckx, F. & De Boeck, P. (2010). A general framework and an R package for the detection of dichotomous differential item functioning. Behavior Research Methods, 42847-862.
• DT Xie, Y., Cheng, J. & Tan, X. (2019). DT: A Wrapper of the JavaScript Library "DataTables". R package version 0.10. See online.
• ggdendro de Vries, A. & Ripley, B.D. (2016). ggdendro: Create Dendrograms and Tree Diagrams Using "ggplot2". R package version 0.1-20. See online.
• ggplot2 Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis. See online.
• gridExtra Auguie, B. (2017). gridExtra: Miscellaneous Functions for "Grid" Graphics. R package version 2.3. See online.
• knitr Xie, Y. (2019). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.26. See online.
• latticeExtra Sarkar, D. & Andrews, F. (2016). latticeExtra: Extra Graphical Utilities Based on Lattice. R package version 0.6-28. See online.
• ltm Rizopoulos, D. (2006). ltm: An R package for Latent Variable Modelling and Item Response Theory Analyses. Journal of Statistical Software, 17(5), 1-25. See online.
• mirt Chalmers, R. & Chalmers, P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29.
• moments Komsta, L. & Novomestky, F. (2015). moments: Moments, cumulants, skewness, kurtosis and related tests. R package version 0.14. See online.
• msm Jackson, C. & Jackson, H. (2011). Multi-State Models for Panel Data: The msm Package for R. Journal of Statistical Software, 38(8), 1-29. See online.
• nnet Venables, C. & Ripley, C. (2002). Modern Applied Statistics with S. See online.
• plotly Sievert, C., Parmer, C., Hocking, T., Chamberlain, S., Ram, K., Corvellec, M. & Despouy, P. (2017). plotly: Create Interactive Web Graphics via "plotly.js". R package version 4.9.1. See online.
• psych Revelle, W. (2018). psych: Procedures for Psychological, Psychometric, and Personality Research. R package version 1.8.12. See online.
• psychometric Fletcher, T. & Fletcher, D. (2010). psychometric: Applied Psychometric Theory. R package version 2.2. See online.
• reshape2 Wickham, H. (2007). Reshaping Data with the reshape Package. Journal of Statistical Software, 21(12), 1-20. See online.
• rmarkdown Xie, Y., Allaire, J.J. & Grolemund G. (2018). R Markdown: The Definitive Guide. Chapman and Hall/CRC. ISBN 9781138359338. See online.
• shiny Chang, W., Cheng, J., Allaire, J., Xie, Y. & McPherson, J. (2019). shiny: Web Application Framework for R. R package version 1.4.0. See online.
• shinyBS Bailey, E. (2015). shinyBS: Twitter Bootstrap Components for Shiny. R package version 0.61. See online.
• shinydashboard Chang, W. & Borges Ribeiro, B. (2018). shinydashboard: Create Dashboards with "Shiny". R package version 0.7.1 See online.
• ShinyItemAnalysis Martinkova, P., & Drabinova, A. (2018). ShinyItemAnalysis for teaching psychometrics and to enforce routine analysis of educational tests. The R Journal, 10(2), 503-515. See online.
• shinyjs Attali, D. (2018). shinyjs: Easily Improve the User Experience of Your Shiny Apps in Seconds. R package version 1.0. See online.
• stringr Wickham, H. (2019). stringr: Simple, Consistent Wrappers for Common String Operations. R package version 1.4.0. See online.
• xtable Dahl, D., Scott, D., Roosen, C., Magnusson, A.& Swinton, J. (2019). xtable: Export Tables to LaTeX or HTML. R package version 1.8-4. See online.
• VGAM` Yee, T. W. (2019). VGAM: Vector Generalized Linear and Additive Models. R package version 1.1-2. See online.

### References

• Akaike, H. (1974). A New Look at the Statistical Model Identification. IEEE Transactions on Automatic Control, 19(6), 716-723. See online.
• Ames, A. J., & Penfield, R. D. (2015). An NCME Instructional Module on Item-Fit Statistics for Item Response Theory Models. Educational Measurement: Issues and Practice, 34(3), 39-48. See online.
• Andrich, D. (1978). A Rating Formulation for Ordered Response Categories. Psychometrika, 43(4), 561-573. See online.
• Angoff, W. H., & Ford, S. F. (1973). Item-Race Interaction on a Test of Scholastic Aptitude. Journal of Educational Measurement, 10(2), 95-105. See online.
• Bartholomew, D., Steel, F., Moustaki, I. and Galbraith, J. (2002). The Analysis and Interpretation of Multivariate Data for Social Scientists. London: Chapman and Hall.
• Bock, R. D. (1972). Estimating Item Parameters and Latent Ability when Responses Are Scored in Two or More Nominal Categories. Psychometrika, 37(1), 29-51. See online.
• Brown, W. (1910). Some experimental results in the correlation of mental abilities. British Journal of Psychology, 1904-1920, 3(3), 296-322. See online.
• Chalmers, R. P. (2018). Improving the Crossing-SIBTEST Statistic for Detecting Non-uniform DIF. Psychometrika, 83(2), 376-386. See online.
• Cronbach, L. J. (1951). Coefficient Alpha and the Internal Structure of Tests. Psychometrika, 16(3), 297-334. See online.
• Drabinova, A., & Martinkova, P. (2017). Detection of Differential Item Functioning with Non-Linear Regression: Non-IRT Approach Accounting for Guessing. Journal of Educational Measurement, 54(4), 498-517 See online.
• Feldt, L. S., Woodruff, D. J., & Salih, F. A. (1987). Statistical inference for coefficient alpha. Applied Psychological Measurement 11(1), 93-103. See online.
• Li, H.-H., and Stout, W. (1996). A New Procedure for Detection of Crossing DIF. Psychometrika, 61(4), 647-677. See online.
• Lord, F. M. (1980). Applications of Item Response Theory to Practical Testing Problems. Routledge.
• Magis, D., & Facon, B. (2012). Angoffs Delta Method Revisited: Improving DIF Detection under Small Samples. British Journal of Mathematical and Statistical Psychology, 65(2), 302-321. See online.
• Magis, D., & Facon, B. (2013). Item purification does not always improve DIF detection: a counter-example with Angoffs Delta plot. Educational and Psychological Measurement, 73(2), 293-311. See online.
• Mantel, N., & Haenszel, W. (1959). Statistical Aspects of the Analysis of Data from Retrospective Studies. Journal of the National Cancer Institute, 22(4), 719-748. See online.
• Martinkova, P., Drabinova, A., & Houdek, J. (2017). ShinyItemAnalysis: Analyza Prijimacich a Jinych Znalostnich ci Psychologickych Testu. [ShinyItemAnalysis: Analyzing Admission and Other Educational and Psychological Tests] TESTFORUM, 6(9), 16-35. See online.
• Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking Equity: Why Differential Item Functioning Analysis Should Be a Routine Part of Developing Conceptual Assessments. CBE-Life Sciences Education, 16(2), rm2. See online
• Martinkova, P., Stepanek, L., Drabinova, A., Houdek, J., Vejrazka, M., & Stuka, C. (2017). Semi-real-time Analyses of Item Characteristics for Medical School Admission Tests. In Proceedings of the 2017 Federated Conference on Computer Science and Information Systems, 189-194. See online.
• Martinkova, P., Drabinova, A., & Potuznikova, E. (2020). Is academic tracking related to gains in learning competence? Using propensity score matching and differential item change functioning analysis for better understanding of tracking implications. Learning and Instruction 66(April). See online
• Masters, G. N. (1982). A Rasch model for partial credit scoring. Psychometrika, 47(2), 149-174. See online.
• McFarland, J. L., Price, R. M., Wenderoth, M. P., Martinkova, P., Cliff, W., Michael, J., ... & Wright, A. (2017). Development and Validation of the Homeostasis Concept Inventory. CBE-Life Sciences Education, 16(2), ar35. See online.
• Muraki, E. (1992). A Generalized Partial Credit Model: Application of an EM Algorithm. ETS Research Report Series, 1992(1) See online.
• Orlando, M., & Thissen, D. (2000). Likelihood-based item-fit indices for dichotomous item response theory models. Applied Psychological Measurement, 24(1), 50-64. See online.
• Swaminathan, H., & Rogers, H. J. (1990). Detecting Differential Item Functioning Using Logistic Regression Procedures. Journal of Educational Measurement, 27(4), 361-370. See online.
• Raju, N. S. (1988). The Area between Two Item Characteristic Curves. Psychometrika, 53(4), 495-502. See online.
• Raju, N. S. (1990). Determining the Significance of Estimated Signed and Unsigned Areas between Two Item Response Functions. Applied Psychological Measurement, 14(2), 197-207. See online.
• Rasch, G. (1960) Probabilistic Models for Some Intelligence and Attainment Tests. Copenhagen: Paedagogiske Institute.
• Revelle, W. (1979). Hierarchical cluster analysis and the internal structure of tests. Multivariate Behavioral Research, 14(1), 57-74. See online.
• Samejima, F. (1969). Estimation of Latent Ability Using a Response Pattern of Graded Scores. Psychometrika, 34(1), 1-97 See online.
• Schwarz, G. (1978). Estimating the Dimension of a Model. The Annals of Statistics, 6(2), 461-464. See online.
• Shealy, R. and Stout, W. (1993). A Model-Based Standardization Approach that Separates True Bias/DIF from Group Ability Differences and Detect Test Bias/DTF as well as Item Bias/DIF. Psychometrika, 58(2), 159-194. See online.
• Spearman, C. (1910). Correlation calculated from faulty data. British Journal of Psychology, 1904-1920, 3(3), 271-295. See online.
• Wilson, M. (2005). Constructing Measures: An Item Response Modeling Approach.
• Wright, B. D., & Stone, M. H. (1979). Best Test Design. Chicago: Mesa Press.

### Settings

#### IRT models setting

Set the number of cycles for IRT 1PL, 2PL, 3PL and 4PL models.