check.matrix: Matrix validation

Description Usage Arguments Details Value Author(s) Examples

Description

The fuzzy cognitive map is checked to confirm that it is square and all values are within -1 and 1.

Usage

1

Arguments

matrix

A quantitative fuzzy cognitive matrix.

Details

The fuzzy cognitive map should be in the form of a quantitative adjacency matrix.

Value

If the matrix is not square then a warning will be printed. If the matrix contains values not between -1 and 1 then a warning will be printed along with the identify of the offending values. If the matrix is square or has no values outside of -1 and 1 then a confirmation is printed. The function checks the diagonal to determine whether there are self-loops and gives a warning if there are.

Author(s)

Shaun Turney

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Is not square and contains values outside of -1 and 1: 
matrix = matrix(nrow=7,ncol=7)
matrix[1,] = c(0,-0.5,0,0,1,0,1)
matrix[2,] = c(1,0,1,0.2,0,0,0.6)
matrix[3,] = c(0,1,0,0,0,2,0)
matrix[4,] = c(0.6,0,0,1,0,0,0.1)
matrix[5,] = c(-5,0.5,0,0,1,0,-0.6) 
matrix[6,] = c(0,0,-1,0,0,0,0)

#Check
check.matrix(matrix)

#Matrix without issues:
matrix2 = matrix(nrow=7,ncol=7)
matrix2[1,] = c(0,-0.5,0,0,1,0,1)
matrix2[2,] = c(1,0,1,0.2,0,0,0.6)
matrix2[3,] = c(0,1,0,0,0,0,0)
matrix2[4,] = c(0.6,0,0,1,0,0,0.1)
matrix2[5,] = c(0,0.5,0,0,1,0,-0.6) 
matrix2[6,] = c(0,0,-1,0,0,0,0)
matrix2[7,] = c(0,0,0,-0.5,0,0,1)

#Check
check.matrix(matrix2)

FCMapper documentation built on May 2, 2019, 3:17 p.m.