Description Usage Arguments Value Examples
Bending a symmetric non-positive-definite matrix to positive-definite, using weighted or unweighted methods.
1 2 3 4 5 6 7 8  | 
inmat | 
 : The   | 
wtmat | 
 : The weight   | 
reciprocal | 
 : If   | 
max.iter | 
 : Maximum number of iterations. If no input is provided, default = 10000.  | 
small.positive | 
 : Eigenvalues smaller than this value are replaced with this value. If no input is provided, default = 0.0001.  | 
method | 
 :   | 
bent : The bent matrix.
init.ev : Eigenvalues of the initial (inmat) matrix.
final.ev : Eigenvalues of the bent matrix.
min.dev : min(bent - inmat).
max.dev : max(bent - inmat).
loc.min.dev : Location (indices) of min.dev element.
loc.max.dev : Location (indices) of max.dev element.
ave.dev : Average deviation (bent - inmat) of the upper triangle elements (excluding diagonal elements for correlation matrices).
AAD : Average absolute deviation of the upper triangle elements (excluding diagonal elements for correlation matrices) of bent and inmat.
Cor : Correlation between the upper triangle elements (excluding diagonal elements for correlation matrices) of bent and inmat.
RMSD : Root of mean squared deviation of the upper triangle elements (excluding diagonal elements for correlation matrices) of bent and inmat.
w_gt_0 : Number of weight elements greater than 0, in the upper triangle of wtmat (for weighted bending).
wAAD : Weighted AAD (for weighted bending).
wCor : Weighted Cor (for weighted bending).
wRMSD : Weighted RMSD (for weighted bending).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  | # Test data
V = matrix(nrow=5, ncol=5, c( # matrix to be bent
100,  95,  80,  40,  40,
 95, 100,  95,  80,  40,
 80,  95, 100,  95,  80,
 40,  80,  95, 100,  95,
 40,  40,  80,  95, 100))
W = matrix(nrow=5, ncol=5, c( # matrix of weights
1000,  500,   20,   50,  200,
 500, 1000,  500,    5,   50,
  20,  500, 1000,   20,   20,
  50,    5,   20, 1000,  200,
 200,   50,   20,  200, 1000))
# Example 1: Unweighted bending
bend(V)
## The default method (Jojani et al. 2003) is used.
# Example 2: Weighted bending using reciprocal of the weighting factors
bend(inmat=V, wtmat=W, reciprocal=TRUE)
# Example 3: Bending with fixed elements
## Assume we want to keep V[1:2, 1:2] constant.
W2 = W; W2[1:2, 1:2] = 0
bend(inmat=V, wtmat=W2, reciprocal=TRUE)
# Example 4: Bending a correlation matrix
V2 = cov2cor(V)
bend(V2, W, reciprocal=TRUE)
# Example 5: Bending using the method of Schaeffer (2014)
bend(inmat=V, method="lrs")
# Example 6: Bending a correlation matrix using the method of Schaeffer (2014)
bend(V2, method="lrs")
# Example 7: Bending the same correlation matrix using a weighted development of Schaeffer (2014)
bend(V2, W, reciprocal=TRUE, method="lrs")
# Example 8: Bending a covariance matrix using a weighted development of Schaeffer (2014)
bend(V, W, reciprocal=TRUE, method="lrs")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.