blim: Basic Local Independence Models (BLIMs)

View source: R/blim.R

blimR Documentation

Basic Local Independence Models (BLIMs)


Fits a basic local independence model (BLIM) for probabilistic knowledge structures by minimum discrepancy maximum likelihood estimation.


blim(K, N.R, method = c("MD", "ML", "MDML"), R = as.binmat(N.R),
     P.K = rep(1/nstates, nstates),
     beta = rep(0.1, nitems), eta = rep(0.1, nitems),
     betafix = rep(NA, nitems), etafix = rep(NA, nitems),
     betaequal = NULL, etaequal = NULL,
     randinit = FALSE, incradius = 0,
     tol = 1e-07, maxiter = 10000, zeropad = 16)

blimMD(K, N.R, R = as.binmat(N.R),
       betafix = rep(NA, nitems), etafix = rep(NA, nitems),
       incrule = c("minimum", "hypblc1", "hypblc2"), m = 1)

## S3 method for class 'blim'
anova(object, ..., test = c("Chisq", "none"))



a state-by-problem indicator matrix representing the knowledge structure. An element is one if the problem is contained in the state, and else zero.


a (named) vector of absolute frequencies of response patterns.


MD for minimum discrepancy estimation, ML for maximum likelihood estimation, MDML for minimum discrepancy maximum likelihood estimation.


a person-by-problem indicator matrix of unique response patterns. Per default inferred from the names of N.R.


the vector of initial parameter values for probabilities of knowledge states.

beta, eta

vectors of initial parameter values for probabilities of a careless error and a lucky guess, respectively.

betafix, etafix

vectors of fixed error and guessing parameter values; NA indicates a free parameter.

betaequal, etaequal

lists of vectors of problem indices; each vector represents an equivalence class: it contains the indices of problems for which the error or guessing parameters are constrained to be equal. (See Examples.)


logical, if TRUE then initial parameter values are sampled uniformly with constraints. (See Details.)


include knowledge states of distance from the minimum discrepant states less than or equal to incradius.


tolerance, stopping criterion for iteration.


the maximum number of iterations.


the maximum number of items for which an incomplete N.R vector is completed and padded with zeros.


inclusion rule for knowledge states. (See Details.)


exponent for hyperbolic inclusion rules.


an object of class blim, typically the result of a call to blim.


should the p-values of the chi-square distributions be reported?


additional arguments passed to other methods.


See Doignon and Falmagne (1999) for details on the basic local independence model (BLIM) for probabilistic knowledge structures.

Minimum discrepancy (MD) minimizes the number of expected response errors (careless errors or lucky guesses). Maximum likelihood maximizes the likelihood, possibly at the expense of inflating the error and guessing parameters. Minimum discrepancy maximum likelihood (MDML) maximizes the likelihood subject to the constraint of minimum response errors. See Heller and Wickelmaier (2013) for details on the parameter estimation methods.

If randinit is TRUE, initial parameter values are sampled uniformly with the constraint beta + eta < 1 (Weisstein, 2013) for the error parameters, and with sum(P.K) == 1 (Rubin, 1981) for the probabilities of knowledge states. Setting randinit to TRUE overrides any values given in the P.K, beta, and eta arguments.

The degrees of freedom in the goodness-of-fit test are calculated as number of possible response patterns minus one or number of respondents, whichever is smaller, minus number of parameters.

blimMD uses minimum discrepancy estimation only. Apart from the hyperbolic inclusion rules, all of its functionality is also provided by blim. It may be removed in the future.


An object of class blim having the following components:


the mean minimum discrepancy between response patterns and knowledge states.


the vector of estimated parameter values for probabilities of knowledge states.


the vector of estimated parameter values for probabilities of a careless error.


the vector of estimated parameter values for probabilities of a lucky guess.

the minimum discrepancy distribution.


the knowledge structure.


the vector of frequencies of response patterns.


the number of items.


the number of knowledge states.


the number of response patterns.


the number of respondents.


the number of response errors.


the number of parameters.


the parameter estimation method.


the number of iterations needed.


the log-likelihood.


the fitted response frequencies.

the goodness of fit statistic including the likelihood ratio fitted vs. saturated model (G2), the degrees of freedom, and the p-value of the corresponding chi-square distribution. (See Details.)


Doignon, J.-P., & Falmagne, J.-C. (1999). Knowledge spaces. Berlin: Springer.

Heller, J., & Wickelmaier, F. (2013). Minimum discrepancy estimation in probabilistic knowledge structures. Electronic Notes in Discrete Mathematics, 42, 49–56. doi: 10.1016/j.endm.2013.05.145

Rubin, D.B. (1981). The Bayesian bootstrap. The Annals of Statistics, 9(1), 130–134. doi: 10.1214/aos/1176345338

Weisstein, E.W. (2013, August 29). Triangle point picking. In MathWorld – A Wolfram Web Resource. Retrieved from

See Also

simulate.blim, plot.blim, residuals.blim, logLik.blim, delineate, jacobian, endm, probability, chess.


K   <- DoignonFalmagne7$K    # knowledge structure
N.R <- DoignonFalmagne7$N.R  # frequencies of response patterns

## Fit basic local independence model (BLIM) by different methods
blim(K, N.R, method = "MD")    # minimum discrepancy estimation
blim(K, N.R, method = "ML")    # maximum likelihood estimation by EM
blim(K, N.R, method = "MDML")  # MDML estimation

## Parameter restrictions: beta_a = beta_b = beta_d, beta_c = beta_e
##                          eta_a =  eta_b = 0.1
m1 <- blim(K, N.R, method = "ML",
           betaequal = list(c(1, 2, 4), c(3, 5)),
              etafix = c(0.1, 0.1, NA, NA, NA))
m2 <- blim(K, N.R, method = "ML")
anova(m1, m2)

## See ?endm, ?probability, and ?chess for further examples.

pks documentation built on April 15, 2022, 1:05 a.m.

Related to blim in pks...