| Title: | Fuzzy Cognitive Map Analysis in R |
|---|---|
| Description: | fcmconfr streamlines the process of conducting dynamic simulations using Fuzzy Cognitive Maps (FCMs). The package supports multiple FCM types (conventional, Interval-Value Fuzzy Number (IVFN) and Triangular Fuzzy Number (TFN)) and provides tools for model aggregation and the propagation of uncertainty from individual FCMs through to the aggregate. |
| Authors: | Ben Roston [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-9201-7579>), Meg Rippy [aut, cph, ths] (ORCID: <https://orcid.org/0000-0002-0575-8342>) |
| Maintainer: | Ben Roston <[email protected]> |
| License: | GPL (>= 3) + file LICENSE |
| Version: | 0.2.3 |
| Built: | 2026-09-17 09:07:19 UTC |
| Source: | https://github.com/bhroston/fcmconfr |
Generate an aggregate adj. matrix from a list of adj. matrices. FCM aggregation works by calculating the mean/median edge weight for all edges across the input adj. matrices (i.e. the mean/median of the edge weight connecting A -> B across all maps, the mean/median of the edge weight connecting B -> C across all maps, and so on). The user may dictate whether to incorporate 0-valued edge weights in the mean/median calculations.
All input adj. matrices must have the same dimensions and concept names to
generate an aggregate. Call standardize_adj_matrices to make
sure all adj. matrices have the same dimensions.
aggregate_fcms( adj_matrices = list(), agg_function = c("mean", "median"), include_zeroes_in_sampling = FALSE, skip_checks = FALSE )aggregate_fcms( adj_matrices = list(), agg_function = c("mean", "median"), include_zeroes_in_sampling = FALSE, skip_checks = FALSE )
adj_matrices |
[ |
agg_function |
[ |
include_zeroes_in_sampling |
[ |
skip_checks |
[ |
This function implements FCM aggregation methods used in Aminpour 2020 (https://doi.org/10.1038/s41893-019-0467-z) for use with conventional FCMs, and expands upon them for IVFN- and TFN-FCMs.
Conventional FCMs
The mean aggregate FCM of a set of conventional FCMs is:
where is the weight in the aggregate adjacency
matrix for the element in row i and column j, and is the
weight for the element in row i and column j in the adjacency matrix of
the p-th FCM.
If not including zero-valued edges in aggregation calculations, the mean aggregate equation becomes:
The median aggregate FCM of a set of conventional FCMs is:
If not including zero-valued edges in aggregation calculations, the median aggregate equation becomes:
IVFN-FCMs
The mean aggregate FCM of a set of IVFN-FCMs is:
where is the IVFN
weight (with lower bound and upper bound ) of the
element in row i and column j of the aggregate, and
and
are the lower and upper bounds of the IVFN weight of the element in row i and
column j for the p-th FCM adjacency matrix.
If not including zero-valued edges in aggregation calculations, the mean aggregate equation becomes:
The median aggregate FCM of a set of IVFN-FCMs is:
If not including zero-valued edges in aggregation calculations, the median aggregate equation becomes:
TFN-FCMs
The mean aggregate FCM of a set of TFN-FCMs is:
where is the TFN
weight (with lower bound , mode , and upper bound ) of the
element in row i and column j of the aggregate, and
, , and
are the lower bound, mode, and upper
bound of the TFN weight of the element in row i and column j for the p-th
FCM adjacency matrix.
If not including zero-valued edges in aggregation calculations, the mean aggregate equation becomes:
The median aggregate FCM of a set of TFN-FCMs is:
If not including zero-valued edges in aggregation calculations, the median aggregate equation becomes:
[aggregate]
An an aggregate adj. matrix with edges
represented as the same data types as the inputs (i.e. Numerics for, IVFNs,
or TFNs)
Aminpour P, Gray SA, Jetter AJ, Introne JE, Singer A, Arlinghaus R (2020). “Wisdom of Stakeholder Crowds in Complex Social–Ecological Systems.” Nature Sustainability, 3(3), 191–199. ISSN 2398-9629, doi:10.1038/s41893-019-0467-z.
Other aggregate_fcms:
print.aggregate()
# Aggregate Conventional FCMs aggregate_fcms(sample_fcms$simple_fcms$conventional_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # Aggregate IVFN FCMs aggregate_fcms(sample_fcms$simple_fcms$ivfn_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # Aggregate TFN FCMs aggregate_fcms(sample_fcms$simple_fcms$tfn_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # NOTE: If the lower bound of an edge weight is 0, but the upper bound is > 0, # the assumption that a stakeholder simply did not include the edge is invalid. # Thus, since the 0-lower bound is meaningful, it is included in mean/median # calculations even if include_zeroes = FALSE aggregate_fcms(sample_fcms$simple_fcms$ivfn_fcms, "mean", include_zeroes_in_sampling = FALSE)# Aggregate Conventional FCMs aggregate_fcms(sample_fcms$simple_fcms$conventional_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # Aggregate IVFN FCMs aggregate_fcms(sample_fcms$simple_fcms$ivfn_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # Aggregate TFN FCMs aggregate_fcms(sample_fcms$simple_fcms$tfn_fcms, agg_function = "mean", include_zeroes_in_sampling = TRUE, skip_checks = FALSE) # NOTE: If the lower bound of an edge weight is 0, but the upper bound is > 0, # the assumption that a stakeholder simply did not include the edge is invalid. # Thus, since the 0-lower bound is meaningful, it is included in mean/median # calculations even if include_zeroes = FALSE aggregate_fcms(sample_fcms$simple_fcms$ivfn_fcms, "mean", include_zeroes_in_sampling = FALSE)
This function generates N fcm adjacency matrices whose edge weights are sampled from edge values (that may be numeric, IVFNs, or TFNs) and stores them as a list of adjacency matrices.
The show_progress and parallel inputs change the functions called, but do NOT change the output! These are allowed to be toggled on/off to improve user control at runtime.
build_monte_carlo_fcms( adj_matrices = list(), n_samples = 1000L, include_zeroes_in_sampling = TRUE, show_progress = TRUE, silent = FALSE, skip_checks = FALSE )build_monte_carlo_fcms( adj_matrices = list(), n_samples = 1000L, include_zeroes_in_sampling = TRUE, show_progress = TRUE, silent = FALSE, skip_checks = FALSE )
adj_matrices |
[ |
n_samples |
[ |
include_zeroes_in_sampling |
[ |
show_progress |
[ |
silent |
[ |
skip_checks |
[ |
For Conventional FCMs, edge weights are sampled from edge weights explicitly defined in the input FCMs.
For IVFN and TFN FCMs, edge weights are sampled from the combined distributions representative of the IVFN/TFN edge weights. For example, if an edge is given the following weights across two maps: [0.4, 0.8)]\ and [0.5, 0.7]\, the samples will be drawn from the combined distribution: sample(N, c(runif(N, 0.4, 0.8), runif(N, 0.5, 0.7)), replace = TRUE).
[list()]
A list of empirical (Conventional) FCM adj. matrices
generated via monte carlo methods
# Conventional FCMs conventional_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE ) # IVFN FCMs ivfn_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE ) # TFN FCMs tfn_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE )# Conventional FCMs conventional_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE ) # IVFN FCMs ivfn_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE ) # TFN FCMs tfn_mc_fcms <- build_monte_carlo_fcms( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:10], n_samples = 1000, include_zeroes_in_sampling = TRUE, show_progress = FALSE, silent = FALSE, skip_checks = FALSE )
This forces the output of c() to the equivalent of list() only for inputs of type ivfn
## S3 method for class 'ivfn' c(...)## S3 method for class 'ivfn' c(...)
... |
a set of ivfn objects |
For ivfn objects, c() combines all of the lower and upper data into a single ivfn object, but list() returns the expected output of a list of distinct ivfn objects.
[list()]
A list of ivfn objects
Other interval-valued-fuzzy-numbers:
create_ivfn_fcm_from_conventional_fcm(),
ivfn(),
make_adj_matrix_w_ivfns(),
print.ivfn(),
subtract_ivfn()
c(ivfn(0, 1), ivfn(0.2, 0.5))c(ivfn(0, 1), ivfn(0.2, 0.5))
This forces the output of c() to the equivalent of list() only for inputs of type tfn
## S3 method for class 'tfn' c(...)## S3 method for class 'tfn' c(...)
... |
a set of tfn objects |
For tfn objects, c() combines all of the lower, mode, and upper data into a single tfn object, but list() returns the expected output of a list of distinct tfn objects.
a list of tfn objects
c(tfn(0, 0.5, 1), tfn(0.2, 0.4, 0.5))c(tfn(0, 0.5, 1), tfn(0.2, 0.4, 0.5))
This creates an IVFN-FCM from a Conventional FCM by adding error to the Conventional FCM edge weights.
create_ivfn_fcm_from_conventional_fcm( conventional_adj_matrix = data.frame(), error = 0.2 )create_ivfn_fcm_from_conventional_fcm( conventional_adj_matrix = data.frame(), error = 0.2 )
conventional_adj_matrix |
[ |
error |
[ |
[adj_matrix_w_ivfns]
An adjacency matrix (of class 'ivfn')
with edges represented as IVFNs
Other interval-valued-fuzzy-numbers:
c.ivfn(),
ivfn(),
make_adj_matrix_w_ivfns(),
print.ivfn(),
subtract_ivfn()
create_ivfn_fcm_from_conventional_fcm( sample_fcms$simple_fcms$conventional_fcms[[1]], error = 0.2 )create_ivfn_fcm_from_conventional_fcm( sample_fcms$simple_fcms$conventional_fcms[[1]], error = 0.2 )
This creates a TFN-FCM from a Conventional FCM by adding error to the Conventional FCM edge weights. The Conventional FCM edge weights are used as the mode values for the TFN edge weights.
create_tfn_fcm_from_conventional_fcm( conventional_adj_matrix = data.frame(), error = 0.2 )create_tfn_fcm_from_conventional_fcm( conventional_adj_matrix = data.frame(), error = 0.2 )
conventional_adj_matrix |
[ |
error |
[ |
[adj_matrix_w_tfns]
An adjacency matrix (of class 'tfn')
with edges represented as TFNs
Other triangular-fuzzy-numbers:
make_adj_matrix_w_tfns(),
print.tfn(),
subtract_tfn(),
tfn()
create_tfn_fcm_from_conventional_fcm( sample_fcms$simple_fcms$conventional_fcms[[1]], error = 0.2 )create_tfn_fcm_from_conventional_fcm( sample_fcms$simple_fcms$conventional_fcms[[1]], error = 0.2 )
Convert a fuzzy number to a crisp value. For IVFNs, return the average of the upper and lower bounds. For TFNs, return the average of the lower bound, the mode, and the upper bound.
defuzz_ivfn_or_tfn(fuzzy_number)defuzz_ivfn_or_tfn(fuzzy_number)
fuzzy_number |
[ |
Defuzz-ing an IVFN to a crisp number:
where are the lower and upper bounds of the IVFN.
Defuzz-ing a TFN to a crisp number:
where are the lower bound, mode, and upper bound
of the TFN.
[numeric(1)]
A crisp number representative of the input fuzzy
number.
defuzz_ivfn_or_tfn(ivfn(-1, 1)) defuzz_ivfn_or_tfn(tfn(-1, 0, 1))defuzz_ivfn_or_tfn(ivfn(-1, 1)) defuzz_ivfn_or_tfn(tfn(-1, 0, 1))
This function calculates the largest possible lambda for sigmoid and tanh squashing functions that guarantees convergence of an FCM simulation. Lambda is estimated such that 'squashed' simulation values are contained within the near-linear region of the sigmoid or tanh functions.
Note: The lambda value estimated will vary for different FCMs.
This algorithm is intended for conventional FCMs. If an Interval Value
Fuzzy Number (IVFN) FCM or a Triangular Fuzzy Number (TFN) FCM is provided,
estimate_fcm_lambda() will create a conventional FCM by averaging
the edge weights (upper and lower for IVFN-FCMs; and upper, mode, and lower
for TFN-FCMs) for use in calculating lambda,
estimate_fcm_lambda( adj_matrix = data.frame(), squashing = c("sigmoid", "tanh") )estimate_fcm_lambda( adj_matrix = data.frame(), squashing = c("sigmoid", "tanh") )
adj_matrix |
[ |
squashing |
[ |
This algorithm was first developed in Kottas et al. 2010 (https://doi.org/10.1007/978-3-642-03220-2_5), and expanded upon by Harmati et al. 2018 (https://doi.org/10.1109/FUZZ-IEEE.2018.8491447), and Koutsellis et al. 2022 (https://doi.org/10.1007/s12351-022-00717-x)
The function applies an algorithm that can be used to optimize lambda. It
compares the lambda calculated based on the Frobenius-norm
() and S-norm () of an
adjacency matrix and selects the minimum.
where is the lambda calculation when using the sigmoid
squashing function and is the lambda calculation when
using tanh.
The equations for were developed by
Harmati et al. 2018 (https://doi.org/10.1109/FUZZ-IEEE.2018.8491447) and are
given below.
where
is the Frobenius norm of the adj. matrix (or norm(x, type = "F")).
The equations for were developed by
Koutsellis et al. 2022 (https://doi.org/10.1007/s12351-022-00717-x). Unlike
for , the calculations for follow
different steps based on whether calculating for the sigmoid
or tanh squashing function.
For sigmoid:
For tanh:
Finally, the maximum lambda that ensures convergence of the simulation for
the input adjacency matrix is the minimum of and
.
Note: This is only algorithm included at present, but the code for
estimate_fcm_lambda is organized to streamline the addition of
new algorithms in the future.
[double(1)]
The maximum lambda that ensures simulation
convergence for the input FCM.
Kottas TL, Boutalis YS, Christodoulou MA (2010). “Fuzzy cognitive networks: Adaptive network estimation and control paradigms.” In Kacprzyk J, Glykas M (eds.), Fuzzy Cognitive Maps, volume 247, 89–134. Springer Berlin Heidelberg, Berlin, Heidelberg. ISBN 978-3-642-03219-6 978-3-642-03220-2, doi:10.1007/978-3-642-03220-2_5, Series Title: Studies in Fuzziness and Soft Computing,
Harmati IA, Koczy LT (2018). “On the Existence and Uniqueness of Fixed Points of Fuzzy Set Valued Sigmoid Fuzzy Cognitive Maps.” In 2018 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), 1–7. ISBN 9781509060207, doi:10.1109/FUZZ-IEEE.2018.8491447,
Koutsellis T, Xexakis G, Koasidis K, Nikas A, Doukas H (2022). “Parameter analysis for sigmoid and hyperbolic transfer functions of fuzzy cognitive maps.” Operational Research, 22(5), 5733–5763. ISSN 1109-2858, 1866-1505, doi:10.1007/s12351-022-00717-x,
estimate_fcm_lambda(sample_fcms$simple_fcms$conventional_fcms[[1]], squashing = "sigmoid") estimate_fcm_lambda(sample_fcms$simple_fcms$ivfn_fcms[[1]], squashing = "tanh") estimate_fcm_lambda(sample_fcms$simple_fcms$tfn_fcms[[1]], squashing = "sigmoid")estimate_fcm_lambda(sample_fcms$simple_fcms$conventional_fcms[[1]], squashing = "sigmoid") estimate_fcm_lambda(sample_fcms$simple_fcms$ivfn_fcms[[1]], squashing = "tanh") estimate_fcm_lambda(sample_fcms$simple_fcms$tfn_fcms[[1]], squashing = "sigmoid")
Display an FCM in the Viewer pane as an interactive visNetwork object. Use the shiny parameter to interact with the FCM visNetwork object and store its output in the global environment.
The shiny app provides the following functionalities: (1) interactive node placement, (2) the ability to toggle node labels and edge labels on and off, (3) the ability to change node size and shape, (4) the ability to change font size, (5) the ability to change the size of the arrowhead on directional edges, and (6) the ability to change the curvature of edges and the smoothing method used.
fcm_view( adj_matrix = data.frame(), fcm_visNetwork = list(), shiny = FALSE, ... )fcm_view( adj_matrix = data.frame(), fcm_visNetwork = list(), shiny = FALSE, ... )
adj_matrix |
[ |
fcm_visNetwork |
An fcm_view visNetwork object output. fcm_view accepts either an adj_matrix or fcm_visNetwork input but NOT both. |
shiny |
View visNetwork output in an interactive shiny app. Allows the user to manipulate and save node locations and other plot characteristics. Outputs are saved as fcm_visNetwork objects. |
... |
For advanced use. Set alert_on_open = FALSE to remove the alert pop-up that describes how to save visNetwork outputs. |
a visNetwork object that plots FCM networks in the Viewer pane; if shiny = TRUE, plots FCM networks in a shiny app
Other utility:
get_fcmconfr_inferences()
adj_matrix <- sample_fcms$simple_fcms$conventional_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE) adj_matrix <- sample_fcms$simple_fcms$ivfn_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE) adj_matrix <- sample_fcms$simple_fcms$tfn_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE)adj_matrix <- sample_fcms$simple_fcms$conventional_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE) adj_matrix <- sample_fcms$simple_fcms$ivfn_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE) adj_matrix <- sample_fcms$simple_fcms$tfn_fcms[[1]] fcm_view(adj_matrix = adj_matrix, shiny = FALSE)
This is the primary function of the fcmconfr package. This function performs the following three analyses on the input fuzzy cognitive maps (FCMs).
Dynamic Simulation: The dynamic behavior of one or more input FCMs is evaluated in response to a perturbation. Two types of simulations can be performed, pulse and clamped.
Pulse: In pulse simulations one or more nodes are transiently perturbed (the scenario) and allowed to relax back to equilibrium over multiple iterations to understand the effect those nodes have on the network. Scenarios are established using the initial state vector (non-zero values perturb a node). All values in the clamping vector must be set to zero (Stylios, 1997).
Clamped: In clamped simulations, one or more nodes of interest are continuously activated (the scenario) and the result is compared to baseline conditions. Scenarios are established using the clamping vector (non-zero values clamp a node) and the baseline is established by setting all nodes in the initial state vector to one (i.e., it represents the response of the network to a transient pulse event involving all nodes) (Ozesmi & Ozesmi, 2003).
The final response of each node of an FCM in a scenario is known as an inference. Inferences can be calculated using the maximum (peak) or the final resting state (final) of a node. In pulse simulations inferences are the difference between either of these two measures and zero. In clamped simulations inferences are the difference between either of these measures in the scenario and their equivalent values in the baseline simulation. Simulations can be run using different activation functions (Kosko, Modified-Kosko, or Rescale) and squashing functions (sigmoid, tanh)
Conventional FCM simulations use the traditional FCM simulation algorithm as established in Kosko (1986); Stylios (1997); Ozesmi & Ozesmi (2003), etc. (See Details for equations)
IVFN- and TFN-FCM simulations use the algorithm from Yesil et al. (2014) where average values of IVFN and TFN elements in state vectors are passed to the IVFN- or TFN-FCM adjacency matrix. (See Details for equations)
Model Aggregation: Generates a single "collective" adjacency matrix from a list of adjacency matrices. Aggregation is performed by calculating the mean/median edge weight for all edges included in a set of input FCMs (i.e. the mean/median of the edge weight connecting A->B across all maps, the mean/median of the edge weight connecting B->C across all maps, and so on) (Aminpour et al., 2020). The user specifies whether 0-valued edge weights (reflecting the absence of a connection between two nodes) should be included when calculating the mean/median.
Aggregate analysis can be toggled off to reduce runtime.
Monte Carlo Analysis: This method assesses uncertainty in dynamic
simulations by generating a distribution of possible inferences. Edge
weights are randomly sampled from the input FCMs to construct a set of
Monte Carlo FCMs. Each FCM undergoes dynamic simulation, producing
inferences per node. These inferences represent the range of possible
values each node may assume.
Min, Max, Median, and 25th/75th quantiles are estimated for each node. Bootstrapping (optional) can also be performed to estimat 95% confidence bounds about the mean or median inference for each node.
Monte Carlo analysis can be toggled off to reduce runtime.
fcmconfr can accommodate three types of FCMs. Note that each FCM type
must be analyzed separately (i.e. they cannot be co-evaluated in a single
input set). The three supported types of FCMs include:
Conventional FCMs, where edge weights are single-valued fuzzy numbers (Stylios, 1997).
Interval-Valued Fuzzy Number (IVFN) FCMs, which are an extension of conventional FCMs. IVFN-FCMs represent edge weights as ranges [min, max]\, where any value within the range is equally as likely as any other (i.e., the probability distribution for each edge is uniform) (Moore & Lodwick, 2003; Hajek & Prochazka, 2016); and
Triangular Fuzzy Number (TFN) FCMs, which are an extension of IVFN-FCMs. TFN-FCMs also represent edge weights as ranges, but assume that one value within the range (the mode) is most likely and values closer to the central value are more likely than those further away (i.e., the probability distribution for each edge is triangular) (Yesil et al., 2014).
The fcmcofnr package includes fcmconfr_gui, an interactive GUI tool
that can be used to select appropriate values for each argument in
fcmconfr().
fcmconfr( adj_matrices = list(), agg_function = c("mean", "median"), num_mc_fcms = 1000L, initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, ci_centering_function = c("mean", "median"), confidence_interval = 0.95, num_ci_bootstraps = 1000L, show_progress = TRUE, parallel = FALSE, n_cores = 1L, run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE, silent = FALSE )fcmconfr( adj_matrices = list(), agg_function = c("mean", "median"), num_mc_fcms = 1000L, initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, ci_centering_function = c("mean", "median"), confidence_interval = 0.95, num_ci_bootstraps = 1000L, show_progress = TRUE, parallel = FALSE, n_cores = 1L, run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE, silent = FALSE )
adj_matrices |
[ |
agg_function |
[ |
num_mc_fcms |
[ |
initial_state_vector |
[ |
clamping_vector |
[ |
activation |
[ |
squashing |
[ |
lambda |
[ |
point_of_inference |
[ |
max_iter |
[ |
min_error |
[ |
ci_centering_function |
[ |
confidence_interval |
[ |
num_ci_bootstraps |
[ |
show_progress |
[ |
parallel |
[ |
n_cores |
[ |
run_agg_calcs |
[ |
run_mc_calcs |
[ |
run_ci_calcs |
TRUE/FALSE Run the code to estimate the 95 percent CI bounds about the means of the inferences of the monte carlo adj matrices |
include_zeroes_in_sampling |
[ |
include_sims_in_output |
[ |
silent |
[ |
FCM simulations are iterative applications of an activation function
() that describes how node values at a particular state
() are influenced by the edge weights defined in the
adjacency matrix () to calculate the node values at the following
state (), and a squashing function () that
restricts node values within a particular range.
In conventional FCM simulations the current state vector () is
used to calculate the next state vector ().
In IVFN- and TFN-FCM simulations, the current state vector has to be translated into crisp values prior to calculating the next state vector.
Formulas for crisp values:
Formulas for next state vector:
fcmconfr supports the Kosko, Modified-Kosko, and Rescale activation
functions as defined here:
Kosko (Kosko, 1986)
Modfied-Kosko (Stylio & Groumpos, 2004)
Rescale (Papageorgiou, 2011; Dikopoulou, 2021)
fcmconfr supports the sigmoid and hyperbolic tangent (tanh) squashing
functions.
A list of outputs generated from the individual_fcms simulations, aggregate_fcm analysis, and monte_carlo_fcms analysis. Bootstrap estimates of inferences from monte carlo analysis are included, as well as function inputs.
Özesmi U, Özesmi S (2003). “A Participatory Approach to Ecosystem Conservation: Fuzzy Cognitive Maps and Stakeholder Group Analysis in Uluabat Lake, Turkey.” Environmental Management, 31(4), 518–531. ISSN 0364-152X, 1432-1009, doi:10.1007/s00267-002-2841-1.
Aminpour P, Gray SA, Jetter AJ, Introne JE, Singer A, Arlinghaus R (2020). “Wisdom of Stakeholder Crowds in Complex Social–Ecological Systems.” Nature Sustainability, 3(3), 191–199. ISSN 2398-9629, doi:10.1038/s41893-019-0467-z.
Stylios CD, Georgopoulos VC, Groumpos PP (1997). “Introducing the Theory of Fuzzy Cognitive Maps in Distributed Systems.” In Proceedings of 12th IEEE International Symposium on Intelligent Control, 55–60. doi:10.1109/ISIC.1997.626413.
Moore R, Lodwick W (2003). “Interval Analysis and Fuzzy Set Theory.” Fuzzy Sets and Systems, 135(1), 5–9. ISSN 01650114, doi:10.1016/S0165-0114(02)00246-4.
Hajek P, Prochazka O (2016). “Interval-valued fuzzy cognitive maps for supporting business decisions.” In 2016 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), 531–536. ISBN 978-1-5090-0626-7, doi:10.1109/FUZZ-IEEE.2016.7737732,
Yesil E, Dodurka MF, Urbas L (2014). “Triangular fuzzy number representation of relations in Fuzzy Cognitive Maps.” In 2014 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), 1021–1028. ISBN 9781479920723, doi:10.1109/FUZZ-IEEE.2014.6891653,
Stylios CD, Groumpos PP (2004). “Modeling complex systems using fuzzy cognitive maps.” IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans, 34(1), 155–162. ISSN 1558-2426, doi:10.1109/TSMCA.2003.818878,
Papageorgiou EI (2011). “A new methodology for Decisions in Medical Informatics using fuzzy cognitive maps based on fuzzy rule-extraction techniques.” Applied Soft Computing, 11(1), 500–513. ISSN 1568-4946, doi:10.1016/j.asoc.2009.12.010,
Dikopoulou Z (2021). “Fuzzy Cognitive Maps.” In Dikopoulou Z (ed.), Modeling and Simulating Complex Business Perceptions : Using Graphical Models and Fuzzy Cognitive Maps, 27–42. Springer International Publishing, Cham. ISBN 9783030814960, doi:10.1007/978-3-030-81496-0_3,
# Conventional FCMs ex_conventional_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE ) # IVFN FCM fcmconfr ex_ivfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE ) # TFN FCM fcmconfr ex_tfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE )# Conventional FCMs ex_conventional_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE ) # IVFN FCM fcmconfr ex_ivfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE ) # TFN FCM fcmconfr ex_tfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:10], # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'modified-kosko', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = FALSE, include_sims_in_output = TRUE )
fcmconfr_gui performs two tasks: (1) it launches a Shiny app that
lets users interactively select parameters and (2) it outputs a corresponding
call to fcmconfr that users can copy-and-paste to run in their
own scripts.
No inputs are provided to fcmconfr_gui, but the local environment
must have an individual FCM or a list object containing multiple FCMs in
order for fcmconfr_gui to be used. Once fcmconfr_gui is running
the user selects the appropriate FCMs to analyze from a dropdown menu titled
Adj. Matrix or List of Adj. Matrices.
The GUI interface is organized into four tabs: Data, Agg. and Monte Carlo Options, Simulation Options, and Runtime Options, which are described further below.
Data: In the Data tab, the user selects the FCMs they want to analyze (drop-down menu titled 'Adj. Matrix or List of Adj. Matrices'). It is also where they manipulate values in the Initial State (Pulse) Vector or Clamping Vector to identify the dynamic simulations they wish to explore. A common form of simulation is a "clamped" simulation where every value in the Initial State (Pulse) Vector is set to 1 and only the node(s)-of-interest are set to 1 in the Clamping Vector. In this configuration, the Initial State (Pulse) Vector is used to determine the network's state at equilibrium and the Clamping Vector is used to determine the network's state in response to continuous activation of one or more nodes. The difference between the two is a measure of the impact of those particular nodes on the system.
Agg. and Monte Carlo Option: In the Agg. and Monte Carlo Options tab, the user specifies their preferences regarding FCM aggregation and Monte Carlo sampling. Aggregation options are only available when datasets contain multiple FCMs. Monte Carlo sampling is available for list objects of conventional, IVFN-, and TFN-FCMs as well as individual IVFN-/TFN-FCMs, but not individual conventional FCMs. Aggregation and Monte Carlo options can be toggled off to speed up the simulation process.
Aggregation options allow the user to specify whether multiple FCMs should be aggregated into a single collective model so that dynamic simulations can be performed on the aggregate in addition to individual FCMs. The user can specify the aggregation method (mean or median) and whether zero-weighted edges should be included in the aggregation process.
Monte Carlo options allow the user to specify whether Monte Carlo sampling should be performed to estimate uncertainty in dynamic simulation outputs. If yes, the user must specify the number of FCMs that will be generated by Monte Carlo sampling (we recommend 1000 or more). Dynamic simulations will be performed on each of these FCMs, providing a range of inferences for each node, from which the median state and quantiles (25th, 75th) will be estimated. The user also has the option to perform nonparametric bootstrapping to estimate confidence bounds about the average inference for each node. Confidence limits are user specified (e.g., 95th percentile, 90th percentile, etc.).
Simulation Options: In the Simulation Options tab, the user specify the
type of dynamic simulation to perform. This includes specifying (1) the
activation function (Kosko, Modified-Kosko, or Rescale; default of Kosko),
(2) the squashing function (sigmoid or hyperbolic tangent; default of
sigmoid), (3) the squashing function's key parameter, lambda (default of 1),
(4) the final simulation output (i.e., the peak estimate for each node or its
final resting state; default of final) (5) the maximum number of iterations
to perform per simulation (default of 100), and (6) the minimum acceptable
error between iterations (default of )
Runtime Options: In the Runtime Options tab, the user may specify whether
they want to use parallel processing and have a progress bar displayed at
runtime. These options do not impact simulation outputs. They do, however,
influence how long fcmconfr takes to run and what the user
sees at runtime.
A brief summary of each parameter within the fcmconfr_gui is
provided in a glossary stored in a side tab within the GUI. The side tab
can be opened by clicking the arrow symbol in the top-right-hand-corner of
the GUI.
fcmconfr_gui()fcmconfr_gui()
On exit, this function outputs a copy-and-paste sample script
to call fcmconfr with the selected inputs.
NULLNULL
Given an fcmconfr output object, return the inferences of all or just a specific analysis
get_fcmconfr_inferences( fcmconfr_result_obj = list(), analysis = c("individual", "aggregate", "mc") )get_fcmconfr_inferences( fcmconfr_result_obj = list(), analysis = c("individual", "aggregate", "mc") )
fcmconfr_result_obj |
[ |
analysis |
[ |
[list() or data.frame()]
A dataframe (or list of dataframes)
of inferences from the selected analysis (analyses)
Other utility:
fcm_view()
ex_conventional_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$conventional_fcms, # adj_matrices = group_conventional_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 100L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_conventional_fcmconfr) ex_ivfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms, # adj_matrices = group_ivfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 10L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 10L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_ivfn_fcmconfr) ex_tfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms, # adj_matrices = group_tfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 1000L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 1000L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 1000L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_tfn_fcmconfr)ex_conventional_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$conventional_fcms, # adj_matrices = group_conventional_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 100L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_conventional_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_conventional_fcmconfr) ex_ivfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms, # adj_matrices = group_ivfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 10L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 10L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_ivfn_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_ivfn_fcmconfr) ex_tfn_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms, # adj_matrices = group_tfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 1000L, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1.0, point_of_inference = "final", max_iter = 1000L, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, num_ci_bootstraps = 1000L, # Runtime Options show_progress = TRUE, parallel = FALSE, n_cores = 1L, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual")) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual", "aggregate")) get_fcmconfr_inferences(ex_tfn_fcmconfr, analysis = c("individual", "aggregate", "mc")) get_fcmconfr_inferences(ex_tfn_fcmconfr)
This compares the baseline simulation of an fcm with the input scenario (scenario vector) to estimate how outputs change compared to the structural or expected behavior of the system.
infer_fcm( adj_matrix = data.frame(), initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, skip_checks = FALSE )infer_fcm( adj_matrix = data.frame(), initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, skip_checks = FALSE )
adj_matrix |
[ |
initial_state_vector |
[ |
clamping_vector |
[ |
activation |
[ |
squashing |
[ |
lambda |
[ |
point_of_inference |
[ |
max_iter |
[ |
min_error |
[ |
skip_checks |
[ |
This function performs two fcm simulations and compares the output between the two. The first simulation considers the baseline activity where no nodes are "clamped" and the system behaves without any outside inputs. The second simulation considers a scenario where one or multiple nodes are "clamped" so that the system is reactive to additional inputs. The function returns the difference in simulation results between the scenario and baseline activity to understand how system manipulations compare to structural expectations of the system.
This function produces the same output as mental modeler for the following inputs:
initial_state_vector = c(1, 1, ..., 1)
activation = "kosko"
squashing = either "sigmoid" or "tanh"
lambda = 1
[infer_conventional_fcm or infer_ivfn_or_tfn_fcm]
A list of
FCM inference results (including baseline and simulation outputs)
# # Inference w/ Conventional FCMs conventional_inference <- infer_fcm(sample_fcms$simple_fcms$conventional_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE) # # Inference w/ Interval-Valued Fuzzy Numbers (IVFNs) ivfn_inference <- infer_fcm(sample_fcms$simple_fcms$ivfn_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "kosko", squashing = "tanh", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE) # # # Inference w/ Triangular Fuzzy Numbers (TFNs) tfn_inference <- infer_fcm(sample_fcms$simple_fcms$tfn_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "rescale", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE)# # Inference w/ Conventional FCMs conventional_inference <- infer_fcm(sample_fcms$simple_fcms$conventional_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE) # # Inference w/ Interval-Valued Fuzzy Numbers (IVFNs) ivfn_inference <- infer_fcm(sample_fcms$simple_fcms$ivfn_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "kosko", squashing = "tanh", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE) # # # Inference w/ Triangular Fuzzy Numbers (TFNs) tfn_inference <- infer_fcm(sample_fcms$simple_fcms$tfn_fcms[[4]], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "rescale", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, skip_checks = FALSE)
This function simulates a set of FCMs (Conventional, IVFN, and/or TFN) (whose edge weights were sampled using monte carlo methods) by iteratively calling the infer_fcm function for each adj. matrix in the set.
infer_fcm_set( adj_matrices = list(matrix()), initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, parallel = TRUE, n_cores = 1L, show_progress = TRUE, include_sims_in_output = FALSE, silent = FALSE, skip_checks = FALSE )infer_fcm_set( adj_matrices = list(matrix()), initial_state_vector = c(), clamping_vector = c(), activation = c("kosko", "modified-kosko", "rescale"), squashing = c("sigmoid", "tanh"), lambda = 1, point_of_inference = c("peak", "final"), max_iter = 100L, min_error = 1e-05, parallel = TRUE, n_cores = 1L, show_progress = TRUE, include_sims_in_output = FALSE, silent = FALSE, skip_checks = FALSE )
adj_matrices |
[ |
initial_state_vector |
[ |
clamping_vector |
[ |
activation |
[ |
squashing |
[ |
lambda |
[ |
point_of_inference |
[ |
max_iter |
[ |
min_error |
[ |
parallel |
[ |
n_cores |
[ |
show_progress |
[ |
include_sims_in_output |
[ |
silent |
[ |
skip_checks |
[ |
The show_progress and parallel inputs change how the function is run, but do NOT change the output! These are allowed to be toggled on/off to improve user control at runtime.
[inference_of_fcm_set]
A list/data.frame of the inferences
(and simulations if included) for each FCM in the set
# Set of Conventional FCMs conventional_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE ) # Set of IVFN FCMs ivfn_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE ) # Set of TFN FCMs tfn_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE )# Set of Conventional FCMs conventional_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$conventional_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE ) # Set of IVFN FCMs ivfn_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$ivfn_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE ) # Set of TFN FCMs tfn_fcm_set_inferences <- infer_fcm_set( adj_matrices = sample_fcms$simple_fcms$tfn_fcms[1:5], initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = "modified-kosko", squashing = "sigmoid", lambda = 1.0, point_of_inference = "final", max_iter = 100L, min_error = 1e-5, parallel = FALSE, n_cores = 1L, show_progress = FALSE, include_sims_in_output = TRUE, silent = FALSE, skip_checks = FALSE )
This constructs an interval-valued fuzzy number (ivfn) that represents a continuous, uniform distribution of values within a given range
ivfn(lower = double(), upper = double())ivfn(lower = double(), upper = double())
lower |
[ |
upper |
[ |
The IVFN class does not perform any operations on its input, rather it checks whether the input follows the defining criteria of IVFNs
For IVFNs, the lower bound must be less than or equal to the upper bound. If the lower bound and upper bound are equal, the IVFN represents a "crisp" numeric value.
where and are the lower and upper bounds of the IVFN.
[ivfn]
An interval-valued fuzzy number (IVFN)
Moore R, Lodwick W (2003). “Interval Analysis and Fuzzy Set Theory.” Fuzzy Sets and Systems, 135(1), 5–9. ISSN 01650114, doi:10.1016/S0165-0114(02)00246-4.
Dimuro GP (2011). “On Interval Fuzzy Numbers.” In 2011 Workshop-School on Theoretical Computer Science, 3–8. ISBN 978-0-7695-4628-5 978-1-4673-0225-8, doi:10.1109/WEIT.2011.19.
Other interval-valued-fuzzy-numbers:
c.ivfn(),
create_ivfn_fcm_from_conventional_fcm(),
make_adj_matrix_w_ivfns(),
print.ivfn(),
subtract_ivfn()
ivfn(lower = 0.0, upper = 1.0) ivfn(-1.0, 1.0)ivfn(lower = 0.0, upper = 1.0) ivfn(-1.0, 1.0)
This constructs an adjacency matrix with edges represented by interval-valued fuzzy numbers (IVFNs) from an adjacency matrix of lower bounds and an adjacency matrix of upper bounds
make_adj_matrix_w_ivfns(lower = data.frame(), upper = data.frame())make_adj_matrix_w_ivfns(lower = data.frame(), upper = data.frame())
lower |
[ |
upper |
[ |
The input adjacency matrices must be square n x n matrices with the same dimensions. The input can be either matrix, data.table, tibble, or data.table type objects, but the output will always be a data.frame. This is for output readability. data.table and tibble objects work logically, but their outputs require additional steps to parse from the user's perspective.
If the input matrices have named columns, those names will be carried over in the IVFN-FCM adjacency matrix. Otherwise, generic node IDs will be used (C1, C2, ... Cn).
[adj_matrix_w_ivfns]
An adjacency matrix (of class 'ivfn')
with edges represented as IVFNs
Other interval-valued-fuzzy-numbers:
c.ivfn(),
create_ivfn_fcm_from_conventional_fcm(),
ivfn(),
print.ivfn(),
subtract_ivfn()
lower_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) upper_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.6, 0) ) make_adj_matrix_w_ivfns(lower = lower_adj_matrix, upper = upper_adj_matrix)lower_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) upper_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.6, 0) ) make_adj_matrix_w_ivfns(lower = lower_adj_matrix, upper = upper_adj_matrix)
This constructs an adjacency matrix with edges represented by triangular fuzzy numbers (TFNs) from an adjacency matrix of lower bounds, an adjacency matrix of modes, and an adjacency matrix of upper bounds
make_adj_matrix_w_tfns( lower = data.frame(), mode = data.frame(), upper = data.frame() )make_adj_matrix_w_tfns( lower = data.frame(), mode = data.frame(), upper = data.frame() )
lower |
[ |
mode |
[ |
upper |
[ |
The input adjacency matrices must be square n x n matrices with the same dimensions. The input can be either matrix, data.table, tibble, or data.table type objects, but the output will always be a data.frame. This is for output readability. data.table and tibble objects work logically, but their outputs require additional steps to parse from the user's perspective.
If the input matrices have named columns, those names will be carried over in the triangular adjacency matrix. Otherwise, generic node IDs will be used (C1, C2, ... Cn).
[adj_matrix_w_tfns]
An adjacency matrix (of class 'tfn') with
edges represented as TFNs
Other triangular-fuzzy-numbers:
create_tfn_fcm_from_conventional_fcm(),
print.tfn(),
subtract_tfn(),
tfn()
make_adj_matrix_w_tfns( lower = matrix(data = c(0, 0.2, 0, 0.5), nrow = 2, ncol = 2), mode = matrix(data = c(0, 0.3, 0, 0.6), nrow = 2, ncol = 2), upper = matrix(data = c(0, 0.4, 0, 0.7), nrow = 2, ncol = 2) ) lower_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) mode_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) upper_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.6, 0) ) make_adj_matrix_w_tfns(lower_adj_matrix, mode_adj_matrix, upper_adj_matrix)make_adj_matrix_w_tfns( lower = matrix(data = c(0, 0.2, 0, 0.5), nrow = 2, ncol = 2), mode = matrix(data = c(0, 0.3, 0, 0.6), nrow = 2, ncol = 2), upper = matrix(data = c(0, 0.4, 0, 0.7), nrow = 2, ncol = 2) ) lower_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) mode_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.4, 0) ) upper_adj_matrix <- data.frame( "A" = c(0, 0), "B" = c(0.6, 0) ) make_adj_matrix_w_tfns(lower_adj_matrix, mode_adj_matrix, upper_adj_matrix)
This plots the output of fcmconfr() using ggplot. Set shiny = TRUE to load plot in a Shiny app and toggle on/off results from different analyses.
## S3 method for class 'fcmconfr' plot( x, include = "all", shiny = FALSE, filter_limit = 0.001, xlim = NA, coord_flip = FALSE, text_font_size = NA, mc_avg_and_CIs_color = "blue", mc_inferences_color = "blue", mc_inferences_size = 1, mc_inferences_alpha = 0.3, mc_inferences_shape = 3, ind_inferences_color = "black", ind_inferences_size = 1, ind_inferences_alpha = 1, ind_inferences_shape = 16, agg_inferences_color = "red", agg_inferences_size = 1, agg_inferences_alpha = 1, agg_inferences_shape = 17, mc_avg_and_CIs_linewidth = 0.1, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6, ... )## S3 method for class 'fcmconfr' plot( x, include = "all", shiny = FALSE, filter_limit = 0.001, xlim = NA, coord_flip = FALSE, text_font_size = NA, mc_avg_and_CIs_color = "blue", mc_inferences_color = "blue", mc_inferences_size = 1, mc_inferences_alpha = 0.3, mc_inferences_shape = 3, ind_inferences_color = "black", ind_inferences_size = 1, ind_inferences_alpha = 1, ind_inferences_shape = 16, agg_inferences_color = "red", agg_inferences_size = 1, agg_inferences_alpha = 1, agg_inferences_shape = 17, mc_avg_and_CIs_linewidth = 0.1, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6, ... )
x |
A direct output of the |
include |
[ |
shiny |
[ |
filter_limit |
[ |
xlim |
[ |
coord_flip |
[ |
text_font_size |
[ |
mc_avg_and_CIs_color |
[ |
mc_inferences_color |
[ |
mc_inferences_size |
[ |
mc_inferences_alpha |
[ |
mc_inferences_shape |
[ |
ind_inferences_color |
[ |
ind_inferences_size |
[ |
ind_inferences_alpha |
[ |
ind_inferences_shape |
[ |
agg_inferences_color |
[ |
agg_inferences_size |
[ |
agg_inferences_alpha |
[ |
agg_inferences_shape |
[ |
mc_avg_and_CIs_linewidth |
[ |
ind_ivfn_and_tfn_linewidth |
[ |
agg_ivfn_and_tfn_linewidth |
[ |
... |
Additional inputs |
Generates a generic plot visualizing fcmconfr results.
A plot of an fcmconfr object's results
# Example using TFN FCMs fcmconfr tfn_example_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms, # adj_matrices = group_tfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1, point_of_inference = "final", max_iter = 1000, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) # Plot Defaults plot(tfn_example_fcmconfr, interactive = FALSE, # Set to TRUE to open shiny app # Plot Formatting Parameters filter_limit = 1e-4, xlim = c(-1, 1), coord_flip = FALSE, text_font_size = NA, # Plot Aesthetic Parameters mc_avg_and_CIs_color = "blue", mc_inferences_color = "blue", mc_inferences_alpha = 0.3, mc_inferences_shape = 3, ind_inferences_color = "black", ind_inferences_alpha = 1, ind_inferences_shape = 16, agg_inferences_color = "red", agg_inferences_alpha = 1, agg_inferences_shape = 17, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6 ) # Different from Plot Defaults plot(tfn_example_fcmconfr, interactive = FALSE, # Set to TRUE to open shiny app # Plot Formatting Parameters filter_limit = 1e-4, xlim = c(-0.6, 0.6), coord_flip = FALSE, # Plot Aesthetic Parameters mc_avg_and_CIs_color = "darkblue", mc_inferences_color = "darkblue", mc_inferences_shape = 3, ind_inferences_color = "maroon", ind_inferences_shape = 16, agg_inferences_color = "grey", agg_inferences_shape = 17, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6 ) # Plot Defaults w/ Shiny App # plot(tfn_example_fcmconfr, # shiny = TRUE, # Set to TRUE to open shiny app # # Plot Formatting Parameters # filter_limit = 1e-4, # coord_flip = FALSE, # text_font_size = 12, # # Plot Aesthetic Parameters # mc_avg_and_CIs_color = "blue", # mc_inferences_color = "blue", # mc_inferences_shape = 3, # ind_inferences_color = "black", # ind_inferences_shape = 16, # agg_inferences_color = "red", # agg_inferences_shape = 17, # ind_ivfn_and_tfn_linewidth = 0.1, # agg_ivfn_and_tfn_linewidth = 0.6 # )# Example using TFN FCMs fcmconfr tfn_example_fcmconfr <- fcmconfr( adj_matrices = sample_fcms$simple_fcms$tfn_fcms, # adj_matrices = group_tfn_fcms, # Aggregation and Monte Carlo Sampling agg_function = 'mean', num_mc_fcms = 100, # Simulation initial_state_vector = c(1, 1, 1, 1, 1, 1, 1), clamping_vector = c(1, 0, 0, 0, 0, 0, 0), activation = 'rescale', squashing = 'sigmoid', lambda = 1, point_of_inference = "final", max_iter = 1000, min_error = 1e-05, # Inference Estimation (bootstrap) ci_centering_function = "mean", confidence_interval = 0.95, # Runtime Options show_progress = TRUE, parallel = FALSE, # Additional Options run_agg_calcs = TRUE, run_mc_calcs = TRUE, run_ci_calcs = TRUE, include_zeroes_in_sampling = TRUE, include_sims_in_output = TRUE ) # Plot Defaults plot(tfn_example_fcmconfr, interactive = FALSE, # Set to TRUE to open shiny app # Plot Formatting Parameters filter_limit = 1e-4, xlim = c(-1, 1), coord_flip = FALSE, text_font_size = NA, # Plot Aesthetic Parameters mc_avg_and_CIs_color = "blue", mc_inferences_color = "blue", mc_inferences_alpha = 0.3, mc_inferences_shape = 3, ind_inferences_color = "black", ind_inferences_alpha = 1, ind_inferences_shape = 16, agg_inferences_color = "red", agg_inferences_alpha = 1, agg_inferences_shape = 17, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6 ) # Different from Plot Defaults plot(tfn_example_fcmconfr, interactive = FALSE, # Set to TRUE to open shiny app # Plot Formatting Parameters filter_limit = 1e-4, xlim = c(-0.6, 0.6), coord_flip = FALSE, # Plot Aesthetic Parameters mc_avg_and_CIs_color = "darkblue", mc_inferences_color = "darkblue", mc_inferences_shape = 3, ind_inferences_color = "maroon", ind_inferences_shape = 16, agg_inferences_color = "grey", agg_inferences_shape = 17, ind_ivfn_and_tfn_linewidth = 0.1, agg_ivfn_and_tfn_linewidth = 0.6 ) # Plot Defaults w/ Shiny App # plot(tfn_example_fcmconfr, # shiny = TRUE, # Set to TRUE to open shiny app # # Plot Formatting Parameters # filter_limit = 1e-4, # coord_flip = FALSE, # text_font_size = 12, # # Plot Aesthetic Parameters # mc_avg_and_CIs_color = "blue", # mc_inferences_color = "blue", # mc_inferences_shape = 3, # ind_inferences_color = "black", # ind_inferences_shape = 16, # agg_inferences_color = "red", # agg_inferences_shape = 17, # ind_ivfn_and_tfn_linewidth = 0.1, # agg_ivfn_and_tfn_linewidth = 0.6 # )
Plot rtriangular_dist distribution similar to how runif is plotted with the base plot function
## S3 method for class 'rtriangular_dist' plot(x, ...)## S3 method for class 'rtriangular_dist' plot(x, ...)
x |
[ |
... |
additional inputs (leave empty) |
A plot of the triangular distribution generated by rtriangular_dist (in the vain of plot(runif(...)))
plot(rtriangular_dist(n = 1000L, lower = -1.0, mode = 0.0, upper = 1.0))plot(rtriangular_dist(n = 1000L, lower = -1.0, mode = 0.0, upper = 1.0))
Print method for aggregate
## S3 method for class 'aggregate' print(x, ...)## S3 method for class 'aggregate' print(x, ...)
x |
[ |
... |
additional inputs |
[NULL]
A console printout of aggregate_fcm output
Other aggregate_fcms:
aggregate_fcms()
NULLNULL
This improves the readability of the fcmconfr output
## S3 method for class 'fcmconfr' print(x, ...)## S3 method for class 'fcmconfr' print(x, ...)
x |
[ |
... |
additional inputs |
Show the objects listed in the fcmconfr output $inference and $params,
as well as $bootstrap if present in output. Additionally, this prints
descriptions/summaries of objects within each sub-list like inference_opts,
bootstrap_input_opts, etc.
A console printout of fcmconfr results
NULLNULL
This prints an ivfn object
## S3 method for class 'ivfn' print(x, ...)## S3 method for class 'ivfn' print(x, ...)
x |
[ |
... |
additional inputs |
[NULL]
A console printout of an IVFN object
Other interval-valued-fuzzy-numbers:
c.ivfn(),
create_ivfn_fcm_from_conventional_fcm(),
ivfn(),
make_adj_matrix_w_ivfns(),
subtract_ivfn()
print(ivfn(-1, 1))print(ivfn(-1, 1))
This prints a summary object of the fcmconfr output
## S3 method for class 'summary.fcmconfr' print(x, ...)## S3 method for class 'summary.fcmconfr' print(x, ...)
x |
[ |
... |
additional inputs |
Show the objects listed in the fcmconfr output $inference and $params,
as well as $bootstrap if present in output. Additionally, this prints
descriptions/summaries of objects within each sub-list like inference_opts,
bootstrap_input_opts, etc.
A console printout (summary) of fcmconfr results
NULLNULL
This improves the readability of the output
This prints a tfn object
## S3 method for class 'tfn' print(x, ...)## S3 method for class 'tfn' print(x, ...)
x |
a tfn object |
... |
additional inputs |
A console printout of a TFN object
Other triangular-fuzzy-numbers:
create_tfn_fcm_from_conventional_fcm(),
make_adj_matrix_w_tfns(),
subtract_tfn(),
tfn()
tfn(-1, 0, 1)tfn(-1, 0, 1)
This function generates a triangular distribution on the interval from lower to upper bounds with a a given mode,
rtriangular_dist( n = integer(), lower = double(), mode = double(), upper = double() )rtriangular_dist( n = integer(), lower = double(), mode = double(), upper = double() )
n |
[ |
lower |
[ |
mode |
[ |
upper |
[ |
[rtriangular_dist]
a vector of values representing a
triangular distribution
rtriangular_dist(n = 100L, lower = -1.0, mode = 0.0, upper = 1.0) x <- rtriangular_dist(n = 1000L, lower = -0.5, mode = 0.0, upper = 0.5) # hist(x) x <- rtriangular_dist(100L, 0.0, 0.0, 0.5) # hist(x)rtriangular_dist(n = 100L, lower = -1.0, mode = 0.0, upper = 1.0) x <- rtriangular_dist(n = 1000L, lower = -0.5, mode = 0.0, upper = 0.5) # hist(x) x <- rtriangular_dist(100L, 0.0, 0.0, 0.5) # hist(x)
An collection of FCM datasets based on stakeholder perceptions of rising salinization of a local reservoir in a socio-ecological system. This collection is separated into two sub-collections: one with larger FCMs that incorporate over 40 nodes, and one with smaller, simpler FCMs that greatly reduce the number of nodes (n = 7) per map. The sub-collection of smaller, simplified FCMs is included to hasten testing.
sample_fcmssample_fcms
sample_fcmsA collection of simple and large FCMs with conventional, ivfn, and tfn edge types
$simple_fcms: these FCMs are filtered versions of the larger FCMs which only include the following nodes, Guidance.Docs.for.Salt.Management, Public.Education.Programs, Salts.Added.during.Water.Treatment, Salts.Added.by.Winter.Maintenance.Activities, Ecosystem.Health, Public.Awareness.of.Reservoir.Salinization, and Salinization.of.the.Reservoir. (Renamd, but based on nodes in larger FCMs)
$conventional_fcms: A list of smaller, simplified conventional FCMs
$ivfn_fcms: A list of smaller, simplified ivfn FCMs
$tfn_fcms: A list of smaller, simplified tfn FCMs $large_fcms: these FCMs are large (n > 40) and will likely increase runtimes but represent a more complete dataset
$conventional_fcms: A list of large conventional FCMs
$ivfn_fcms: A list of large ivfn FCMs
$tfn_fcms: A list of large tfn FCMs
Given in Rippy et al, (In Review); Not all stakeholder FCMs used here.
Given a list of adj. matrices of different sizes, transforms the inputs into adj. matrices of the same size with 0-values added where edges are undefined or not included in maps.
Solves the problem where Map 1 has nodes A and B but Map 2 has nodes B and C and the user needs to analyse them both together.
standardize_adj_matrices(adj_matrices = list())standardize_adj_matrices(adj_matrices = list())
adj_matrices |
[ |
[list()]
A list of adjacency matrices constructed from the
input adj. matrices, that contain the same concepts (and dimensions).
Rows/Columns of added concepts are all 0's.
# Standardize Conventional FCMs adj_matrix_1 <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) adj_matrix_2 <- data.frame( "A" = c(0, 0, 0), "B" = c(0.25, 0, 1), "C" = c(0, 0.7, 0) ) adj_matrix_3 <- data.frame( "B" = c(0, 0), "D" = c(0.75, 0) ) adj_matrix_4 <- data.frame( "A" = c(0, 0, 0.3, 0), "B" = c(0.5, 0, 0, 0.6), "E" = c(0, 0, 0, 0), "F" = c(1, 0, 1, 0) ) adj_matrices_w_different_concepts <- list( adj_matrix_1, adj_matrix_2, adj_matrix_3, adj_matrix_4 ) standardize_adj_matrices(adj_matrices_w_different_concepts) # Standardize IVFN FCMs adj_matrix_1_lower <- data.frame( "A" = c(0, 0), "B" = c(0.8, 0) ) adj_matrix_1_upper <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) ivfn_adj_matrix_1 <- make_adj_matrix_w_ivfns( adj_matrix_1_lower, adj_matrix_1_upper ) adj_matrix_2_lower <- data.frame( "A" = c(0, 0, 0), "B" = c(0.1, 0, 0.8), "C" = c(0, 0.6, 0) ) adj_matrix_2_upper <- data.frame( "A" = c(0, 0, 0), "B" = c(0.3, 0, 1), "C" = c(0, 0.8, 0) ) ivfn_adj_matrix_2 <- make_adj_matrix_w_ivfns( adj_matrix_2_lower, adj_matrix_2_upper ) adj_matrices_w_different_concepts <- list( ivfn_adj_matrix_1, ivfn_adj_matrix_2 ) standardize_adj_matrices(adj_matrices_w_different_concepts) # Standardize TFN FCMs adj_matrix_1_lower <- data.frame( "A" = c(0, 0), "B" = c(0.8, 0) ) adj_matrix_1_mode <- data.frame( "A" = c(0, 0), "B" = c(0.9, 0) ) adj_matrix_1_upper <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) tfn_adj_matrix_1 <- make_adj_matrix_w_tfns( adj_matrix_1_lower, adj_matrix_1_mode, adj_matrix_1_upper ) adj_matrix_2_lower <- data.frame( "A" = c(0, 0, 0), "B" = c(0.1, 0, 0.8), "C" = c(0, 0.6, 0) ) adj_matrix_2_mode <- data.frame( "A" = c(0, 0, 0), "B" = c(0.2, 0, 0.9), "C" = c(0, 0.7, 0) ) adj_matrix_2_upper <- data.frame( "A" = c(0, 0, 0), "B" = c(0.3, 0, 1), "C" = c(0, 0.8, 0) ) tfn_adj_matrix_2 <- make_adj_matrix_w_tfns( adj_matrix_2_lower, adj_matrix_2_mode, adj_matrix_2_upper ) adj_matrices_w_different_concepts <- list( ivfn_adj_matrix_1, ivfn_adj_matrix_2 ) standardize_adj_matrices(adj_matrices_w_different_concepts)# Standardize Conventional FCMs adj_matrix_1 <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) adj_matrix_2 <- data.frame( "A" = c(0, 0, 0), "B" = c(0.25, 0, 1), "C" = c(0, 0.7, 0) ) adj_matrix_3 <- data.frame( "B" = c(0, 0), "D" = c(0.75, 0) ) adj_matrix_4 <- data.frame( "A" = c(0, 0, 0.3, 0), "B" = c(0.5, 0, 0, 0.6), "E" = c(0, 0, 0, 0), "F" = c(1, 0, 1, 0) ) adj_matrices_w_different_concepts <- list( adj_matrix_1, adj_matrix_2, adj_matrix_3, adj_matrix_4 ) standardize_adj_matrices(adj_matrices_w_different_concepts) # Standardize IVFN FCMs adj_matrix_1_lower <- data.frame( "A" = c(0, 0), "B" = c(0.8, 0) ) adj_matrix_1_upper <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) ivfn_adj_matrix_1 <- make_adj_matrix_w_ivfns( adj_matrix_1_lower, adj_matrix_1_upper ) adj_matrix_2_lower <- data.frame( "A" = c(0, 0, 0), "B" = c(0.1, 0, 0.8), "C" = c(0, 0.6, 0) ) adj_matrix_2_upper <- data.frame( "A" = c(0, 0, 0), "B" = c(0.3, 0, 1), "C" = c(0, 0.8, 0) ) ivfn_adj_matrix_2 <- make_adj_matrix_w_ivfns( adj_matrix_2_lower, adj_matrix_2_upper ) adj_matrices_w_different_concepts <- list( ivfn_adj_matrix_1, ivfn_adj_matrix_2 ) standardize_adj_matrices(adj_matrices_w_different_concepts) # Standardize TFN FCMs adj_matrix_1_lower <- data.frame( "A" = c(0, 0), "B" = c(0.8, 0) ) adj_matrix_1_mode <- data.frame( "A" = c(0, 0), "B" = c(0.9, 0) ) adj_matrix_1_upper <- data.frame( "A" = c(0, 0), "B" = c(1, 0) ) tfn_adj_matrix_1 <- make_adj_matrix_w_tfns( adj_matrix_1_lower, adj_matrix_1_mode, adj_matrix_1_upper ) adj_matrix_2_lower <- data.frame( "A" = c(0, 0, 0), "B" = c(0.1, 0, 0.8), "C" = c(0, 0.6, 0) ) adj_matrix_2_mode <- data.frame( "A" = c(0, 0, 0), "B" = c(0.2, 0, 0.9), "C" = c(0, 0.7, 0) ) adj_matrix_2_upper <- data.frame( "A" = c(0, 0, 0), "B" = c(0.3, 0, 1), "C" = c(0, 0.8, 0) ) tfn_adj_matrix_2 <- make_adj_matrix_w_tfns( adj_matrix_2_lower, adj_matrix_2_mode, adj_matrix_2_upper ) adj_matrices_w_different_concepts <- list( ivfn_adj_matrix_1, ivfn_adj_matrix_2 ) standardize_adj_matrices(adj_matrices_w_different_concepts)
This subtracts one Interval-Value Fuzzy Number (IVFN) from another via interval calculus. An IVFN represented by the interval X:
where and represent the lower and upper
bounds, respectively.
The IVFN X may have another IVFN Y subtracted from it via:
subtract_ivfn(ivfn_1 = ivfn(), ivfn_2 = ivfn())subtract_ivfn(ivfn_1 = ivfn(), ivfn_2 = ivfn())
ivfn_1 |
[ |
ivfn_2 |
[ |
It is not required for one IVFN to be "greater than" the other.
This difference may also be estimated by translating the IVFN's into their corresponding distributions (e.g. ivfn(-1, 1) = runif(n, -1, 1)), subtracting one distribution from the other, and estimating the minimum and maximum values of the difference distribution.
[ivfn]
An IVFN object representing the subtraction of
ivfn_2 from ivfn_1
Moore R, Lodwick W (2003). “Interval Analysis and Fuzzy Set Theory.” Fuzzy Sets and Systems, 135(1), 5–9. ISSN 01650114, doi:10.1016/S0165-0114(02)00246-4.
Dimuro GP (2011). “On Interval Fuzzy Numbers.” In 2011 Workshop-School on Theoretical Computer Science, 3–8. ISBN 978-0-7695-4628-5 978-1-4673-0225-8, doi:10.1109/WEIT.2011.19.
Moore RE (1966). Interval Analysis, volume 4. prentice-Hall Englewood Cliffs.
Other interval-valued-fuzzy-numbers:
c.ivfn(),
create_ivfn_fcm_from_conventional_fcm(),
ivfn(),
make_adj_matrix_w_ivfns(),
print.ivfn()
subtract_ivfn(ivfn(0.5, 0.8), ivfn(0.2, 0.5)) subtract_ivfn(ivfn(-0.5, 0.3), ivfn(0.4, 0.6)) subtract_ivfn(ivfn(-1, 1), ivfn(-0.5, 0.5))subtract_ivfn(ivfn(0.5, 0.8), ivfn(0.2, 0.5)) subtract_ivfn(ivfn(-0.5, 0.3), ivfn(0.4, 0.6)) subtract_ivfn(ivfn(-1, 1), ivfn(-0.5, 0.5))
This subtracts one Triangular Fuzzy Number (TFN) from another via interval calculus. A TFN represented by the fuzzy set (triangular distribution):
where and are the lower and upper bounds, respectively,
and is the mode.
The TFN X may have another TFN Y subtracted from it via:
subtract_tfn(tfn_1 = tfn(), tfn_2 = tfn())subtract_tfn(tfn_1 = tfn(), tfn_2 = tfn())
tfn_1 |
[ |
tfn_2 |
[ |
It is not required for one IVFN to be "greater than" the other.
This difference may also be estimated by translating the TFN's into their corresponding distributions (e.g. tfn(-1, 0, 1) = EnvStats::rtri(n, min = -1, max = 1, mode = 0)), subtracting one distribution from the other, and estimating the minimum, mode, and maximum values of the difference distribution.
[tfn]
An TFN object representing the subtraction of tfn_2
from tfn_1
Chakraverty S, Sahoo DM, Mahato NR (2019). “Fuzzy Numbers.” In Concepts of Soft Computing, 53–69. Springer Singapore, Singapore. ISBN 9789811374296, doi:10.1007/978-981-13-7430-2_3.
Hanss M (ed.) (2005). Applied Fuzzy Arithmetic: An Introduction with Engineering Applications, SpringerLink B\"ucher. Springer-Verlag Berlin Heidelberg, Berlin, Heidelberg. ISBN 978-3-540-24201-7, doi:10.1007/b138914.
Trillas E, Eciolaza L (2015). “Fuzzy Logic.” In volume 320, chapter Fuzzy Arithmetic, 141–158. Springer International Publishing, Cham. ISBN 978-3-319-14202-9, doi:10.1007/978-3-319-14203-6_6
Other triangular-fuzzy-numbers:
create_tfn_fcm_from_conventional_fcm(),
make_adj_matrix_w_tfns(),
print.tfn(),
tfn()
subtract_tfn(tfn(lower = 0.5, mode = 0.6, upper = 0.8), tfn(lower = 0.2, mode = 0.3, upper = 0.5)) subtract_tfn(tfn(-0.5, -0.2, 0.3), tfn(0.4, 0.5, 0.6)) subtract_tfn(tfn(-1, 0, 1), tfn(-0.5, 0, 0.5))subtract_tfn(tfn(lower = 0.5, mode = 0.6, upper = 0.8), tfn(lower = 0.2, mode = 0.3, upper = 0.5)) subtract_tfn(tfn(-0.5, -0.2, 0.3), tfn(0.4, 0.5, 0.6)) subtract_tfn(tfn(-1, 0, 1), tfn(-0.5, 0, 0.5))
This creates a summary object of the fcmconfr output
## S3 method for class 'fcmconfr' summary(object, ...)## S3 method for class 'fcmconfr' summary(object, ...)
object |
[ |
... |
additional inputs |
Show the objects listed in the fcmconfr output $inference and $params,
as well as $bootstrap if present in output. Additionally, this prints
descriptions/summaries of objects within each sub-list like inference_opts,
bootstrap_input_opts, etc.
A summary object of fcmconfr results
NULLNULL
This constructs an triangular fuzzy number (tfn) that represents a continuous, triangular distribution of values within a given range
tfn(lower = double(), mode = double(), upper = double())tfn(lower = double(), mode = double(), upper = double())
lower |
[ |
mode |
[ |
upper |
[ |
The TFN class does not perform any operations on its input, rather it checks whether the input follows the defining criteria of TFNs
For TFNs, the lower bound must be less than or equal to the mode which must be less than or equal to the upper bound. If the lower bound, mode, and upper bound are equal, the TFN represents a "crisp" numeric value.
where , , and are the lower bound, mode,
and upper bound of the TFN.
[tfn]
A triangular fuzzy number (TFN)
Chakraverty S, Sahoo DM, Mahato NR (2019). “Fuzzy Numbers.” In Concepts of Soft Computing, 53–69. Springer Singapore, Singapore. ISBN 9789811374296, doi:10.1007/978-981-13-7430-2_3.
Hanss M (ed.) (2005). Applied Fuzzy Arithmetic: An Introduction with Engineering Applications, SpringerLink B\"ucher. Springer-Verlag Berlin Heidelberg, Berlin, Heidelberg. ISBN 978-3-540-24201-7, doi:10.1007/b138914.
Trillas E, Eciolaza L (2015). “Fuzzy Logic.” In volume 320, chapter Fuzzy Arithmetic, 141–158. Springer International Publishing, Cham. ISBN 978-3-319-14202-9, doi:10.1007/978-3-319-14203-6_6
Other triangular-fuzzy-numbers:
create_tfn_fcm_from_conventional_fcm(),
make_adj_matrix_w_tfns(),
print.tfn(),
subtract_tfn()
tfn(lower = -1.0, mode = 0.0, upper = 1.0) tfn(0, 0.5, 0.8) tfn(-0.3, 0.1, 0.4)tfn(lower = -1.0, mode = 0.0, upper = 1.0) tfn(0, 0.5, 0.8) tfn(-0.3, 0.1, 0.4)