-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
97 lines (71 loc) · 2.51 KB
/
README.Rmd
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
output: github_document
---
<!-- README.md is generated from README.Rmd. -->
<!-- badges: start -->
[![Travis build status](https://travis-ci.org/wbelzak/regDIF.svg?branch=master)](https://travis-ci.org/wbelzak/regDIF)
<!-- badges: end -->
```{r, echo = FALSE}
options(width=80)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# regDIF: Regularized Differential Item Functioning
This R package performs regularization of differential item functioning (DIF) parameters in item response theory (IRT) models using a penalized expectation-maximization algorithm.
## Version 1.1.0 Features
regDIF can:
* Handle multiple continuous and categorical DIF covariates;
* Support binary, ordinal, and continuous item responses;
* Use LASSO, ridge, MCP, elastic net, and group penalty functions for regularization;
* Allow for proxy data to be used in place of estimating latent variable scores, which leads to
much faster estimation speed.
## Installation
To get the current released version from CRAN:
```R
install.packages("regDIF")
```
To get the current development version from Github:
```R
# install.packages("devtools")
devtools::install_github("wbelzak/regDIF")
```
## Getting Started
A simulated data example with 6 item responses (binary) and 3 background variables (gender, age, study) is available in the regDIF package:
```{r, warning = FALSE, message = FALSE}
library(regDIF)
head(ida)
```
First, the item responses and predictor values are separately specified:
```{r, warning = FALSE, message = FALSE}
item.data <- ida[, 1:6]
pred.data <- ida[, 7:9]
```
Second, the `regDIF()` function fits a sequence of 10 tuning parameter values using a penalized
EM algorithm, which assumes a normal latent variable affects all item responses:
```{r, results = 'hide'}
fit <- regDIF(item.data, pred.data, num.tau = 10)
```
The DIF results are shown below:
```{r}
summary(fit)
```
When estimation speed is slow, proxy data may be used in place of latent score estimation:
```{r, results = 'hide'}
fit_proxy <- regDIF(item.data, pred.data, prox.data = rowSums(item.data))
```
```{r}
summary(fit_proxy)
```
Other penalty functions (besides LASSO) may also be used. For instance, the elastic net penalty uses
a second tuning parameter, `alpha`, to vary the ratio of LASSO to ridge penalties:
```{r, results = 'hide'}
fit_proxy_net <- regDIF(item.data, pred.data, prox.data = rowSums(item.data), alpha = .5)
```
```{r}
summary(fit_proxy_net)
```
## Questions
Please send any questions to <[email protected]>.