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
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
# 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))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(NPCD)
Loading required package: BB
Loading required package: R.oo
Loading required package: R.methodsS3
R.methodsS3 v1.7.1 (2016-02-15) successfully loaded. See ?R.methodsS3 for help.
R.oo v1.20.0 (2016-02-17) successfully loaded. See ?R.oo for help.
Attaching package: 'R.oo'
The following objects are masked from 'package:methods':
getClasses, getMethods
The following objects are masked from 'package:base':
attach, detach, gc, load, save
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/NPCD/AlphaNP.Rd_%03d_medium.png", width=480, height=480)
> ### Name: AlphaNP
> ### Title: Nonparametric estimation of attribute profiles
> ### Aliases: AlphaNP
>
> ### ** Examples
>
> # 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
The estimated examinee attribute profiles
Method: Hamming
Attribute 1 Attribute 2 Attribute 3
Examinee 1 0 0 0
Examinee 2 0 0 1
Examinee 3 0 1 1
Examinee 4 0 0 1
Examinee 5 1 1 1
> 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))
RMSEA Chisq Chisq p-value Chisq df
Item 1 NaN NaN NaN 6
Item 2 NaN NaN NaN 6
Item 3 NaN NaN NaN 6
Item 4 NaN NaN NaN 6
> ItemFit(alpha.est.NP.W, model="DINA", par=list(slip=slip, guess=guess))
RMSEA Chisq Chisq p-value Chisq df
Item 1 NaN NaN NaN 6
Item 2 NaN NaN NaN 6
Item 3 NaN NaN NaN 6
Item 4 NaN NaN NaN 6
> ItemFit(alpha.est.NP.P, model="DINA", par=list(slip=slip, guess=guess))
RMSEA Chisq Chisq p-value Chisq df
Item 1 NaN NaN NaN 6
Item 2 NaN NaN NaN 6
Item 3 NaN NaN NaN 6
Item 4 NaN NaN NaN 6
>
>
>
>
>
> dev.off()
null device
1
>