AlphaNP: Nonparametric estimation of attribute profiles

Description Usage Arguments Value References See Also Examples

View source: R/AlphaNP.R

Description

This function estimates attribute profiles using nonparametric approaches for both the "AND gate" (conjunctive) and the "OR gate" (disjunctive) cognitive diagnostic models. These algorithms select the attribute profile with the smallest loss function value (plain, weighted, or penalized Hamming distance, see below for details) as the estimate. If more than one attribute profiles have the smallest loss function value, one of them is randomly chosen.

Usage

1
2
AlphaNP(Y, Q, gate = c("AND", "OR"), method = c("Hamming", "Weighted", 
"Penalized"), wg = 1, ws = 1)

Arguments

Y

A matrix of binary responses. Rows represent persons and columns represent items. 1=correct, 0=incorrect.

Q

The Q-matrix of the test. Rows represent items and columns represent attributes. 1=attribute required by the item, 0=attribute not required by the item.

gate

"AND": the examinee needs to possess all required attributes of an item in order to answer it correctly; "OR": the examinee needs to possess only one of the required attributes of an item in order to answer it correctly.

method

The method of nonparametric estimation. "Hamming": the plain Hamming distance method; "Weighted": the Hamming distance weighted by inversed item variance; "Penalized": the Hamming distance weighted by inversed item variance and specified penalizing weights for guess and slip.

wg

Additional argument for the "penalized" method. wg is the weight assigned to guessing in the DINA or DINO models. A large value of wg results in a stronger impact on Hamming distance (larger loss function values) caused by guessing.

ws

Additional input for the "penalized" method. ws is the weight assigned to slipping in the DINA or DINO models. A large value of ws results in la stronger impact on Hamming distance (larger loss function values) caused by slipping.

Value

alpha.est

Estimated attribute profiles. Rows represent persons and columns represent attributes. 1=examinee masters the attribute, 0=examinee does not master the attribute.

est.ideal

Estimated ideal response to all items by all examinees. Rows represent persons and columns represent items. 1=correct, 0=incorrect.

est.class

The class number (row index in pattern) for each person's attribute profile. It can also be used for locating the loss function value in loss.matrix for the estimated attribute profile for each person.

n.tie

Number of ties in the Hamming distance among the candidate attribute profiles for each person. When we encounter ties, one of the tied attribute profiles is randomly chosen.

pattern

All possible attribute profiles in the search space.

loss.matrix

The matrix of the values for the loss function (the plain, weighted, or penalized Hamming distance). Rows represent candidate attribute profiles in the same order with the pattern matrix; columns represent different examinees.

References

Chiu, C. (2011). Flexible approaches to cognitive diagnosis: nonparametric methods and small sample techniques. Invited session of cognitive diagnosis and item response theory at 2011 Joint Statistical Meeting.

Chiu, C. Y., & Douglas, J. A. (2013). A nonparametric approach to cognitive diagnosis by proximity to ideal response patterns. Journal of Classification 30(2), 225-250.

See Also

AlphaMLE, JMLE, print.AlphaNP, plot.AlphaNP

Examples

 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
# Generate item and examinee profiles

natt <- 3
nitem <- 4
nperson <- 5
Q <- rbind(c(1, 0, 0), c(0, 1, 0), c(0, 0, 1), c(1, 1, 1))
alpha <- rbind(c(0, 0, 0), c(1, 0, 0), c(0, 1, 0), c(0, 0, 1), c(1, 1, 1))

# Generate DINA model-based response data

slip <- c(0.1, 0.15, 0.2, 0.25)
guess <- c(0.1, 0.15, 0.2, 0.25)
my.par <- list(slip=slip, guess=guess)

data <- matrix(NA, nperson, nitem)
eta <- matrix(NA, nperson, nitem)

for (i in 1:nperson) {
  for (j in 1:nitem) {
  eta[i, j] <- prod(alpha[i,] ^ Q[j, ])
  P <- (1 - slip[j]) ^ eta[i, j] * guess[j] ^ (1 - eta[i, j])
  u <- runif(1)
  data[i, j] <- as.numeric(u < P)
  }
}

# Using the function to estimate examinee attribute profile

alpha.est.NP.H <- AlphaNP(data, Q, gate="AND", method="Hamming")
alpha.est.NP.W <- AlphaNP(data, Q, gate="AND", method="Weighted")
alpha.est.NP.P <- AlphaNP(data, Q, gate="AND", method="Penalized", wg=2, ws=1)

nperson <- 1   # Choose an examinee to investigate
print(alpha.est.NP.H) # Print the estimated examinee attribute profiles
plot(alpha.est.NP.H, nperson)   # Plot the sorted loss function of different 
#attribute profiles for this examinee
ItemFit(alpha.est.NP.H, model="DINA", par=list(slip=slip, guess=guess))
ItemFit(alpha.est.NP.W, model="DINA", par=list(slip=slip, guess=guess))
ItemFit(alpha.est.NP.P, model="DINA", par=list(slip=slip, guess=guess))

NPCD documentation built on Nov. 16, 2019, 1:08 a.m.

Related to AlphaNP in NPCD...