Title: | An Implementation of the RESTK Algorithm |
Version: | 1.0.1 |
Description: | Implementation of the RESTK algorithm based on Markov's Inequality from Vilardell, Sergi, Serra, Isabel, Mezzetti, Enrico, Abella, Jaume, Cazorla, Francisco J. and Del Castillo, J. (2022). "Using Markov's Inequality with Power-Of-k Function for Probabilistic WCET Estimation". In 34th Euromicro Conference on Real-Time Systems (ECRTS 2022). Leibniz International Proceedings in Informatics (LIPIcs) 231 20:1-20:24. <doi:10.4230/LIPIcs.ECRTS.2022.20>. This work has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 772773). |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | purrr |
Suggests: | knitr, rmarkdown |
NeedsCompilation: | no |
Packaged: | 2025-03-12 15:35:18 UTC; svilarde |
Author: | Sergi Vilardell [aut, cre] |
Maintainer: | Sergi Vilardell <sergi.vilardell@bsc.es> |
Repository: | CRAN |
Date/Publication: | 2025-03-12 15:50:02 UTC |
RESTK
Description
RESTK
function used to project the maxk line into the probabilities of interest
Usage
RESTK(
training_data = NULL,
validation_data = NULL,
probs = NULL,
probs_interest = NULL,
bootstrap_size = NULL,
bootstrap_training_sims = NULL,
bootstrap_validation_sims = NULL
)
Arguments
training_data |
training data |
validation_data |
validation data |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the training data |
bootstrap_training_sims |
number of bootstrap simulations on the training data |
bootstrap_validation_sims |
number of bootstrap simulations on the validation data |
Value
Returns the maxk line for the probabilities of interest
Examples
training_data <- rnorm(1e3, mean = 100, sd = 10)
validation_data <- rnorm(1e3, mean = 100, sd = 10)
bootstrap_size <- 1000
bootstrap_training_sims <- 10
bootstrap_validation_sims <- 10
probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2)
probs_interest <- c(1-1e-6, 1-1e-7)
maxk_line <- c(100, 125, 150)
estimated_quants <- RESTK(training_data = training_data,
validation_data = validation_data,
probs = probs,
probs_interest = probs_interest,
bootstrap_size = bootstrap_size,
bootstrap_training_sims = bootstrap_training_sims,
bootstrap_validation_sims = bootstrap_validation_sims)
RESTK Training
Description
RESTK_training
function used to project the maxk line into the probabilities of interest
Usage
RESTK_training(
training_data = NULL,
probs = NULL,
probs_interest = NULL,
bootstrap_size = NULL,
bootstrap_training_sims = NULL
)
Arguments
training_data |
training data |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the training data |
bootstrap_training_sims |
number of bootstrap simulations on the training data |
Value
Returns the estimated maxk line from the probabilities of interest
Examples
training_data <- rnorm(1e3, mean = 100, sd = 10)
probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2)
probs_interest <- c(1-1e-6, 1-1e-7)
bootstrap_size <- 1000
bootstrap_training_sims <- 100
maxk_line <- RESTK_training(training_data = training_data,
probs = probs,
probs_interest = probs_interest,
bootstrap_size = bootstrap_size,
bootstrap_training_sims = bootstrap_training_sims)
RESTK Validation
Description
RESTK_validation
main function for the validation of the RESTK methodology by using the maxk line
Usage
RESTK_validation(
validation_data = NULL,
maxk_line = NULL,
probs_interest = NULL,
bootstrap_size = NULL,
bootstrap_validation_sims = NULL
)
Arguments
validation_data |
validation data |
maxk_line |
maxk line obtained from RESTK_training |
probs_interest |
Probabilities of interest to estimate |
bootstrap_size |
size of bootstrap simulations on the validation data |
bootstrap_validation_sims |
number of bootstrap simulations on the validation data |
Value
Returns the estimated quantiles from the probabilities of interest
Examples
validation_data <- rnorm(1e3, mean = 100, sd = 10)
probs_interest <- c(1-1e-6, 1-1e-7)
bootstrap_size <- 1000
bootstrap_validation_sims <- 100
maxk_line <- c(100, 125, 150)
estimated_quants <- RESTK_validation(validation_data = validation_data,
maxk_line = maxk_line,
probs_interest = probs_interest,
bootstrap_size = bootstrap_size,
bootstrap_validation_sims = bootstrap_validation_sims)
Compute the maximum k for a given sample
Description
compute_maxk
returns the estimated quantiles for the chosen probabilities from the input sample.
This method uses the sample quantile method number 8 from the default quantile function.
Usage
compute_maxk(samp = NULL, probs = NULL, quants = NULL, k_range = c(1, 120))
Arguments
samp |
Sample of data to model |
probs |
Probabilities of interest to generate the max_k line |
quants |
Estimated quantiles of interest to generate the max_k line |
k_range |
Range of k values for the optimization function |
Value
Returns estimated maxk for the sample and quantiles given.
Examples
samp <- rnorm(1e3, mean = 100, sd = 10)
probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2)
quants <- c(100, 125, 150)
estimated_max_k <- compute_maxk(samp = samp, probs = probs, quants = quants, k_range = c(1,100))
Estimate Quantiles with Maxk
Description
estimate_quantiles_maxk
use the maxk line obtained to estimate quantiles with MIK
Usage
estimate_quantiles_maxk(samp = NULL, maxk_line = NULL, probs_interest = NULL)
Arguments
samp |
sample |
maxk_line |
maxk line obtained for the probabilities of interest |
probs_interest |
Probabilities of interest to estimate |
Value
Returns the estimation of the quantiles using the maxk line
Examples
linear_adjust(min_maxk = c(10, 15, 20),
probs = c(1-1e-1, 1-1e-2, 1-1e-3),
probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
Get the minimum maxk
Description
get_min_maxk
get the minimum maxk from a set of maxks and tightness
Usage
get_min_maxk(samp_tightness = NULL, k_seq = NULL)
Arguments
samp_tightness |
tightness from a given sample and maxk |
k_seq |
sequence of maxk to evaluate |
Value
Returns the minimum maxk
Examples
get_min_maxk(samp_tightness = c(1.5, 1.2, 0.98),
k_seq = c(20, 30 , 40))
Linear adjust
Description
linear_adjust
function used to project the max_k line into the probabilities of interest
Usage
linear_adjust(min_maxk = NULL, probs = NULL, probs_interest)
Arguments
min_maxk |
minimum maxk found for each probability of interest |
probs |
Probabilities where maxk was evaluated |
probs_interest |
Probabilities of interest to estimate |
Value
Returns the maxk line for the probabilities of interest
Examples
linear_adjust(min_maxk = c(10, 15, 20),
probs = c(1-1e-1, 1-1e-2, 1-1e-3),
probs_interest = c(1-1e-6, 1-1e-7, 1-1e-8))
Estimate Quantiles within the Sample
Description
sample_quantile_estimation
returns the estimated quantiles for the chosen probabilities from the input sample.
This method uses the sample quantile method number 8 from the default quantile function.
Usage
sample_quantile_estimation(samp = NULL, probs = NULL, bootstrap_sims = NULL)
Arguments
samp |
Sample of data to model |
probs |
Probabilities of interest to generate the max_k line |
bootstrap_sims |
Number of bootstrap simulations to estimate the quantiles |
Value
Returns estimated quantiles for the chosen probabilities.
Examples
samp <- rnorm(1e3, mean = 100, sd = 10)
probs <- c(1-1e-1, 1-0.5e-1, 1-1e-2)
bootstrap_training_sims <- 100
estimated_quantiles <- sample_quantile_estimation(samp = samp,
probs = probs,
bootstrap_sims = bootstrap_training_sims)
Tightness function
Description
tightness
function used to minimized the tightness as a function of the value of k
Usage
tightness(samp = NULL, prob = NULL, quant = NULL, k = NULL)
Arguments
samp |
Sample of data to model |
prob |
Probability of interest |
quant |
Quantile of interest |
k |
value of k to check tightness |
Value
Returns the squared difference between the tightness and 1
Examples
samp <- rnorm(1e3, mean = 100, sd = 10)
prob <- c(1-1e-2)
k <- 1:100
quant <- qnorm(p = prob, mean = 100, sd = 10)
tightness(samp = samp, prob = prob, quant = quant, k = k)