Title: | Interactive Statistical Learning Functions |
---|---|
Description: | An educational toolkit for learning statistical concepts through interactive exploration. Provides functions for basic statistics (mean, variance, etc.) and probability distributions with step-by-step explanations and interactive learning modes. Each function can be used for simple calculations, detailed learning with explanations, or interactive practice with feedback. |
Authors: | Carlos Javier Hellin Asensio [aut], Jose Manuel Gomez Caceres [aut], Dennis Monheimius [aut], Eduardo Benito [aut], Juan Jose Cuadrado [aut], Andriy Protsak Protsak [aut, cre], Universidad de Alcala de Henares [cph] |
Maintainer: | Andriy Protsak Protsak <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-02-18 13:29:00 UTC |
Source: | CRAN |
This function calculates the absolute accumulated frequency of a value in a numeric vector.
absolute_acum_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
absolute_acum_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
v |
Optional numeric vector (not needed for interactive mode) |
x |
Optional numeric value to count (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The absolute accumulated frequency of x in v (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation absolute_acum_frequency(data, value) # Learning mode absolute_acum_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ absolute_acum_frequency(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation absolute_acum_frequency(data, value) # Learning mode absolute_acum_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ absolute_acum_frequency(interactive = TRUE) }
This function calculates the absolute frequency of a value in a numeric vector.
absolute_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
absolute_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
v |
Optional numeric vector (not needed for interactive mode) |
x |
Optional numeric value to count (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The absolute frequency of x in v (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation absolute_frequency(data, value) # Learning mode absolute_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ absolute_frequency(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation absolute_frequency(data, value) # Learning mode absolute_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ absolute_frequency(interactive = TRUE) }
This function calculates the average absolute deviation of a numbers vector.
average_deviation(x = NULL, learn = FALSE, interactive = FALSE)
average_deviation(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The average absolute deviation of the vector (for non-interactive mode)
data <- c(7,2,5,7,1,4,12) # Simple calculation average_deviation(data) # Learning mode average_deviation(data, learn = TRUE) # Interactive mode if(interactive()){ average_deviation(interactive = TRUE) }
data <- c(7,2,5,7,1,4,12) # Simple calculation average_deviation(data) # Learning mode average_deviation(data, learn = TRUE) # Interactive mode if(interactive()){ average_deviation(interactive = TRUE) }
This function calculates the binomial distribution probability.
binomial_(n = NULL, x = NULL, p = NULL, learn = FALSE, interactive = FALSE)
binomial_(n = NULL, x = NULL, p = NULL, learn = FALSE, interactive = FALSE)
n |
Optional number of trials (not needed for interactive mode) |
x |
Optional number of successes (not needed for interactive mode) |
p |
Optional probability of success (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The binomial probability (for non-interactive mode)
n <- 3 x <- 2 p <- 0.7 # Simple calculation binomial_(n, x, p) # Learning mode binomial_(n, x, p, learn = TRUE) # Interactive mode if(interactive()){ binomial_(interactive = TRUE) }
n <- 3 x <- 2 p <- 0.7 # Simple calculation binomial_(n, x, p) # Learning mode binomial_(n, x, p, learn = TRUE) # Interactive mode if(interactive()){ binomial_(interactive = TRUE) }
This function calculates the chi-squared statistic between two groups.
chisquared(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
chisquared(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first vector (not needed for interactive mode) |
y |
Optional second vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The chi-squared statistic (for non-interactive mode)
x <- c(70,75,74,72,68,59) y <- c(74,77,70,80,72,76) # Simple calculation chisquared(x, y) # Learning mode chisquared(x, y, learn = TRUE) # Interactive mode if(interactive()){ chisquared(interactive = TRUE) }
x <- c(70,75,74,72,68,59) y <- c(74,77,70,80,72,76) # Simple calculation chisquared(x, y) # Learning mode chisquared(x, y, learn = TRUE) # Interactive mode if(interactive()){ chisquared(interactive = TRUE) }
This function calculates the covariance between two vectors of numbers.
covariance(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
covariance(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first numeric vector (not needed for interactive mode) |
y |
Optional second numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The covariance between the two vectors (for non-interactive mode)
data <- c(10,4,5,7,3,4,1) data2 <- c(1,8,3,4,4,5,7) # Simple calculation covariance(data, data2) # Learning mode covariance(data, data2, learn = TRUE) # Interactive mode if(interactive()){ covariance(interactive = TRUE) }
data <- c(10,4,5,7,3,4,1) data2 <- c(1,8,3,4,4,5,7) # Simple calculation covariance(data, data2) # Learning mode covariance(data, data2, learn = TRUE) # Interactive mode if(interactive()){ covariance(interactive = TRUE) }
This function calculates the coefficient of variation of a numbers vector.
cv(x = NULL, learn = FALSE, interactive = FALSE)
cv(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The coefficient of variation of the vector (for non-interactive mode)
data <- c(10,4,5,7,3,4,1) # Simple calculation cv(data) # Learning mode cv(data, learn = TRUE) # Interactive mode if(interactive()){ cv(interactive = TRUE) }
data <- c(10,4,5,7,3,4,1) # Simple calculation cv(data) # Learning mode cv(data, learn = TRUE) # Interactive mode if(interactive()){ cv(interactive = TRUE) }
This function prints all the elements of a vector
drawVector(buffer)
drawVector(buffer)
buffer |
A vector of elements to be printed |
No return value, prints to screen
## Not run: data <- c(1:12) drawVector(data) ## End(Not run)
## Not run: data <- c(1:12) drawVector(data) ## End(Not run)
This function calculates the F statistic between two groups.
fisher(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
fisher(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first vector (not needed for interactive mode) |
y |
Optional second vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The F statistic (for non-interactive mode)
x <- c(70,75,74,72,68,59) y <- c(74,77,70,80,72,76) # Simple calculation fisher(x, y) # Learning mode fisher(x, y, learn = TRUE) # Interactive mode if(interactive()){ fisher(interactive = TRUE) }
x <- c(70,75,74,72,68,59) y <- c(74,77,70,80,72,76) # Simple calculation fisher(x, y) # Learning mode fisher(x, y, learn = TRUE) # Interactive mode if(interactive()){ fisher(interactive = TRUE) }
This function calculates the geometric mean of a numeric vector. Can be used in three modes: simple calculation, learning mode with step-by-step explanation, or interactive mode for practice.
geometric_mean(x = NULL, learn = FALSE, interactive = FALSE)
geometric_mean(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The geometric mean of the vector (for non-interactive mode)
data <- c(5,21,12,7,3,9,1) # Simple calculation geometric_mean(data) # Learning mode geometric_mean(data, learn = TRUE) # Interactive mode if(interactive()){ geometric_mean(interactive = TRUE) }
data <- c(5,21,12,7,3,9,1) # Simple calculation geometric_mean(data) # Learning mode geometric_mean(data, learn = TRUE) # Interactive mode if(interactive()){ geometric_mean(interactive = TRUE) }
This function gets the buffer introduced by the user. Typically a numerical vector.
getUserAction()
getUserAction()
A vector entered by the user
## Not run: vector <- getUserAction() ## End(Not run)
## Not run: vector <- getUserAction() ## End(Not run)
This function calculates the harmonic mean of a numbers vector.
harmonic_mean(x = NULL, learn = FALSE, interactive = FALSE)
harmonic_mean(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The harmonic mean of the vector (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) # Simple calculation harmonic_mean(data) # Learning mode harmonic_mean(data, learn = TRUE) # Interactive mode if(interactive()){ harmonic_mean(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) # Simple calculation harmonic_mean(data) # Learning mode harmonic_mean(data, learn = TRUE) # Interactive mode if(interactive()){ harmonic_mean(interactive = TRUE) }
This function displays an image from the package resources.
initImages(image_name)
initImages(image_name)
image_name |
Name of the image file in inst/images |
No return value
This function calculates Laplace's Rule for a probability experiment.
laplace(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
laplace(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first vector (not needed for interactive mode) |
y |
Optional second vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The probability according to Laplace's Rule (for non-interactive mode)
data <- 3 data2 <- c(1,2,3,4,5,6) # Simple calculation laplace(data, data2) # Learning mode laplace(data, data2, learn = TRUE) # Interactive mode if(interactive()){ laplace(interactive = TRUE) }
data <- 3 data2 <- c(1,2,3,4,5,6) # Simple calculation laplace(data, data2) # Learning mode laplace(data, data2, learn = TRUE) # Interactive mode if(interactive()){ laplace(interactive = TRUE) }
This function calculates the arithmetic mean of a numeric vector. Can be used in three modes: simple calculation, learning mode with step-by-step explanation, or interactive mode for practice.
mean_(x = NULL, learn = FALSE, interactive = FALSE)
mean_(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The arithmetic mean of the vector
# Simple calculation data <- c(1,2,2,5,10,4,2) mean_(data) # Learning mode mean_(data, learn = TRUE) # Interactive mode if(interactive()){ mean_(interactive = TRUE) }
# Simple calculation data <- c(1,2,2,5,10,4,2) mean_(data) # Learning mode mean_(data, learn = TRUE) # Interactive mode if(interactive()){ mean_(interactive = TRUE) }
This function calculates the median of a numbers vector.
median_(x = NULL, learn = FALSE, interactive = FALSE)
median_(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The median of the vector (for non-interactive mode)
data <- c(1,3,2,5,12,4,4,2,9) # Simple calculation median_(data) # Learning mode median_(data, learn = TRUE) # Interactive mode if(interactive()){ median_(interactive = TRUE) }
data <- c(1,3,2,5,12,4,4,2,9) # Simple calculation median_(data) # Learning mode median_(data, learn = TRUE) # Interactive mode if(interactive()){ median_(interactive = TRUE) }
This function calculates the mode of a numbers vector.
mode_(x = NULL, learn = FALSE, interactive = FALSE)
mode_(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The mode of the vector (for non-interactive mode)
data <- c(5,21,12,7,3,9,1) # Simple calculation mode_(data) # Learning mode mode_(data, learn = TRUE) # Interactive mode if(interactive()){ mode_(interactive = TRUE) }
data <- c(5,21,12,7,3,9,1) # Simple calculation mode_(data) # Learning mode mode_(data, learn = TRUE) # Interactive mode if(interactive()){ mode_(interactive = TRUE) }
This function calculates the normal distribution probability density.
normal(x = NULL, learn = FALSE, interactive = FALSE)
normal(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric value (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The normal probability density (for non-interactive mode)
x <- 0.1 # Simple calculation normal(x) # Learning mode normal(x, learn = TRUE) # Interactive mode if(interactive()){ normal(interactive = TRUE) }
x <- 0.1 # Simple calculation normal(x) # Learning mode normal(x, learn = TRUE) # Interactive mode if(interactive()){ normal(interactive = TRUE) }
This function calculates the Pearson correlation coefficient between two vectors of numbers.
pearson(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
pearson(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first numeric vector (not needed for interactive mode) |
y |
Optional second numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The Pearson correlation coefficient between the two vectors (for non-interactive mode)
data <- c(10,4,5,7,3,4,1) data2 <- c(1,8,3,4,4,5,7) # Simple calculation pearson(data, data2) # Learning mode pearson(data, data2, learn = TRUE) # Interactive mode if(interactive()){ pearson(interactive = TRUE) }
data <- c(10,4,5,7,3,4,1) data2 <- c(1,8,3,4,4,5,7) # Simple calculation pearson(data, data2) # Learning mode pearson(data, data2, learn = TRUE) # Interactive mode if(interactive()){ pearson(interactive = TRUE) }
This function calculates the percentiles of a numeric vector.
percentile(x = NULL, p = NULL, learn = FALSE, interactive = FALSE)
percentile(x = NULL, p = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
p |
Numeric value between 0 and 1 for percentile calculation (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The percentile value (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12) # Simple calculation percentile(data, 0.3) percentile(data, 0.3, learn = TRUE) if(interactive()){ percentile(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12) # Simple calculation percentile(data, 0.3) percentile(data, 0.3, learn = TRUE) if(interactive()){ percentile(interactive = TRUE) }
This function calculates the Poisson distribution probability.
poisson_(k = NULL, lam = NULL, learn = FALSE, interactive = FALSE)
poisson_(k = NULL, lam = NULL, learn = FALSE, interactive = FALSE)
k |
Optional number of occurrences (not needed for interactive mode) |
lam |
Optional expected value lambda (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The Poisson probability (for non-interactive mode)
lam <- 2 k <- 3 # Simple calculation poisson_(k, lam) # Learning mode poisson_(k, lam, learn = TRUE) # Interactive mode if(interactive()){ poisson_(interactive = TRUE) }
lam <- 2 k <- 3 # Simple calculation poisson_(k, lam) # Learning mode poisson_(k, lam, learn = TRUE) # Interactive mode if(interactive()){ poisson_(interactive = TRUE) }
This function calculates the quartiles of a numeric vector.
quartile(x = NULL, learn = FALSE, interactive = FALSE)
quartile(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The quartiles of the vector (for non-interactive mode)
data <- c(1,2,2,5,10,4,2) # Simple calculation quartile(data) # Learning mode quartile(data, learn = TRUE) # Interactive mode if(interactive()){ quartile(interactive = TRUE) }
data <- c(1,2,2,5,10,4,2) # Simple calculation quartile(data) # Learning mode quartile(data, learn = TRUE) # Interactive mode if(interactive()){ quartile(interactive = TRUE) }
This function calculates the relative accumulated frequency of a value in a numeric vector.
relative_acum_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
relative_acum_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
v |
Optional numeric vector (not needed for interactive mode) |
x |
Optional numeric value to count (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The relative accumulated frequency of x in v (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation relative_acum_frequency(data, value) # Learning mode relative_acum_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ relative_acum_frequency(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation relative_acum_frequency(data, value) # Learning mode relative_acum_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ relative_acum_frequency(interactive = TRUE) }
This function calculates the relative frequency of a value in a numeric vector.
relative_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
relative_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
v |
Optional numeric vector (not needed for interactive mode) |
x |
Optional numeric value to count (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The relative frequency of x in v (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation relative_frequency(data, value) # Learning mode relative_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ relative_frequency(interactive = TRUE) }
data <- c(1,4,3,3,2,5,7,12,1,2,3,12) value <- 12 # Simple calculation relative_frequency(data, value) # Learning mode relative_frequency(data, value, learn = TRUE) # Interactive mode if(interactive()){ relative_frequency(interactive = TRUE) }
This function calculates the standard deviation of a numbers vector.
standard_deviation(x = NULL, learn = FALSE, interactive = FALSE)
standard_deviation(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The standard deviation of the vector (for non-interactive mode)
data <- c(1,5,3,7,10,4,2) # Simple calculation standard_deviation(data) # Learning mode standard_deviation(data, learn = TRUE) # Interactive mode if(interactive()){ standard_deviation(interactive = TRUE) }
data <- c(1,5,3,7,10,4,2) # Simple calculation standard_deviation(data) # Learning mode standard_deviation(data, learn = TRUE) # Interactive mode if(interactive()){ standard_deviation(interactive = TRUE) }
This function calculates the t-statistic for sample data.
tstudent( x = NULL, u = NULL, s = NULL, n = NULL, learn = FALSE, interactive = FALSE )
tstudent( x = NULL, u = NULL, s = NULL, n = NULL, learn = FALSE, interactive = FALSE )
x |
Optional sample mean (not needed for interactive mode) |
u |
Optional population mean (not needed for interactive mode) |
s |
Optional standard deviation (not needed for interactive mode) |
n |
Optional sample size (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The t-statistic (for non-interactive mode)
x <- 52.9 u <- 50 s <- 3 n <- 10 # Simple calculation tstudent(x, u, s, n) # Learning mode tstudent(x, u, s, n, learn = TRUE) # Interactive mode if(interactive()){ tstudent(interactive = TRUE) }
x <- 52.9 u <- 50 s <- 3 n <- 10 # Simple calculation tstudent(x, u, s, n) # Learning mode tstudent(x, u, s, n, learn = TRUE) # Interactive mode if(interactive()){ tstudent(interactive = TRUE) }
This function calculates the variance of a numbers vector.
variance(x = NULL, learn = FALSE, interactive = FALSE)
variance(x = NULL, learn = FALSE, interactive = FALSE)
x |
Optional numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The variance of the vector (for non-interactive mode)
data <- c(10,4,5,7,3,4,1) # Simple calculation variance(data) # Learning mode variance(data, learn = TRUE) # Interactive mode if(interactive()){ variance(interactive = TRUE) }
data <- c(10,4,5,7,3,4,1) # Simple calculation variance(data) # Learning mode variance(data, learn = TRUE) # Interactive mode if(interactive()){ variance(interactive = TRUE) }