Title: | Basic Functions in Knowledge Space Theory Using Matrix Representation |
---|---|
Description: | Knowledge space theory by Doignon and Falmagne (1999) <doi:10.1007/978-3-642-58625-5> is a set- and order-theoretical framework, which proposes mathematical formalisms to operationalize knowledge structures in a particular domain. The 'kstMatrix' package provides basic functionalities to generate, handle, and manipulate knowledge structures and knowledge spaces. Opposed to the 'kst' package, 'kstMatrix' uses matrix representations for knowledge structures. Furthermore, 'kstMatrix' contains several knowledge spaces developed by the research group around Cornelia Dowling through querying experts. |
Authors: | Cord Hockemeyer [aut, cre], Wai Wong [ctb] |
Maintainer: | Cord Hockemeyer <[email protected]> |
License: | GPL-3 |
Version: | 1.1-0 |
Built: | 2025-02-26 06:01:56 UTC |
Source: | https://github.com/cran/kstMatrix |
Bases of knowledge spaces on AutoCAD knowledge obtained from querying experts.
cad
cad
A list containing seven bases (cad1 to cad6, and cadmaj) in binary matrix form. Each matrix has 28 columns representing the different knowledge items and a varying number of rows containing the basis elements.
Six experts were queried about prerequisite relationships between 28 AutoCAD knowledge items (Dowling, 1991; 1993). A seventh basis represents those prerequisite relationships on which the majority (4 out of 6) of the experts agree (Dowling & Hockemeyer, 1998).
Dowling, C. E. (1991). Constructing Knowledge Structures from the Judgements of Experts. Habilitationsschrift, Technische Universität Carolo-Wilhelmina, Braunschweig, Germany.
Dowling, C. E. (1993). Applying the basis of a knowledge space for controlling the questioning of an expert. Journal of Mathematical Psychology, 37, 21–48.
Dowling, C. E. & Hockemeyer, C. (1998). Computing the intersection of knowledge spaces using only their basis. In Cornelia E. Dowling, Fred S. Roberts, & Peter Theuns, editors, Recent Progress in Mathematical Psychology, pp. 133–141. Lawrence Erlbaum Associates Ltd., Mahwah, NJ.
Other Data:
fractions
,
readwrite
,
xpl
Bases of knowledge spaces on fractions obtained from querying experts.
fractions
fractions
A list containing four bases (frac1 to frac3, and fracmaj) in binary matrix form. Each matrix has 77 columns representing the different knowledge items and a varying number of rows containing the basis elements.
Three experts were queried about prerequisite relationships between 77 items on fractions (Baumunk & Dowling, 1997). A forth basis represents those prerequisite relationships on which the majority of the experts agree (Dowling & Hockemeyer, 1998).
Baumunk, K. & Dowling, C. E. (1997). Validity of spaces for assessing knowledge about fractions. Journal of Mathematical Psychology, 41 ,99–105.
Dowling, C. E. & Hockemeyer, C. (1998). Computing the intersection of knowledge spaces using only their basis. In Cornelia E. Dowling, Fred S. Roberts, & Peter Theuns, editors, Recent Progress in Mathematical Psychology, pp. 133–141. Lawrence Erlbaum Associates Ltd., Mahwah, NJ.
Other Data:
cad
,
readwrite
,
xpl
kmbasis
returns a matrix representing the basis of a
knowledge space. If x
is a knowledge structure or an
arbitrary family of sets kmreduction
returns the basis of
the smallest knowledge space containing x
.
kmbasis(x)
kmbasis(x)
x |
Binary matrix representing a knowledge space |
Binary matrix representing the basis of the knowledge space.
Other Different representations for knowledge spaces:
kmsurmisefunction()
,
kmsurmiserelation()
,
kmunionclosure()
kmbasis(xpl$space)
kmbasis(xpl$space)
kmbasisdiagram
takes a matrix representing a basis and a
color vector and draws a Hasse diagram. If the color vector is NULL
the states are drawn in green.
kmbasisdiagram(struc, horizontal = FALSE, colors = NULL)
kmbasisdiagram(struc, horizontal = FALSE, colors = NULL)
struc |
Binary matrix representing a basis |
horizontal |
Boolean defining orientation of the graph, default FALSE |
colors |
Color vector (default NULL) |
Other Plotting knowledge structures:
kmhasse()
kmcolors
takes a probabilty vector and a color palette and
creates a color vector to be used with kmhasse
.
kmcolors(prob, palette = cm.colors)
kmcolors(prob, palette = cm.colors)
prob |
Probability vector |
palette |
Color palette (default = cm.colors) |
kmdist
returns a named vector with the frequencies of distances
between a set of response patterns and a knowledge structure. This vector
can be used to compute, e.g., the Discrepancy Index (DI) or the
Distance Agreement Coefficient (DA).
kmdist(data, struct)
kmdist(data, struct)
data |
Binary matrix representing a set of response patterns |
struct |
Binary matrix representing a knowledge structure |
Distance distribution vector
Other Validating knowledge spaces:
kmvalidate()
kmdist(xpl$data, xpl$space)
kmdist(xpl$data, xpl$space)
kmeqreduction
takes a family of knowledge states and returns its
reduction to non-equivalent items.
kmeqreduction(x)
kmeqreduction(x)
x |
Binary matrix |
Binary matrix reduced by equivalences
Other Properties of knowledge structures:
kmiswellgraded()
,
kmnotions()
kmeqreduction(xpl$space)
kmeqreduction(xpl$space)
kmfringe
computes the fringe of a state
within a knowledge structure, i.e. the set of items by which
the state differs from its neighbours.
kmfringe(state, struct)
kmfringe(state, struct)
state |
Binary vector representing a knowledge state |
struct |
Binary matrix representing a knowledge structure |
Binary vector representing the fringe
Other Neighbourhood & fringe:
kmneighbourhood()
kmfringe(c(1,0,0,0), xpl$space)
kmfringe(c(1,0,0,0), xpl$space)
kmgenerate
returns a matrix representing a knowledge structure generated
from data. It uses a simplistic approach: patterns with a frequency above a
specified threshold are considered as knowledge states.
If the specified threshold is 0 (default) a real threshold is computed as
N (number of response patterns) divided by 2^|Q|.
Please note that the number of response patterns should be much higher than the
size of the power set of the item set Q. A factor of art least 10 is recommended.
Currently, the number of items is limited to the number of bits in a C long
minus one (i.e. 31 under Windows and 63 otherwise). But we would probably run into
memory problems way earlier anyway.
kmgenerate(x, threshold = 0)
kmgenerate(x, threshold = 0)
x |
Binary matrix representing a data set |
threshold |
Threshold for taking response patterns as knowledge states (default 0) |
Binary matrix representing the generated knowledge structure
kmgenerate(xpl$sim, 15)
kmgenerate(xpl$sim, 15)
kmhasse
takes a matrix representing a knowledge structure and a
color vector and draws a Hasse diagram. If the color vector is NULL
the states are drawn in green.
kmhasse(struc, horizontal = FALSE, colors = NULL)
kmhasse(struc, horizontal = FALSE, colors = NULL)
struc |
Binary matrix representing a knowledge structure |
horizontal |
Boolean defining orientation of the graph, default FALSE |
colors |
Color vector (default NULL) |
Other Plotting knowledge structures:
kmbasisdiagram()
kmiswellgraded
returns whether a knowledge structure is wellgraded.
kmiswellgraded(x)
kmiswellgraded(x)
x |
Binary matrix representing a knowledge space |
Logical value specifying whether 'x' is wellgraded
Doignon, J.-P. & Falmagne, J.-C. (1999). Knowledge Spaces. Springer–Verlag, Berlin.
Other Properties of knowledge structures:
kmeqreduction()
,
kmnotions()
kmiswellgraded(xpl$space)
kmiswellgraded(xpl$space)
kmneighbourhood
computes the neighbourhood of a state
within a knowledge structure, i.e. the family of all other
states with a symmetric set difference of 1.
kmneighbourhood(state, struct)
kmneighbourhood(state, struct)
state |
Binary vector representing a knowledge state |
struct |
Binary matrix representing a knowledge structure |
Matrix containing the neighbouring states, one per row
Other Neighbourhood & fringe:
kmfringe()
kmneighbourhood(c(1,1,0,0), xpl$space)
kmneighbourhood(c(1,1,0,0), xpl$space)
kmnneighbourhood
computes the n-neighbourhood of a state
within a knowledge structure, i.e. the family of all other
states with a symmetric set difference maximal n.
kmnneighbourhood(state, struct, distance)
kmnneighbourhood(state, struct, distance)
state |
Binary vector representing a knowledge state |
struct |
Binary matrix representing a knowledge structure |
distance |
Size of the n-neighbourhood |
Matrix containing the neighbouring states, one per row
kmnneighbourhood(c(1,1,0,0), xpl$space, 2)
kmnneighbourhood(c(1,1,0,0), xpl$space, 2)
kmnotions
returns a matrix representing the
notions of a knowledge structure.
kmnotions(x)
kmnotions(x)
x |
Binary matrix representing a knowledge structure |
Binary matrix representing notions in the knowledge structure
The matrix has a '1' in row 'i' and column 'j' if 'i' and 'j' belong to the same notion (i.e. are equivalent). It is a symmetric matrix with '1's in the main diagonal.
Other Properties of knowledge structures:
kmeqreduction()
,
kmiswellgraded()
kmnotions(xpl$space)
kmnotions(xpl$space)
kmsf2basis
expects a surmise function data frame
and returns the corresponding basis.
kmsf2basis(sf)
kmsf2basis(sf)
sf |
Surmise function |
Matrix representing the basis.
kmsimulate
returns a data set of n
simulated response patterns based
on the knowledge structure x
given as a binary matrix. The simulation follows
the BLIM (Basic Local Independence Model; see Doigon & Falmagne, 1999).
kmsimulate(x, n, beta, eta)
kmsimulate(x, n, beta, eta)
x |
Binary matrix representing a knowledge space |
n |
Number of simulated response patterns |
beta |
Careless error probability value or vector |
eta |
Lucky guess probability value or vector |
The beta
and eta
parameters must be either single numericals
or vectors with a length identical to the number of rows in the x
matrix.
A mixture is possible.
The 'sample' function used by 'kmsimulate' might work inaccurately for knowledge structures 'x' with 2^31 or more states.
Binary matrix representing the simulated data set
Doignon, J.-P. & Falmagne, J.-C. (1999). Knowledge Spaces. Springer–Verlag, Berlin.
kmsimulate(xpl$space, 50, 0.2, 0.1) kmsimulate(xpl$space, 50, c(0.2, 0.25, 0.15, 0.2), c(0.1, 0.15, 0.05, 0.1)) kmsimulate(xpl$space, 50, c(0.2, 0.25, 0.15, 0.2), 0)
kmsimulate(xpl$space, 50, 0.2, 0.1) kmsimulate(xpl$space, 50, c(0.2, 0.25, 0.15, 0.2), c(0.1, 0.15, 0.05, 0.1)) kmsimulate(xpl$space, 50, c(0.2, 0.25, 0.15, 0.2), 0)
kmsurmisefunction
returns a data frame representing the
surmise function for a knowledge space or basis. The rows of the
data frame are ordered by item name.
kmsurmisefunction(x)
kmsurmisefunction(x)
x |
Binary matrix representing a knowledge space or basis |
Data frame representing the surmise unction of x
.
Other Different representations for knowledge spaces:
kmbasis()
,
kmsurmiserelation()
,
kmunionclosure()
kmsurmisefunction(xpl$space)
kmsurmisefunction(xpl$space)
kmsurmiserelation
returns a matrix representing the
surmise relation of a quasi-ordinal knowledge space. If x
is a general knowledge space, a knowledge structure or an
arbitrary family of sets, kmsurmiserelation
returns the
surmise relation of the smallest quasi-ordinal knowledge space
containing x
.
kmsurmiserelation(x)
kmsurmiserelation(x)
x |
Binary matrix representing a quasi-ordinal knowledge space |
Binary matrix representing the surmise relation of the corresponding quasi-ordinal knowledge space
Note: The columns of the surmise relation matrix describe the minimal state for the respective item in the quasi-ordinal knowledge space.
Other Different representations for knowledge spaces:
kmbasis()
,
kmsurmisefunction()
,
kmunionclosure()
kmsurmiserelation(xpl$space)
kmsurmiserelation(xpl$space)
Compute the symmetric set difference between two sets
kmsymmsetdiff(x, y) kmsetdistance(x, y)
kmsymmsetdiff(x, y) kmsetdistance(x, y)
x |
Binary vector representing a set |
y |
Binary vector representing a set |
kmsymmsetdiff: Symmetric set difference between 'x' and 'y'
kmsetdistance: Distance between the sets 'x' and 'y', i.e. the cardinality of the symmetric set difference
kmsymmsetdiff(c(1,0,0), c(1,1,0)) kmsetdistance(c(1,0,0), c(1,1,0))
kmsymmsetdiff(c(1,0,0), c(1,1,0)) kmsetdistance(c(1,0,0), c(1,1,0))
These functions create trivial knowledge spaces of a given item number. The minimal space contains just the empty set and the full item set while the maximal space is equal to the power set.
kmminimalspace(noi) kmmaximalspace(noi)
kmminimalspace(noi) kmmaximalspace(noi)
noi |
Number of items |
Please note that the computation time for creating large power sets can grow quite large easily.
A binary matrix representing the respective knowledge space
kmminimalspace(5) kmmaximalspace(5)
kmminimalspace(5) kmmaximalspace(5)
kmunionclosure
returns a matrix representing a knowledge space. Please note
that it may take quite some time for computing larger knowledge spaces.
kmunionclosure(x)
kmunionclosure(x)
x |
Binary matrix representing a family of sets |
Binary matrix representing the corresponding knowledge space, i.e. the closure of the family under union including the empty set and the full set.
kmunionclosure
implements the irredundant algorithm developed by Dowling (1993).
Dowling, C. E. (1993). On the irredundant construction of knowledge spaces. Journal of Mathematical Psychology, 37, 49–62.
Other Different representations for knowledge spaces:
kmbasis()
,
kmsurmisefunction()
,
kmsurmiserelation()
kmunionclosure(xpl$basis)
kmunionclosure(xpl$basis)
kmvalidate
returns a list with three elements,
a named vector with the frequencies of distances
between a set of response patterns and a knowledge structure, the
Discrepancy Index (DI), and the Distance Agreement Coefficient (DA).
kmvalidate(data, struct)
kmvalidate(data, struct)
data |
Binary matrix representing a set of response patterns |
struct |
Binary matrix representing a knowledge structure |
A list with three elements:
Distance distribution vector
Discrepancy Index
Distance Agreement Coefficient
The DA computation can take quite some time for larger item sets as the power set has to be computed. For item sets with around 30 items or more, it may even crash the system due to huge memory requests.
Other Validating knowledge spaces:
kmdist()
kmvalidate(xpl$data, xpl$space)
kmvalidate(xpl$data, xpl$space)
Bases of knowledge spaces on reading/writing abilities obtained from querying experts.
readwrite
readwrite
A list containing four bases (rw1 to rw3, and rwmaj) in binary matrix form. Each matrix has 48 columns representing the different knowledge items and a varying number of rows containing the basis elements.
Three experts were queried about prerequisite relationships between 48 items on reading and writing abilities (Dowling, 1991; 1993). A forth basis represents those prerequisite relationships on which the majority of the experts agree (Dowling & Hockemeyer, 1998).
Dowling, C. E. (1991). Constructing Knowledge Structures from the Judgements of Experts. Habilitationsschrift, Technische Universität Carolo-Wilhelmina, Braunschweig, Germany.
Dowling, C. E. (1993). Applying the basis of a knowledge space for controlling the questioning of an expert. Journal of Mathematical Psychology, 37, 21–48.
Dowling, C. E. & Hockemeyer, C. (1998). Computing the intersection of knowledge spaces using only their basis. In Cornelia E. Dowling, Fred S. Roberts, & Peter Theuns, editors, Recent Progress in Mathematical Psychology, pp. 133–141. Lawrence Erlbaum Associates Ltd., Mahwah, NJ.
Other Data:
cad
,
fractions
,
xpl
Basis and space matrix of a small fictional knowledge space, and two data sets
(data (7 patterns) and sim (500 patterns)to be used in examples. The latter
was produced with kmsimulate()
with beta and eta values of 0.1.
xpl
xpl
A list containing the basis, the space, and the two data matrices data and sim.
Other Data:
cad
,
fractions
,
readwrite