Learn R Programming

AICcmodavg (version 2.3-1)

extractCN: Compute Condition Number

Description

This function computes the condition number for models of unmarkedFit classes as the ratio of the largest eigenvalue of the Hessian matrix to the smallest eigenvalue of the Hessian matrix.

Usage

extractCN(mod, method = "svd", ...)

# S3 method for unmarkedFit extractCN(mod, method = "svd", ...)

Value

extractCN returns a list of class extractCN with the following components:

CN

the condition number (\(\kappa\)) of the model.

log10

the log base 10 of the condition number.

method

the method used to extract the singular values or eigenvalues.

Arguments

mod

a model of one the unmarkedFit classes for which a condition number is requested.

method

specifies the method used to extract the singular values or eigenvalues from the Hessian matrix using singular value decomposition (method = "svd") or eigenvalue decomposition (method = "eigen").

...

additional arguments passed to the function.

Author

Marc J. Mazerolle

Details

The condition number (\(\kappa\)) is a measure of the transfer of error to the solution in response to small changes in the input (Cheney and Kincaid 2008). In this implementation, the condition number is computed on the Hessian matrix of models of unmarkedFit classes from the optim results stored in the model object. The condition number is defined as the ratio of the largest to the smallest non-negative singular values of a given matrix (Cline et al. 1979, Dixon 1983). In the special case of positive semi-definite matrices, the singular values are equal to the eigenvalues (Ruhe 1975).

Large values of the condition number may indicate problems in estimating parameters or their variance (ill-conditioning), possibly due to a model having too many parameters for the given data set. Cheney and Ward (2008) suggest using the \(\log_{10}(\kappa)\) of the condition number as a crude estimate of the number of digits of precision lost.

References

Cheney, W., Kincaid, D. (2008) Numerical mathematics and computing. Sixth edition. Thomson Brooks/Cole: Belmont.

Cline, A. K., Moler, C. B., Stewart, G. W., Wilkinson, J. H. (1979) An estimate for the condition number of a matrix. SIAM Journal on Numerical Analysis 16, 368--375.

Dixon, J. D. (1983) Estimating extremal eigenvalues and condition numbers of matrices. SIAM Journal on Numerical Analysis 20, 812--814.

Ruhe, A. (1975) On the closeness of eigenvalues and singular values for almost normal matrices. Linear Algebra and its Applications 11, 87--94.

See Also

c_hat, mb.gof.test, Nmix.gof.test, parboot, kappa, rcond

Examples

Run this code
##N-mixture model example modified from ?pcount
if (FALSE) {
require(unmarked)
##single season
data(mallard)
mallardUMF <- unmarkedFramePCount(mallard.y, siteCovs = mallard.site,
                                  obsCovs = mallard.obs)
##run model
fm.mallard <- pcount(~ ivel+ date + I(date^2) ~ length + elev + forest,
                     mallardUMF, K=30)

##compute condition number
extractCN(fm.mallard)

##compare against 'kappa'
kappa(fm.mallard@opt$hessian, exact = TRUE)
detach(package:unmarked)
}

Run the code above in your browser using DataLab