knitr::opts_chunk$set(echo = TRUE, warning = FALSE) library(RMAT) library(purrr) source("../R/mat-diag.R") #source("../R/matrices.R")
# Testing parameter accuracy for RM_norm normal_mean <- function(N = 5, mu = 0, threshold = 0.25){ P <- RM_norm(N = N, mean = mu) mu_sim <- .normal_params(P)[[1]] abs(mu - mu_sim) < threshold } normal_sd <- function(N, sd = 1, threshold = 0.25){ P <- RM_norm(N = 5, mean = 0, sd = sd) sd_sim <- .normal_params(P)[[2]] abs(sd - sd_sim) < threshold }
# Set parameters N <- 100 repl <- 100
# Test accuracy sum(replicate(n = repl, normal_mean(N, mu = 5, threshold = 0.2), simplify = TRUE)) / repl sum(replicate(repl, normal_sd(N, sd = 1, threshold = 0.2), simplify = TRUE)) / repl
# Testing parameter accuracy for RM_stoch stoch_test <- function(N, size, symm = T, sparsity = F){ ens <- RME_stoch(N = N, symm = symm, sparsity = sparsity, size = size) v <- purrr::map_lgl(ens, .isStochastic) return(sum(v) / size) # Get result }
# Set parameters N <- 100 size <- 100
# Test accuracy stoch_test(N = N, size = 1000) stoch_test(N = N, size = 1000, symm = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.