Knowledge space theory applies prerequisite relationships between
items of knowledge within a given domain for efficient adaptive
assessment and training (Doignon & Falmagne, 1999). The
`kstMatrix`

package implements some basic functions for
working with knowledge space. Furthermore, it provides several
empirically obtained knowledge spaces in form of their bases.

There is a certain overlap in functionality between the
`kst`

and `kstMatrix`

packages, however the former
uses a set representation and the latter a matrix representation. The
packages are to be seen as complementary, not as a replacement for each
other.

Knowledge spaces can easily grow very large. Therefore, their bases
are often used to store the knowledge spaces with reduced space
requirements. `kstmatrix`

offers two functions for computing
bases from spaces and vice versa.

`kmbasis()`

The `kmbasis`

function computes the basis for a given
knowledge space (actually, it can be any family of sets represented by a
binary matrix).

`kmunionclosure()`

The `kmunionclosure`

function computes the knowledge space
for a basis (mathematically spoken it computes the closure under union
of the given family of sets).

`kmsurmiserelation()`

The `kmsurmiserelation`

function determines the surmise
relation for a quasi-ordinal knowledge space. For a more general family
of sets, it computes the surmise relation for the smallest quasi-ordinal
knowledge space including that family.

The surmise relation can also be used to easily close a knowledge space under intersection:

`kmsurmisefunction()`

The `kmsurmisefunction`

function computes the surmise
function for a knowledge space or basis. For a more general family of
sets, it computes the surmise function for the smallest knowledge space
including that family.

`kmiswellgraded()`

The `kmiswellgraded`

function determines whether a
knowledge structure is wellgraded.

`kmnotions()`

The `kmnotions`

function returns a matrix specifying the
notions of a knowledge strucure, i.e. the classes of equivalent
items.

For a given item number, there are two trivial knowledge spaces, the maximal knowledge space representing absolutely no prerequisite relationships (the knowledge space is the power set of the item set and the basis matrix is the diagonal matrix), and the minimal knowledge space representing equivalence of all items (the knowledge space contains just the empty set and the full item set, and the basis matrix contains one line full of ’1’s).

`kmminimalspace()`

**Example:**

`kmmaximalspace()`

**Example:**

```
kmmaximalspace(4)
#> [,1] [,2] [,3] [,4]
#> [1,] 0 0 0 0
#> [2,] 1 0 0 0
#> [3,] 0 1 0 0
#> [4,] 1 1 0 0
#> [5,] 0 0 1 0
#> [6,] 1 0 1 0
#> [7,] 0 1 1 0
#> [8,] 1 1 1 0
#> [9,] 0 0 0 1
#> [10,] 1 0 0 1
#> [11,] 0 1 0 1
#> [12,] 1 1 0 1
#> [13,] 0 0 1 1
#> [14,] 1 0 1 1
#> [15,] 0 1 1 1
#> [16,] 1 1 1 1
```

`kmdist()`

The `kmdist`

function computes a frequency distribution
for the distances between a data set and a knowledge space.

`kmvalidate()`

The `kmvalidate`

function returns the distance vector, the
discrimination index DI, and the distance agreement coefficient DA. The
discrepancy index (DI) is the mean distance; the distance agreement
coefficient is the ratio between the mean distance between data and
space (ddat = DI) and the mean distance between space and power set
(dpot).

`kmsimulate()`

The `kmsimulate`

funtion provides a generation of response
patterns by applying the BLIM (Basic Local Independence Model; see
Doignon & Falmagne, 1999) to a given knowledge structure. The
`beta`

and `eta`

parameters of the BLIM can each
be either a vector specifying different values for each item or a single
numerical where `beta`

or `eta`

is assumed to be
equal for all items.

