Description Usage Arguments Details Author(s) References See Also Examples
Generate compact plot of Bayesian network node states following the descdist
function as customizable ggplot.
1 2 3 4 5 6 7 8 9 10 11 12 13 | gg_plotdist(
fitted,
title = NULL,
hist_bar_size = 0.3,
dist_geom_pts_size = 0.03,
dist_geom_smooth_size = 0.3,
dist_geom_abline_size = 0.3,
axis_text_size = 9,
axis_title_size = 9,
plot_title_size = 10,
plot_subtitle_size = 8,
strip_text_size = 9
)
|
fitted |
A list of |
title |
character string to be used as plot title |
hist_bar_size |
numeric size of histogram bars |
dist_geom_pts_size, dist_geom_smooth_size, dist_geom_abline_size |
numeric. The size of the geom_point, smoothing line and abline, respectively. |
axis_text_size |
= 12, Text size respectively corresponding to axis text (default to 12), axis title (default to 12), plot title (default to 20), subtitle (default to 17), strip text (default to 18), and legend (default to 12). |
axis_title_size |
= 12, Text size respectively corresponding to axis text (default to 12), axis title (default to 12), plot title (default to 20), subtitle (default to 17), strip text (default to 18), and legend (default to 12). |
plot_title_size |
= 12, Text size respectively corresponding to axis text (default to 12), axis title (default to 12), plot title (default to 20), subtitle (default to 17), strip text (default to 18), and legend (default to 12). |
plot_subtitle_size |
= 12, Text size respectively corresponding to axis text (default to 12), axis title (default to 12), plot title (default to 20), subtitle (default to 17), strip text (default to 18), and legend (default to 12). |
strip_text_size |
= 12, Text size respectively corresponding to axis text (default to 12), axis title (default to 12), plot title (default to 20), subtitle (default to 17), strip text (default to 18), and legend (default to 12). |
see plotdist
.
Issoufou Liman
Marie Laure Delignette-Muller, Christophe Dutang (2015). fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34. http://www.jstatsoft.org/v64/i04/.
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 | library (gRain)
library(bnlearn)
## setting a bayesian network with gRain
Soil_type <- cptable (~Soil_type, values = c(0.05, 0.55, 0.4),
levels = c('Sandy', 'Loamy', 'Clayey'))
Manure_application <- cptable(~Manure_application, values = c(0.3, 0.7),
levels = c('FALSE', 'TRUE'))
Soil_water_holding_capacity_tmp <- make_gRain_CPT(
parent_effects = list(c(0, 2.5, 3), c(0, 2)),
parent_weights = c(2,1),
b = 3,
child_prior = c(0.2,0.5,0.3),
child_states = c('Low', 'Medium', 'High'),
parent_states = list(c('Sandy', 'Loamy', 'Clayey'), c('FALSE', 'TRUE'))
)
Soil_water_holding_capacity_values <- Soil_water_holding_capacity_tmp$values
Soil_water_holding_capacity_levels <- Soil_water_holding_capacity_tmp$levels
Soil_water_holding_capacity <- cptable (
~Soil_water_holding_capacity|Soil_type:Manure_application,
values = Soil_water_holding_capacity_values,
levels = Soil_water_holding_capacity_levels)
## Compile conditional probability tables
network <- compileCPT(list(Soil_type, Manure_application, Soil_water_holding_capacity))
## Graphical Independence Network ####
network <- grain(network)
## Use grain object (gRain package)
fitted <- fit_node_states_distr (bn = network,
node = "Soil_water_holding_capacity", gof="KS")
gg_plotdist(fitted, title = "Soil_water_holding_capacity")
## converting the grain bayesian network to bn.fit
network_bn_fit <- as.bn.fit(network)
## Use bn.fit object (bnlearn package)
fitted <- fit_node_states_distr (bn = network_bn_fit,
node = "Soil_water_holding_capacity", distr = c("beta", "beta", "beta"))
gg_plotdist(fitted, title = "Soil_water_holding_capacity")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.