Learn R Programming

irtProb (version 1.0)

checkAdequation: Function to Check the Adequation of the Second Derivatives

Description

Check the adequation of the second derivatives (hessian) for computation of variance and covariance. Use inside the function m4plEstimateMore to assure that computations can be applied to this second derivative. Problems encountered can be of not positive definitetess, singular matrix, diagonal not complitely positive. In these cases inversion of the matrix is not posssible or variances cannot be computed from the inverse of the diagonal.

Usage

checkAdequation(x)

Arguments

x
matrix: second derivative (hessian).

Value

  • isNumberslogical: check if the elements of the x matrix are all numerics.
  • correctClasslogical: check if the the x matrix is of class matrix.
  • squareMatrixlogical: check if the the x matrix is square.
  • diagPositivelogical: check if the elements of the x matrix are all positive and > 0.
  • positiveDefinitelogical: check if the the x matrix is positiveDefinite.
  • nonSingularlogical: check if the the x matrix is nonSingular.

References

Seber, G. E. A. F. (2008). A matrix handbook for statisticians. New York, New Jersey: Wiley.

See Also

eigen, det, diag

Examples

Run this code
## Complete adequation of the matrix
## ..........................................................
 x <- matrix(c(4.867054, 16.66902, 16.669023, 107.36390), ncol=2)
 checkAdequation(x)
 all(checkAdequation(x))
 eigen(x)$values
 det(x)
 diag(x)
## ..........................................................

## Not positiveDefinite matrix
## ..........................................................
 x <- matrix(1:4, ncol=2)
 checkAdequation(x)
 all(checkAdequation(x))
 eigen(x)$values
 det(x)
 diag(x)
## ..........................................................

## More problems
## ..........................................................
 x <- matrix(c("Inf",2,5,10), ncol=2)
 checkAdequation(x)
 all(checkAdequation(x))
 det(x)
 diag(x)
# eigen(x)$values
 x <- matrix(c("NaN",2,5,10), ncol=2)
 checkAdequation(x)
 all(checkAdequation(x))
 det(x)
 diag(x)
# eigen(x)$values
## ..........................................................

Run the code above in your browser using DataLab