#' auxiliar functions
#'
#'
# Threshold plot
auxfun <- function(){
xfun <- c(0.100, 0.109, 0.118, 0.127, 0.136, 0.145, 0.154, 0.163, 0.172, 0.181, 0.190, 0.199, 0.208,
0.217, 0.226, 0.235, 0.244, 0.253, 0.262, 0.271, 0.280, 0.289, 0.298, 0.307, 0.316, 0.325,
0.334, 0.343, 0.352, 0.361, 0.370, 0.379, 0.388, 0.397, 0.406, 0.415, 0.424, 0.433, 0.442,
0.451, 0.460, 0.469, 0.478, 0.487, 0.496, 0.505, 0.514, 0.523, 0.532, 0.541, 0.550, 0.559,
0.568, 0.577, 0.586, 0.595, 0.604, 0.613, 0.622, 0.631, 0.640, 0.649, 0.658, 0.667, 0.676,
0.685, 0.694, 0.703, 0.712, 0.721, 0.730, 0.739, 0.748, 0.757, 0.766, 0.775, 0.784, 0.793,
0.802, 0.811, 0.820, 0.829, 0.838, 0.847, 0.856, 0.865, 0.874, 0.883, 0.892, 0.901, 0.910,
0.919, 0.928, 0.937, 0.946, 0.955, 0.964, 0.973, 0.982, 0.991, 1.000)
yfun <- c(1.0000000, 0.9174312, 0.8474576, 0.7874016, 0.7352941, 0.6896552, 0.6493506,
0.6134969, 0.5813953, 0.5524862, 0.5263158, 0.5025126, 0.4807692, 0.4608295,
0.4424779, 0.4255319, 0.4098361, 0.3952569, 0.3816794, 0.3690037, 0.3571429,
0.3460208, 0.3355705, 0.3257329, 0.3164557, 0.3076923, 0.2994012, 0.2915452,
0.2840909, 0.2770083, 0.2702703, 0.2638522, 0.2577320, 0.2518892, 0.2463054,
0.2409639, 0.2358491, 0.2309469, 0.2262443, 0.2217295, 0.2173913, 0.2132196,
0.2092050, 0.2053388, 0.2016129, 0.1980198, 0.1945525, 0.1912046, 0.1879699,
0.1848429, 0.1818182, 0.1788909, 0.1760563, 0.1733102, 0.1706485, 0.1680672,
0.1655629, 0.1631321, 0.1607717, 0.1584786, 0.1562500, 0.1540832, 0.1519757,
0.1499250, 0.1479290, 0.1459854, 0.1440922, 0.1422475, 0.1404494, 0.1386963,
0.1369863, 0.1353180, 0.1336898, 0.1321004, 0.1305483, 0.1290323, 0.1275510,
0.1261034, 0.1246883, 0.1233046, 0.1219512, 0.1206273, 0.1193317, 0.1180638,
0.1168224, 0.1156069, 0.1144165, 0.1132503, 0.1121076, 0.1109878, 0.1098901,
0.1088139, 0.1077586, 0.1067236, 0.1057082, 0.1047120, 0.1037344, 0.1027749,
0.1018330, 0.1009082, 0.1000000)
aux <- cbind(xfun,yfun)
return(aux)
}
# Auxiliar function to calculate the harmonic deviation
#' @export
harmonic.deviation <- function(val){
if (!requireNamespace("lmomco", quietly = TRUE)) {
stop("Package lmomco needed for this function to work. Please install it.",
call. = FALSE)}
hardev <- sqrt(sum((val-lmomco::harmonic.mean(val)$harmean)^2)/(length(val)-1))
return(hardev)
}
#' Package demonstration
#' @export
fbmR.demo <- function(){
aa <- fbmR::axis.Ability(n=300, full.estimation = T)
mm <- fbmR::axis.Motivation(n=300, full.estimation = T)
par(mfrow=c(2,2))
fbmR::plotMA(aa, mm, dynamic.threshold = T, harmean = T, fbm.threshold = T, id=100)
fbmR::findTriggers(aa,mm, type = "spark", dyn = T, zone = T)
fbmR::findTriggers(aa,mm, type = "facilitator", dyn = T, zone = T)
fbmR::findTriggers(aa,mm, type = "signal", dyn = T, zone = T)
fbmR::trigger.status(aa,mm)
par(mfrow=c(1,1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.