```
kmsimulate(xpl$space, 10, 0.2, 0.1)
#> a b c d
#> [1,] 1 0 0 0
#> [2,] 1 1 0 0
#> [3,] 0 1 0 0
#> [4,] 0 0 0 0
#> [5,] 1 1 0 1
#> [6,] 1 1 0 0
#> [7,] 0 0 0 0
#> [8,] 1 1 0 0
#> [9,] 1 1 1 0
#> [10,] 0 1 0 0
kmsimulate(xpl$space, 10, c(0.2, 0.25, 0.15, 0.2), c(0.1, 0.15, 0.05, 0.1))
#> a b c d
#> [1,] 1 0 1 0
#> [2,] 0 1 1 1
#> [3,] 0 0 0 0
#> [4,] 0 0 0 0
#> [5,] 0 0 1 0
#> [6,] 1 1 1 1
#> [7,] 0 1 0 0
#> [8,] 0 1 0 0
#> [9,] 1 1 0 0
#> [10,] 0 0 0 0
kmsimulate(xpl$space, 10, c(0.2, 0.25, 0.15, 0.2), 0)
#> a b c d
#> [1,] 1 1 0 1
#> [2,] 1 1 1 1
#> [3,] 0 1 0 0
#> [4,] 0 1 0 0
#> [5,] 1 1 0 0
#> [6,] 1 0 1 0
#> [7,] 1 1 1 0
#> [8,] 1 0 0 0
#> [9,] 1 1 1 1
#> [10,] 1 0 1 0
```

`kmneighbourhood()`

The `kmneighbourhood`

function determines the
neighbourhood of a state in a knowledge structure, i.e. the family of
all states with a symmetric set diference of 1.

`kmsymmsetdiff()`

The `kmsymmsetdiff`

function returns the symmetric set
difference between two sets represented as binary vectors.

`kmhasse()`

and `kmcolors()`

The `kmhasse`

function draws a Hasse diagram of a
knowledge structure, the `kmcolors`

function returns a color
vector to be used with `kmhasse()`

.

`kstMatrix`

The provided datasets were obtained by the research group around Cornelia Dowling by querying experts in the respective fields.

Six experts were queried about prerequisite relationships between 28 AutoCAD knowledge items (Dowling, 1991; 1993a). A seventh basis represents those prerequisite relationships on which the majority (4 out of 6) of the experts agree (Dowling & Hockemeyer, 1998).

Three experts were queried about prerequisite relationships between 48 items on reading and writing abilities (Dowling, 1991; 1993a). A fourth basis represents those prerequisite relationships on which the majority of the experts agree (Dowling & Hockemeyer, 1998).

Three experts were queried about prerequisite relationships between 77 items on fractions (Baumunk & Dowling, 1997). A fourth basis represents those prerequisite relationships on which the majority of the experts agree (Dowling & Hockemeyer, 1998).

This is just a small fictitious 4-item-example used for the examples in the documentation.

```
summary(xpl)
#> Length Class Mode
#> basis 20 -none- numeric
#> space 36 -none- numeric
#> data 28 -none- numeric
xpl$basis
#> a b c d
#> [1,] 1 0 0 0
#> [2,] 0 1 0 0
#> [3,] 1 0 1 0
#> [4,] 0 1 1 0
#> [5,] 1 1 0 1
xpl$space
#> a b c d
#> [1,] 0 0 0 0
#> [2,] 1 0 0 0
#> [3,] 0 1 0 0
#> [4,] 1 1 0 0
#> [5,] 1 0 1 0
#> [6,] 1 1 1 0
#> [7,] 0 1 1 0
#> [8,] 1 1 0 1
#> [9,] 1 1 1 1
xpl$data
#> a b c d
#> [1,] 0 0 1 0
#> [2,] 1 0 0 0
#> [3,] 0 0 0 1
#> [4,] 1 1 0 0
#> [5,] 1 1 1 0
#> [6,] 1 1 1 1
#> [7,] 1 1 0 0
```

- Baumunk, K. & Dowling, C. E. (1997). Validity of spaces for
assessing knowledge about fractions.
*Journal of Mathematical Psychology, 41,*99–105. - Doignon, J.-P. & Falmagne, J.-C. (1999).
*Knowledge Spaces.*Springer–Verlag, Berlin. - Dowling, C. E. (1991).
*Constructing Knowledge Structures from the Judgements of Experts.*Habilitationsschrift, Technische Universität Carolo-Wilhelmina, Braunschweig, Germany. - Dowling, C. E. (1993a). Applying the basis of a knowledge space for
controlling the questioning of an expert.
*Journal of Mathematical Psychology, 37,*21–48. - Dowling, C. E. (1993b). On the irredundant construction of knowledge spaces. Journal of Mathematical Psychology, 37, 49–62.
- 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.