as_mv_kg() builds an mv_kg object from objects you may
already have:
Usage
as_mv_kg(x, ...)
# S3 method for class 'mv_kg'
as_mv_kg(x, ...)
# S3 method for class 'matrix'
as_mv_kg(x, ...)
# S3 method for class 'data.frame'
as_mv_kg(x, ...)
# S3 method for class 'SingleGroupClass'
as_mv_kg(x, ...)
# S3 method for class 'igraph'
as_mv_kg(x, ...)Arguments
- x
the object to convert.
- ...
passed on to
mv_kg_build()(for examplename), or for a Q-matrix,edgeswith relations between its concepts.
Details
A Q-matrix (a 0/1 matrix or data frame, one row per item and one column per concept): Concepts and
measuresedges, with no relations between concepts.An edge list (a data frame with
from,toandtype): Rows with type"measures"become item links, the others concept relations.A fitted confirmatory model from
mirt::mirt(): Each factor becomes a concept and each non-zero slope ameasuresedge, so a graph can be drawn from a model you have already fitted.An igraph object: Vertices with a
kindattribute of"item"become items, the others concepts; edgetypeattributes are kept.
Examples
q <- matrix(c(1, 0,
1, 0,
0, 1,
1, 1), ncol = 2, byrow = TRUE,
dimnames = list(paste0("Q", 1:4), c("number", "algebra")))
as_mv_kg(q, edges = data.frame(from = "number", to = "algebra"))
#> <mv_kg> 2 concept(s), 4 item(s)
#> Edges: 1 prerequisite, 0 related, 5 measures
#> Learning order (by prerequisite depth):
#> 0: number
#> 1: algebra