npar.CDM: Main function for ACTCD package

View source: R/npar.CDM.R

npar.CDMR Documentation

Main function for ACTCD package

Description

This function is used to classify examinees into labeled classes given responses and the Q-matrix.

Usage

npar.CDM(Y, Q, cluster.method = c("HACA", "Kmeans"), Kmeans.centers = NULL, 
Kmeans.itermax = 10, Kmeans.nstart = 1, HACA.link = c("complete", "ward", "single",
 "average", "mcquitty", "median", "centroid"), HACA.cut = NULL, label.method = 
c("2b", "2a", "1", "3"),perm=NULL)

Arguments

Y

A required N \times J response matrix with binary elements (1=correct, 0=incorrect), where N is the number of examinees and J is the number of items.

Q

A required J \times K binary item-by-attribute association matrix (Q-matrix), where K is the number of attributes. The j^{th} row of the matrix is an indicator vector, 1 indicating attributes are required and 0 indicating attributes are not required to master item j.

cluster.method

The cluster algorithm used to classify data. Two options are available, including "Kmeans" and "HACA", where "HACA" is the default method. See cd.cluster for details.

Kmeans.centers

The number of clusters when "Kmeans" argument is selected. It must be not less than 2 and not greater than 2^K where K is the number of attributes. The default is 2^K.

Kmeans.itermax

The maximum number of iterations allowed when "Kmeans" argument is selected.

Kmeans.nstart

The number of random sets to be chosen when "Kmeans" argument is selected.

HACA.link

The link to be used with HACA. It must be one of "ward", "single", "complete", "average", "mcquitty", "median" or "centroid". The default is "complete".

HACA.cut

The number of clusters when "HACA" argument is selected. It must be not less than 2 and not greater than 2^K, where K is the number of attributes. The default is 2^K.

label.method

The algorithm used for labeling. It should be one of "1","2a", "2b" and "3" corresponding to different labeling methods in Chiu and Ma (2013). The default is "2b". See labeling for details.

perm

The data matrix of the partial orders of the attribute patterns.

Value

att.pattern

A N \times K binary attribute patterns, where N is the number of examinees and K is the number of attributes.

att.dist

A 2^K \times 2 data frame, where the first column is the attribute pattern, the second column is its frequency.

cluster.size

A set of integers, indicating the sizes of latent clusters.

cluster.class

A vector of estimated memberships for examinees.

See Also

print.npar.CDM, cd.cluster,labeling

Examples

# Classification based on the simulated data and Q matrix
data(sim.dat)
data(sim.Q)
# Information about the dataset
N <- nrow(sim.dat) #number of examinees
J <- nrow(sim.Q) #number of items
K <- ncol(sim.Q) #number of attributes

# Compare the difference in results among different labeling methods
# Note that the default cluster method is HACA
labeled.obj.2a <- npar.CDM(sim.dat, sim.Q, label.method="2a")
labeled.obj.2b <- npar.CDM(sim.dat, sim.Q, label.method="2b")
labeled.obj.3 <- npar.CDM(sim.dat, sim.Q, label.method="3")
data(perm3)
labeled.obj.1 <- npar.CDM(sim.dat, sim.Q, label.method="1",perm=perm3)
remove(perm3)

#User-specified number of latent clusters
M <- 5
labeled.obj.2b <- npar.CDM(sim.dat, sim.Q, cluster.method="HACA", 
HACA.cut=M, label.method="2b")
labeled.obj.2a <- npar.CDM(sim.dat, sim.Q, cluster.method="HACA", 
HACA.cut=M, label.method="2a")
#The attribute pattern for each examinee
attpatt <- labeled.obj.2b$att.pattern



ACTCD documentation built on Nov. 10, 2023, 1:12 a.m.