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

1
2
3
4
extractCN(mod, method = "svd", ...)

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

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.

Details

The condition number (κ) 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}(κ) of the condition number as a crude estimate of the number of digits of precision lost.

Value

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

CN

the condition number (κ) of the model.

log10

the log base 10 of the condition number.

method

the method used to extract the singular values or eigenvalues.

Author(s)

Marc J. Mazerolle

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##N-mixture model example modified from ?pcount
## Not run: 
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)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.