extract: Extract elements from objects of various classes

extractR Documentation

Extract elements from objects of various classes

Description

A generic function to extract elements from objects of class CDM, validation or sim.data.

Objects which can be extracted from CDM object include:

analysis.obj

An GDINA object (@seealso GDINA) gained from GDINA package or an list after BM algorithm, depending on which estimation is used.

alpha

Individuals' attribute parameters calculated by EAP method

P.alpha.Xi

Individual's posterior probability

alpha.P

Individuals' marginal mastery probabilities matrix

P.alpha

Attribute prior weights for calculating marginalized likelihood in the last iteration

Deviance

deviance, or negative two times observed marginal log likelihood

npar

The number of parameters

AIC

AIC

BIC

BIC

Objects which can be extracted from validation object include:

Q.orig

The original Q-matrix that maybe contain some mis-specifications and need to be validated.

Q.sug

The Q-matrix that suggested by certain validation method.

time.cost

The time that CPU cost to finish the validation.

process

A matrix that contains the modification process of each item during each iteration. Each row represents an iteration, and each column corresponds to the q-vector index of respective item. The order of the indices is consistent with the row number in the matrix generated by the attributepattern function in the GDINA package. Only when maxitr > 1, the value is available.

iter

The number of iteration. Only when maxitr > 1, the value is available.

priority

An I × K matrix that contains the priority of every attribute for each item. Only when the search.method is "PAA", the value is available.

Hull.fit

A list containing all the information needed to plot the Hull plot, which is available only when method = "Hull".

Objects which can be extracted from sim.data object include:

dat

An N × I simulated item response matrix.

Q

The Q-matrix.

attribute

An N × K matrix for inviduals' attribute patterns.

catprob.parm

A list of non-zero category success probabilities for each attribute mastery pattern.

delta.parm

A list of delta parameters.

higher.order.parm

Higher-order parameters.

mvnorm.parm

Multivariate normal distribution parameters.

LCprob.parm

A matrix of item/category success probabilities for each attribute mastery pattern.

Usage

extract(object, what, ...)

## S3 method for class 'CDM'
extract(object, what, ...)

## S3 method for class 'validation'
extract(object, what, ...)

## S3 method for class 'sim.data'
extract(object, what, ...)

Arguments

object

objects from class CDM, validation, sim.data

what

what to extract

...

Additional arguments.

Methods (by class)

  • extract(CDM): various elements of CDM object

  • extract(validation): various elements of validation object

  • extract(sim.data): various elements of sim.data object

Examples

set.seed(123)

library(Qval)

## generate Q-matrix and data to fit
K <- 3
I <- 30
example.Q <- sim.Q(K, I)
IQ <- list(
  P0 = runif(I, 0.0, 0.2),
  P1 = runif(I, 0.8, 1.0)
)
example.data <- sim.data(Q = example.Q, N = 1000, IQ = IQ,
                         model = "GDINA", distribute = "horder")
extract(example.data,"dat")


## using MMLE/EM to fit GDINA model
example.CDM.obj <- CDM(example.data$dat, example.Q, model = "GDINA",
                       method = "EM", maxitr = 2000, verbose = 1)
extract(example.CDM.obj,"alpha")
extract(example.CDM.obj,"npar")

example.MQ <- sim.MQ(example.Q, 0.1)
example.CDM.obj <- CDM(example.data$dat, example.MQ, model = "GDINA",
                       method = "EM", maxitr = 2000, verbose = 1)
                       
validation.obj <- validation(example.data$dat, example.MQ, 
                             example.CDM.obj, method = "MLR-B", eps = 0.90)
extract(validation.obj,"Q.sug")


Qval documentation built on April 3, 2025, 6:20 p.m.

Related to extract in Qval...