Title: | Laboratory of Teaching to Statistics and Mathematics |
---|---|
Description: | An educational package for teaching statistics and mathematics in both primary and higher education. The objective is to assist in the teaching/learning process, both for student study planning and teacher teaching strategies. The leem package aims to provide, in a simple yet in-depth manner, knowledge of statistics and mathematics to anyone who wants to study these areas of knowledge. |
Authors: | Ben Deivide [aut, cre] |
Maintainer: | Ben Deivide <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.1.9000 |
Built: | 2025-03-31 20:22:20 UTC |
Source: | https://github.com/bendeivide/leem |
Compute the sample range
amplitude(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
amplitude(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> amplitude(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> amplitude()
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> amplitude(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> amplitude()
Help in building the plot of the probability function of any discrete variable
apf(x, p, main = NULL, xlab = NULL, ylab = NULL)
apf(x, p, main = NULL, xlab = NULL, ylab = NULL)
x |
numeric vector of values of |
p |
numeric vector of |
main |
main title for the plot. |
xlab |
a label for the x axis. |
ylab |
a label for the y axis. |
Consider the distribution:
: |
0.23 | 0.27 | 0.30 | 0.12 | 0.08 |
: |
1 | 2 | 3 | 4 | 5 |
where and
are probability function and values of
. See Example 1.
The output is plot of distribution function. See Example 1.
# Example 1 x <- 1:5 p <- c(0.23, 0.27,0.30, 0.12, 0.08) apf(x, p)
# Example 1 x <- 1:5 p <- c(0.23, 0.27,0.30, 0.12, 0.08) apf(x, p)
Class method leem for generic barplot
## S3 method for class 'leem' barplot( height, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", posx1 = 0, posx2 = 0, xang = 0, labels = NULL, ... )
## S3 method for class 'leem' barplot( height, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", posx1 = 0, posx2 = 0, xang = 0, labels = NULL, ... )
height |
R object (list) of class leem. Use |
freq |
Character argument. Type of frequency with options: |
bg |
Logical argument. Default is |
main |
Character argument. Insert the plot title. The default is |
xlab |
Character argument. Insert the title of the x-axis graphic label. The default is |
ylab |
Character argument. Insert the title of the y-axis graphic label. The default is |
grids |
Insert grids to plot. The default is |
bgcol |
Insert the background color. This argument is only valid when |
bgborder |
Character argument. Insert the background border color. This argument is only valid when |
barcol |
Character argument. Insert the barplot color. The default is |
barborder |
Numeric argument. Insert the barplot border color. This argument is only valid when |
posx1 |
Numeric argument.Distance of the labels (horizontal) in relation to the x axis. |
posx2 |
Numeric argument.Distance of the labels (vertical) in relation to the x axis. |
xang |
Numeric argument.Angle of the labels in relation to the x axis |
labels |
Character argument. Labels name vector. |
... |
further arguments passed to or from other methods. |
library(graphics) # Example 1 - Simple example library(leem) rep(1:5, 5:1) |> new_leem() |> barplot() # Example 2 - Color bars rep(1:5, 5:1) |> new_leem() |> barplot(barcol = heat.colors(5)) # Example 3 - Ordered data library(leem) school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) |> barplot(xang = 15, posx2 = -0.2) # Example 4 - Coerced to histogram rnorm(100, 10, 2) |> new_leem(variable = 2) |> barplot(barcol = heat.colors(10))
library(graphics) # Example 1 - Simple example library(leem) rep(1:5, 5:1) |> new_leem() |> barplot() # Example 2 - Color bars rep(1:5, 5:1) |> new_leem() |> barplot(barcol = heat.colors(5)) # Example 3 - Ordered data library(leem) school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) |> barplot(xang = 15, posx2 = -0.2) # Example 4 - Coerced to histogram rnorm(100, 10, 2) |> new_leem(variable = 2) |> barplot(barcol = heat.colors(10))
Produce box-and-whisker plot(s) of leem class object and computes the necessary values for the development of the plot.
## S3 method for class 'leem' boxplot( x, type = "rawdata", details = FALSE, horizontal = FALSE, coef = 1.5, main = NULL, xlab = NULL, ylab = NULL, col = rgb(0, 175, 239, maxColorValue = 255), ... )
## S3 method for class 'leem' boxplot( x, type = "rawdata", details = FALSE, horizontal = FALSE, coef = 1.5, main = NULL, xlab = NULL, ylab = NULL, col = rgb(0, 175, 239, maxColorValue = 255), ... )
x |
R object (list) of class leem. Use |
type |
character argument. Default is |
details |
Logical argument. Default is |
horizontal |
Logical argument indicating if the boxplots should be horizontal; default |
coef |
this determines how far the plot whiskers extend out from the box. If |
main |
Title name. Defaults is |
xlab |
a label for the |
ylab |
a label for the |
col |
Character vector. Default |
... |
further arguments passed to or from other methods. |
library(leem) # Example 1 x <- rnorm(30, 100, 2) |> new_leem(variable = 2) |> tabfreq() boxplot(x, details = TRUE) # Example 2 boxplot(x, type = "classes")
library(leem) # Example 1 x <- rnorm(30, 100, 2) |> new_leem(variable = 2) |> tabfreq() boxplot(x, details = TRUE) # Example 2 boxplot(x, type = "classes")
Help in building the plot of the cumulative distribution function of any discrete variable
cdfd(x, fda, main = NULL, xlab = NULL, ylab = NULL)
cdfd(x, fda, main = NULL, xlab = NULL, ylab = NULL)
x |
numeric vector of values of |
fda |
numeric vector of |
main |
main title for the plot. |
xlab |
a label for the x axis. |
ylab |
a label for the y axis. |
Consider the distribution:
: |
0.23 | 0.27 | 0.30 | 0.12 | 0.08 |
: |
1 | 2 | 3 | 4 | 5 |
where and
are probability function and values of
. Consider also the
distribution function:
This way, the cdfd
function needs to consider only the vectors x <- 1:5
and
fda <- c(0.23, 0.50, 0.80, 0.92, 1)
, that is, only the equality conditions for . See Example 1.
The output is plot of distribution function. See Example 1.
# Example 1 x <- 1:5 fda <- c(0.23, 0.5, 0.8, 0.92, 1) cdfd(x, fda)
# Example 1 x <- 1:5 fda <- c(0.23, 0.5, 0.8, 0.92, 1) cdfd(x, fda)
Compute the sample coeffient of variation
cv(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
cv(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> cv() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> cv(grouped = FALSE)
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> cv() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> cv(grouped = FALSE)
Density, distribution function, quantile function and random generation for the normal distribution with parameters: location and scale
dgumbel(x, location, scale) pgumbel(q, location, scale, lower.tail = TRUE) qgumbel(p, location = 0, scale = 1, lower.tail = TRUE)
dgumbel(x, location, scale) pgumbel(q, location, scale, lower.tail = TRUE) qgumbel(p, location = 0, scale = 1, lower.tail = TRUE)
x , q
|
vector of quantiles. |
location |
numerical. It represents location parameter. See Details. |
scale |
numerical. It represents scale parameter. See Details. |
lower.tail |
logical; if |
p |
vector of probabilities. |
The CDF of Gumbel distribution is:
where is location parameter (
location
) and is scale parameter (
scale
).
The PDF of Gumbel distribution is:
where .
The quantile is:
# PDF dgumbel(1, 0, 1) # CDF pgumbel(1, 0, 1) # Quantile qgumbel(0.2, 0, 1)
# PDF dgumbel(1, 0, 1) # CDF pgumbel(1, 0, 1) # Quantile qgumbel(0.2, 0, 1)
Class method leem for generic hist
## S3 method for class 'leem' hist( x, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", ... )
## S3 method for class 'leem' hist( x, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", ... )
x |
R object (list) of class leem. Use |
freq |
Character argument. Type of frequency with options: |
bg |
Logical argument. Default is |
main |
Insert the plot title. The default is |
xlab |
Insert the title of the x-axis graphic label. The default is |
ylab |
Insert the title of the y-axis graphic label. The default is |
grids |
Insert grids to plot. The default is |
bgcol |
Insert the background color. This argument is only valid when |
bgborder |
Insert the background border color. This argument is only valid when |
barcol |
Insert the barplot color. The default is |
barborder |
Numeric argument. Insert the barplot border color. This argument is only valid when |
... |
further arguments passed to or from other methods. |
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() # Example 2 library(leem) school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university"))
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() # Example 2 library(leem) school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university"))
Generic function that allows inserting measures of position in plots
insert(x, ...)
insert(x, ...)
x |
R object (list) of class leem. Use |
... |
further arguments passed to or from other methods. |
# Example 1 library(leem) set.seed(10) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() |> insert( lcol = "black", tcol = "purple", acol = "brown", parrow = 0.6, larrow = 0.6, ptext = 0.4, side = "left", lwd = 2, lwdarrow = 4 )
# Example 1 library(leem) set.seed(10) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() |> insert( lcol = "black", tcol = "purple", acol = "brown", parrow = 0.6, larrow = 0.6, ptext = 0.4, side = "left", lwd = 2, lwdarrow = 4 )
Method of insert function
## S3 method for class 'leem' insert( x, type = "mean", lty = 1, lcol = "black", tcol = lcol, acol = lcol, parrow = 0.5, larrow = 0.6, ptext = 0.06, side = "right", lwd = 2, lwdarrow = lwd, ... )
## S3 method for class 'leem' insert( x, type = "mean", lty = 1, lcol = "black", tcol = lcol, acol = lcol, parrow = 0.5, larrow = 0.6, ptext = 0.06, side = "right", lwd = 2, lwdarrow = lwd, ... )
x |
R object (list) of class leem. Use |
type |
Type of measure of position. The default is |
lty |
Line type. The default is |
lcol |
Vertical line color type. The default is |
tcol |
Text color type. The default is |
acol |
Arrow color type. The default is |
parrow |
Text and arrow height. The default is |
larrow |
Text and arrow length. The default is |
ptext |
Distance between lines of text. The default is |
side |
Side to insert the text. The default is |
lwd |
numeric argument. The vertical line width. The default is |
lwdarrow |
numeric argument. The arrow width. The default is |
... |
further arguments passed to or from other methods. |
No return value. This function adds elements to an existing plot.
# Example 1 library(leem) set.seed(10) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() |> insert( lcol = "black", tcol = "purple", acol = "brown", parrow = 0.6, larrow = 0.6, ptext = 0.4, side = "left", lwd = 2, lwdarrow = 4 )
# Example 1 library(leem) set.seed(10) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> hist() |> insert( lcol = "black", tcol = "purple", acol = "brown", parrow = 0.6, larrow = 0.6, ptext = 0.4, side = "left", lwd = 2, lwdarrow = 4 )
leem
A Graphical User Interface (GUI) for
the leem package
leem(gui = TRUE)
leem(gui = TRUE)
gui |
Logical argument, |
leem
presents GUI with various problems for the teaching of statistics and mathematics. The idea is to use this package to learn these subjects without necessarily programming in R
# Loading package library(leem) if (interactive()) { leem(gui = FALSE) }
# Loading package library(leem) if (interactive()) { leem(gui = FALSE) }
Compute the sample mean absolute deviation
madev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
madev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> madev(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> madev()
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> madev(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> madev()
Arithmetic mean Class method leem for the generic mean function
## S3 method for class 'leem' mean( x, trim = 0, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ... )
## S3 method for class 'leem' mean( x, trim = 0, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ... )
x |
R object (list) of class leem. Use |
trim |
The fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint. |
na.rm |
a logical value indicating whether |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
details |
Logical object. Details of data (default |
... |
further arguments passed to or from other methods. |
# Example 1 set.seed(10) x <- rnorm(36, 100, 50) y <- rbinom(36, 10, 0.8) y |> new_leem(variable = "discrete") |> tabfreq() |> mean() x |> new_leem(variable = "continuous") |> tabfreq() |> mean()
# Example 1 set.seed(10) x <- rnorm(36, 100, 50) y <- rbinom(36, 10, 0.8) y |> new_leem(variable = "discrete") |> tabfreq() |> mean() x |> new_leem(variable = "continuous") |> tabfreq() |> mean()
Compute the sample median absolute deviation
medev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
medev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> medev(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> medev()
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> medev(grouped = FALSE) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> medev()
Class method leem for the generic median function
## S3 method for class 'leem' median(x, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ...)
## S3 method for class 'leem' median(x, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ...)
x |
R object (list) of class leem. Use |
na.rm |
a logical value indicating whether |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
details |
Logical object. Details of data (default |
... |
further arguments passed to or from other methods. |
library(leem) library(stats) # Examples rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> median()
library(leem) library(stats) # Examples rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> median()
Compute the sample mode.
mfreq(x, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE)
mfreq(x, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE)
x |
R object (list) of class leem. Use |
na.rm |
a logical value indicating whether |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
details |
Logical object. Details of data (default |
library(leem) # set.seed(10) x <- rnorm(36, 100, 50) set.seed(10) y <- rbinom(36, 10, 0.8) w <- rep(letters[1:4], 1:4) (tab1 <- y |> new_leem(variable = "discrete") |> tabfreq()) (tab2 <- x |> new_leem(variable = "continuous") |> tabfreq()) (tab3 <- w |> new_leem(variable = "discrete") |> tabfreq()) y |> new_leem(variable = "discrete") |> tabfreq() |> mfreq() x |> new_leem(variable = "continuous") |> tabfreq() |> mfreq() w |> new_leem(variable = "discrete") |> tabfreq() |> mfreq()
library(leem) # set.seed(10) x <- rnorm(36, 100, 50) set.seed(10) y <- rbinom(36, 10, 0.8) w <- rep(letters[1:4], 1:4) (tab1 <- y |> new_leem(variable = "discrete") |> tabfreq()) (tab2 <- x |> new_leem(variable = "continuous") |> tabfreq()) (tab3 <- w |> new_leem(variable = "discrete") |> tabfreq()) y |> new_leem(variable = "discrete") |> tabfreq() |> mfreq() x |> new_leem(variable = "continuous") |> tabfreq() |> mfreq() w |> new_leem(variable = "discrete") |> tabfreq() |> mfreq()
Compute all measures of position
mpos( x, trim = 0, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ... )
mpos( x, trim = 0, na.rm = FALSE, rounding = 2, grouped = TRUE, details = FALSE, ... )
x |
R object (list) of class leem. Use |
trim |
The fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint. |
na.rm |
a logical value indicating whether |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
details |
Logical object. Details of data (default |
... |
further arguments passed to or from other methods. |
The measures of position are: average, median and mode.
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> mpos() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> mpos(grouped = FALSE)
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> mpos() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> mpos(grouped = FALSE)
Compute the sample mean standard error
mstde(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
mstde(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> mstde(rounding = 4) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> mstde(grouped = FALSE)
# Example 1: Poisson data set.seed(10) rpois(30, 2.5) |> new_leem() |> mstde(rounding = 4) # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> mstde(grouped = FALSE)
Function that assists other functions of leem package
new_leem(x, variable = "discrete")
new_leem(x, variable = "discrete")
x |
R object (vector as data structure). |
variable |
Type of data. If |
The variable
argument also allows using variable = 1
for categorical variable and variable = 2
for continuous variable.
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) new_leem(x, variable = 1) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = 2)
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) new_leem(x, variable = 1) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = 2)
Generic function that plots the culmulative frequency curve.
ogive(x, ...) ## S3 method for class 'leem' ogive( x, freq = "a", decreasing = FALSE, both = FALSE, bars = FALSE, histogram = FALSE, bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", histcol = barcol, barborder = "gray", histborder = barborder, type = "b", lpcol = "black", lwd = 2, pch = 19, lty = 2, ... )
ogive(x, ...) ## S3 method for class 'leem' ogive( x, freq = "a", decreasing = FALSE, both = FALSE, bars = FALSE, histogram = FALSE, bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", histcol = barcol, barborder = "gray", histborder = barborder, type = "b", lpcol = "black", lwd = 2, pch = 19, lty = 2, ... )
x |
R object (list) of class leem. Use |
... |
further arguments passed to or from other methods. |
freq |
Character argument. Type of frequency with options: |
decreasing |
Logical argument. Default is |
both |
Logical argument. Default is |
bars |
Logical argument. Default is |
histogram |
Logical argument. Default is |
bg |
Logical argument. Default is |
main |
Insert the plot title. The default is |
xlab |
Insert the title of the x-axis graphic label. The default is |
ylab |
Insert the title of the y-axis graphic label. The default is |
grids |
Insert grids to plot. The default is |
bgcol |
Insert the background color. This argument is only valid when |
bgborder |
Insert the background border color. This argument is only valid when |
barcol |
Insert the barplot color. The default is |
histcol |
Insert the histogram color. The default is |
barborder |
Insert the barplot border color. This argument is only valid when |
histborder |
Insert the histogram border color. This argument is only valid when |
type |
Type of plot. The default is |
lpcol |
Type of line color. The default is |
lwd |
numeric argument. The line width. The default is |
pch |
Type of point. The default is |
lty |
Type of line. The default is |
Ogive plot.
library(leem) # Example 1 - Both ogives rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE) # Example 2 - Insert barplot rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE, bars = TRUE) # Example 3 - Insert histogram rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE, histogram = TRUE)
library(leem) # Example 1 - Both ogives rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE) # Example 2 - Insert barplot rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE, bars = TRUE) # Example 3 - Insert histogram rnorm(36, 100, 50) |> new_leem(variable = 2) |> tabfreq() |> ogive(both = TRUE, histogram = TRUE)
P
Compute the cumulative distribution function for multiple distributions
P( q, dist = "normal", lower.tail = TRUE, rounding = 5, porcentage = FALSE, gui = "plot", main = NULL, ... )
P( q, dist = "normal", lower.tail = TRUE, rounding = 5, porcentage = FALSE, gui = "plot", main = NULL, ... )
q |
quantile. The |
dist |
distribution to use. The default is |
lower.tail |
logical; if |
rounding |
numerical; it represents the number of decimals for calculating the probability. |
porcentage |
logical; if |
gui |
default is |
main |
defalt is |
... |
additional arguments according to the chosen distribution. |
The argument that can have length 2, when we use the functions that give us the probability regions, given by: %<X<%
, %<=X<%
, %<X<=%
, %<=X<=%
, %>X>%
, %>X=>%
, %>X=>%
and %>=X=>%
.
The additional arguments represent the parameters of the distributions, that is:
If dist = "normal"
(Default); the additional arguments are: mean
() and
sd
(). The PDF is given by:
If dist = "t-student"
; the additional argument is: df
(). The PDF is given by:
If dist = "chisq"
; the additional argument is: df
(). The PDF is given by:
P
returns the probability and its graphical representation. The result can be given as a percentage or not.
# Loading package library(leem) # Example 1 - Student's t distribution ## Not run: P(q = 2, dist = "t-student", df = 10) P(q = 2, dist = "t-student", df = 10, gui = 'rstudio') P(q = 2, dist = "t-student", df = 10, gui = 'tcltk') P(-1 %<X<% 1, dist = "t-student", df = 10) ## End(Not run) # Example 2 - Normal distribution P(-2, dist = "normal", mean = 3, sd = 2, main = expression(f(x) == (1 / sqrt(n * sigma^2)) * exp(-1/2 * (x - mu)^2/sigma^2)))
# Loading package library(leem) # Example 1 - Student's t distribution ## Not run: P(q = 2, dist = "t-student", df = 10) P(q = 2, dist = "t-student", df = 10, gui = 'rstudio') P(q = 2, dist = "t-student", df = 10, gui = 'tcltk') P(-1 %<X<% 1, dist = "t-student", df = 10) ## End(Not run) # Example 2 - Normal distribution P(-2, dist = "normal", mean = 3, sd = 2, main = expression(f(x) == (1 / sqrt(n * sigma^2)) * exp(-1/2 * (x - mu)^2/sigma^2)))
Draw a pie chart.
piechart( x, labels = NULL, col = heat.colors(5, 1), border = FALSE, main = NULL, ... )
piechart( x, labels = NULL, col = heat.colors(5, 1), border = FALSE, main = NULL, ... )
x |
R object (list) of class leem. Use |
labels |
One or more expressions or character strings giving names for the slices |
col |
Character vector. Default |
border |
Logical argument (default |
main |
Title name. |
... |
further arguments passed to or from other methods. |
library(leem) # Example 1 school <- rep(c("high", "university", "basic"), 3:5) x <- sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) # Example 2 x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") x <- tabfreq(x) piechart(x)
library(leem) # Example 1 school <- rep(c("high", "university", "basic"), 3:5) x <- sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) # Example 2 x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") x <- tabfreq(x) piechart(x)
Generic function that plots the frequency polygon curve.
polyfreq(x, ...)
polyfreq(x, ...)
x |
R object (list) of class leem. Use |
... |
further arguments passed to or from other methods. |
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> polyfreq()
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> polyfreq()
Plot the frequency polygon curve.
## S3 method for class 'leem' polyfreq( x, freq = "a", type = "b", bars = TRUE, bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", lpcol = "black", lwd = 2, pch = 19, lty = 2, ... )
## S3 method for class 'leem' polyfreq( x, freq = "a", type = "b", bars = TRUE, bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, barcol = "yellow", barborder = "gray", lpcol = "black", lwd = 2, pch = 19, lty = 2, ... )
x |
R object (list) of class leem. Use |
freq |
Character argument. Type of frequency with options: |
type |
Type of plot. The default is |
bars |
Logical argument. Default is |
bg |
Logical argument. Default is |
main |
Insert the plot title. The default is |
xlab |
Insert the title of the x-axis graphic label. The default is |
ylab |
Insert the title of the y-axis graphic label. The default is |
grids |
Insert grids to plot. The default is |
bgcol |
Insert the background color. This argument is only valid when |
bgborder |
Insert the background border color. This argument is only valid when |
barcol |
Insert the barplot color. The default is |
barborder |
Insert the barplot border color. This argument is only valid when |
lpcol |
Type of line color. The default is |
lwd |
numeric argument. The line width. The default is |
pch |
Type of point. The default is |
lty |
Type of line. The default is |
... |
further arguments passed to or from other methods. |
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> polyfreq()
# Example 1 library(leem) rnorm(36, 100, 50) |> new_leem(variable = "continuous") |> tabfreq() |> polyfreq()
Using a graphical visualization, it is possible to understand the probabilities involved in a normal distribution.
probnormal( a = 1, b = 2, col = "lightblue", mean = 0, sd = 1, type = 1, rounding = 4, zang = 0, xang = 0 )
probnormal( a = 1, b = 2, col = "lightblue", mean = 0, sd = 1, type = 1, rounding = 4, zang = 0, xang = 0 )
a |
lower limit. The default is |
b |
upper limit. The default is |
col |
plot color. The default is |
mean |
parameter. The default is |
sd |
parameter. The default is |
type |
type of visualization of the probability region plot. Default is |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
zang |
Angle of the values on the Z-axis. Default is |
xang |
Angle of the values on the X-axis. Default is |
type = 1,2
: a
and b
must be greater than mean
;
type = 3,4
: a
and b
must be less than mean
;
type = 5,6
: a
and b
can be any real value.
## Not run: probnormal(type = 2) probnormal(-1, 0, type = 3) probnormal(-1, 0, type = 4) probnormal(-1, 0, type = 5) probnormal(-1, 2, type = 5) probnormal(1, 2, type = 5) probnormal(1, 2, type = 6) ## End(Not run)
## Not run: probnormal(type = 2) probnormal(-1, 0, type = 3) probnormal(-1, 0, type = 4) probnormal(-1, 0, type = 5) probnormal(-1, 2, type = 5) probnormal(1, 2, type = 5) probnormal(1, 2, type = 6) ## End(Not run)
Graphically it is possible to observe some properties of the normal distribution
propofnormal(col = "lightblue2", type = 1)
propofnormal(col = "lightblue2", type = 1)
col |
color type. |
type |
numerical. Type of properties. Options: |
Q
Quantile function for multiple distributions.
Q( p, dist = "normal", lower.tail = TRUE, two.sided = FALSE, rounding = 2, gui = "plot", mfrow = c(1, 2), type = "both", ... )
Q( p, dist = "normal", lower.tail = TRUE, two.sided = FALSE, rounding = 2, gui = "plot", mfrow = c(1, 2), type = "both", ... )
p |
probability. The |
dist |
distribution to use. The default is |
lower.tail |
logical; if |
two.sided |
logical. if |
rounding |
numerical; it represents the number of decimals for calculating the probability. |
gui |
default is |
mfrow |
numerical vector. Considering the arguments |
type |
character argument. The default is |
... |
additional parameters according to the chosen distribution. |
The expression of quantile function is given by:
where p
is the first argument of Q()
and x
its return value;
Q
returns the quantile and its graphical representation for a given distribution. The output is a vector.
# Attaching package library(leem) ## Not run: Q(p = 0.8, dist = "normal", mean = 200, sd=30) ## End(Not run)
# Attaching package library(leem) ## Not run: Q(p = 0.8, dist = "normal", mean = 200, sd=30) ## End(Not run)
These binary operators return a vector of length 2, describing the desired probability region.
a %>x>% b a %>X>% b a %<X<% b a %<x<% b a %>=X>=% b a %>=x>=% b a %<=X<=% b a %<=x<=% b a %>=X>% b a %>=x>% b a %>X>=% b a %>x>=% b a %<=X<% b a %<=x<% b a %<X<=% b a %<x<=% b
a %>x>% b a %>X>% b a %<X<% b a %<x<% b a %>=X>=% b a %>=x>=% b a %<=X<=% b a %<=x<=% b a %>=X>% b a %>=x>% b a %>X>=% b a %>x>=% b a %<=X<% b a %<=x<% b a %<X<=% b a %<x<=% b
a |
scalar. when referring to a discrete random variable, use the syntax " |
b |
scalar. when referring to a discrete random variable, use the syntax " |
A vector of lenght 2.
# Example 1 - Discrete 2L %>x>% 5L 2L %>X>% 5L 2L %<X<% 5L 2L %<x<% 5L 2L %>=X>=% 5L 2L %>=x>=% 5L 2L %<=X<=% 5L 2L %<=x<=% 5L 2L %>=X>% 5L 2L %>=x>% 5L 2L %>x>=% 5L 2L %>X>=% 5L 2L %<=X<% 5L 2L %<=x<% 5L 2L %<X<=% 5L 2L %<x<=% 5L # Example 2 - Continuous 2 %>x>% 5 2 %>X>% 5 2 %<X<% 5 2 %<x<% 5 2 %>=X>=% 5 2 %>=x>=% 5 2 %<=X<=% 5 2 %<=x<=% 5 2 %>=X>% 5 2 %>=x>% 5 2 %>x>=% 5 2 %>X>=% 5 2 %<=X<% 5 2 %<=x<% 5 2 %<X<=% 5 2 %<x<=% 5
# Example 1 - Discrete 2L %>x>% 5L 2L %>X>% 5L 2L %<X<% 5L 2L %<x<% 5L 2L %>=X>=% 5L 2L %>=x>=% 5L 2L %<=X<=% 5L 2L %<=x<=% 5L 2L %>=X>% 5L 2L %>=x>% 5L 2L %>x>=% 5L 2L %>X>=% 5L 2L %<=X<% 5L 2L %<=x<% 5L 2L %<X<=% 5L 2L %<x<=% 5L # Example 2 - Continuous 2 %>x>% 5 2 %>X>% 5 2 %<X<% 5 2 %<x<% 5 2 %>=X>=% 5 2 %>=x>=% 5 2 %<=X<=% 5 2 %<=x<=% 5 2 %>=X>% 5 2 %>=x>% 5 2 %>x>=% 5 2 %>X>=% 5 2 %<=X<% 5 2 %<=x<% 5 2 %<X<=% 5 2 %<x<=% 5
Compute the sample standard deviation
sdev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
sdev(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> sdev() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> sdev(grouped = FALSE)
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> sdev() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> sdev(grouped = FALSE)
Detailing of a box plot, showing the main information contained in this type of graph
showboxplot(horizontal = FALSE, col = rgb(0, 175, 239, maxColorValue = 255))
showboxplot(horizontal = FALSE, col = rgb(0, 175, 239, maxColorValue = 255))
horizontal |
Logical argument indicating if the boxplots should be horizontal; default |
col |
Character vector. Default |
library(leem) # Example 1 showboxplot()
library(leem) # Example 1 showboxplot()
Graphic presentation of properties for distribution function
showcdf(variable = "discrete", prop = NULL)
showcdf(variable = "discrete", prop = NULL)
variable |
Variabe type. Defaults |
prop |
Properties for distribution function. See Details. |
prop = 1
: and
;
prop = 2
: ;
prop = 3
: .
library(leem) # Example 1 showcdf()
library(leem) # Example 1 showcdf()
Detailing the confiance indice plot, showing the main information contained in this type of graph.
showci(dist = "normal", ci = "two.sided", main = NULL)
showci(dist = "normal", ci = "two.sided", main = NULL)
dist |
Parameter to indicate the distribution of the graphic, fixed for now. |
ci |
Parameter to indicate the region of the confiance indice. |
main |
Parameter to indicate the title of the graphic. |
library(leem) # Example 1 showci()
library(leem) # Example 1 showci()
showkur
Interpretation of kutosis
showkur()
showkur()
showkur
returns a plot with the kurtosis characteristics.
# Loading package library(leem) ## Not run: showkur() ## End(Not run)
# Loading package library(leem) ## Not run: showkur() ## End(Not run)
showpar
Function that exemplifies the interpretation of location and scale parameters
showpar(gui = "rstudio")
showpar(gui = "rstudio")
gui |
character argument. The options are: |
The result of the showpar()
call will interactively present a plot of the normal distribution showing the behavior of the location and scale parameters via RStudio. For showpar(gui = "tcltk")
the result will be displayed in a tcltk interface.
showpar
returns an interactive plot.
# Loading package library(leem) ## Not run: showpar() ## End(Not run)
# Loading package library(leem) ## Not run: showpar() ## End(Not run)
showskew
Interpretation of asymmetry based on frequency distributions
showskew(mpos = FALSE)
showskew(mpos = FALSE)
mpos |
Logical. It shows the measures of position or not (default |
# Loading package library(leem) ## Not run: showskew() ## End(Not run)
# Loading package library(leem) ## Not run: showskew() ## End(Not run)
Detailing of the Ztable, showing the main information contained in this type of table.
showtabnormal(z)
showtabnormal(z)
z |
Parameter for lacate the z value on the table; default |
library(leem) # Example 1 showtabnormal(1)
library(leem) # Example 1 showtabnormal(1)
Compute the skewness
skewness( x, type = "pearson", rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE )
skewness( x, type = "pearson", rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE )
x |
R object (list) of class leem. Use |
type |
character. methodology addressed. For now, we only have the |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> skewness() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> skewness(grouped = TRUE)
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> skewness() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> skewness(grouped = TRUE)
Stick chart for discrete data
stickchart( x, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, posx1 = 0, posx2 = 0, xang = 0, labels = NULL, lcol = "black", pcol = lcol, pty = 19, pwd = 3, lty = 1, lwd = 2, ... )
stickchart( x, freq = "a", bg = TRUE, main = NULL, xlab = NULL, ylab = NULL, grids = grid(col = "white"), bgcol = "gray", bgborder = NA, posx1 = 0, posx2 = 0, xang = 0, labels = NULL, lcol = "black", pcol = lcol, pty = 19, pwd = 3, lty = 1, lwd = 2, ... )
x |
R object (list) of class leem. Use |
freq |
Character argument. Type of frequency with options: |
bg |
Logical argument. Default is |
main |
Insert the plot title. The default is |
xlab |
Insert the title of the x-axis graphic label. The default is |
ylab |
Insert the title of the y-axis graphic label. The default is |
grids |
Insert grids to plot. The default is |
bgcol |
Insert the background color. This argument is only valid when |
bgborder |
Insert the background border color. This argument is only valid when |
posx1 |
Numeric argument.Distance of the labels (horizontal) in relation to the x axis. |
posx2 |
Numeric argument.Distance of the labels (vertical) in relation to the x axis. |
xang |
Numeric argument.Angle of the labels in relation to the x axis |
labels |
Character argument. Labels name vector. |
lcol |
Line color. The default is |
pcol |
Point color. The default is |
pty |
Point type. The default is |
pwd |
Point width. The default is |
lty |
Line type. The default is |
lwd |
Line width. The default is |
... |
further arguments passed to or from other methods. |
The result of stickchart()
is x
object.
library(leem) # Example 1 rbinom(30, 10, 0.4) |> new_leem() |> tabfreq() |> stickchart() # Example 2 school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) |> stickchart(xang = 15, posx2 = -0.5)
library(leem) # Example 1 rbinom(30, 10, 0.4) |> new_leem() |> tabfreq() |> stickchart() # Example 2 school <- rep(c("high", "university", "basic"), 3:5) sample(school, 30, TRUE) |> new_leem() |> tabfreq(ordered = c("basic", "high", "university")) |> stickchart(xang = 15, posx2 = -0.5)
Generic function that allows you to tabulate continuous and categorical data (quantitative or qualitative) in frequency distribution. Depending on the nature of the data, they can be grouped into class ranges or not.
tabfreq(data, ...)
tabfreq(data, ...)
data |
R object (data structure vector) of class leem. Use |
... |
further arguments passed to or from other methods. |
The result of tabfreq()
is a list. This list has two elements: table
and statistics
. The first is the data frequency table, and the second represents some useful statistics for methods of leem class.
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") tabfreq(x) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = "continuous") |> tabfreq() # Example 3 x <- rbinom(36, 10, 0.6) # Constructor (object of leem class) x <- new_leem(x, variable = "discrete") tab <- tabfreq(x) # Details tab$table tab$statistics # Example 3 - ordered categories ("d","a", "b", "c") w <- rep(letters[1:4], 1:4) w |> new_leem(variable = "discrete") |> tabfreq(ordered = c("d","a", "b", "c"))
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") tabfreq(x) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = "continuous") |> tabfreq() # Example 3 x <- rbinom(36, 10, 0.6) # Constructor (object of leem class) x <- new_leem(x, variable = "discrete") tab <- tabfreq(x) # Details tab$table tab$statistics # Example 3 - ordered categories ("d","a", "b", "c") w <- rep(letters[1:4], 1:4) w |> new_leem(variable = "discrete") |> tabfreq(ordered = c("d","a", "b", "c"))
Allows you to tabulate continuous and categorical data (quantitative or qualitative) in frequency distribution. Depending on the nature of the data, they can be grouped into class ranges or not.
## S3 method for class 'leem' tabfreq( data, k = NULL, na.rm = FALSE, ordered = NULL, namereduction = TRUE, ... )
## S3 method for class 'leem' tabfreq( data, k = NULL, na.rm = FALSE, ordered = NULL, namereduction = TRUE, ... )
data |
R object (data structure vector) of class leem. Use |
k |
Number of classes. Default is |
na.rm |
a logical evaluating to TRUE or FALSE indicating whether NA values should be stripped before the computation proceeds. |
ordered |
Ordered vector of the same length and elements of data object. Default is |
namereduction |
Logical argument. If |
... |
further arguments passed to or from other methods. |
The result of tabfreq()
is a list. This list has two elements: table
and statistics
. The first is the data frequency table, and the second represents some useful statistics for methods of leem class.
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") tabfreq(x) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = "continuous") |> tabfreq() # Example 3 x <- rbinom(36, 10, 0.6) # Constructor (object of leem class) x <- new_leem(x, variable = "discrete") tab <- tabfreq(x) # Details tab$table tab$statistics # Example 3 - ordered categories ("d","a", "b", "c") w <- rep(letters[1:4], 1:4) w |> new_leem(variable = "discrete") |> tabfreq(ordered = c("d","a", "b", "c"))
# Example 1 library(leem) x <- rbinom(36, 10, 0.6) x <- new_leem(x, variable = "discrete") tabfreq(x) # Example 2 (Pipe operator) rnorm(36, 100, 4) |> new_leem(variable = "continuous") |> tabfreq() # Example 3 x <- rbinom(36, 10, 0.6) # Constructor (object of leem class) x <- new_leem(x, variable = "discrete") tab <- tabfreq(x) # Details tab$table tab$statistics # Example 3 - ordered categories ("d","a", "b", "c") w <- rep(letters[1:4], 1:4) w |> new_leem(variable = "discrete") |> tabfreq(ordered = c("d","a", "b", "c"))
Performs hypothesis testing for various parameters of one or more populations
th( x, y = NULL, test = "ztest", h0, prop = FALSE, delta = 0, p, pa, alternative = c("two.sided", "L", "less", "greater", "G"), alpha = 0.05, exact = TRUE, correct = FALSE, paired = FALSE, plot = FALSE, ... )
th( x, y = NULL, test = "ztest", h0, prop = FALSE, delta = 0, p, pa, alternative = c("two.sided", "L", "less", "greater", "G"), alpha = 0.05, exact = TRUE, correct = FALSE, paired = FALSE, plot = FALSE, ... )
x |
R object. See in details. |
y |
an optional (non-empty) numeric vector of data values. |
test |
character value. The options are: |
h0 |
numeric value. The hypothesized parameter. |
prop |
a logical indicating whether you want to use the proportion test of not. Default is |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. |
alpha |
significance level of the test |
exact |
a logical indicating whether you want to use the exact test or not. Default is |
correct |
a logical indicating whether Yates' continuity correction should be applied where possible. This argument must be used when |
paired |
a logical indicating whether you want a paired t-test. Valid only for |
plot |
a logical indicating whether you want a graph indicating the regions of rejection or not of the null hypothesis, as well as the test decision. |
# Null hypothesis nullhyp <- h0 <- 90 # Simulation set.seed(10) data <- rnorm(30, 100, 10) # Test of hypothesis th(data, h0 = h0, sd = 10, plot = TRUE)
# Null hypothesis nullhyp <- h0 <- 90 # Simulation set.seed(10) data <- rnorm(30, 100, 10) # Test of hypothesis th(data, h0 = h0, sd = 10, plot = TRUE)
Compute the sample variance
variance(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
variance(x, rounding = 2, na.rm = FALSE, details = FALSE, grouped = TRUE)
x |
R object (list) of class leem. Use |
rounding |
Numerical object. Rounds the values in its first argument to the specified number of decimal places (default |
na.rm |
a logical value indicating whether |
details |
Logical object. Details of data (default |
grouped |
Logical object. Determines whether the measure of position result will be based on grouped data or not (default |
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> variance() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> variance(grouped = FALSE)
# Example 1: Poisson data rpois(30, 2.5) |> new_leem() |> variance() # Example 2: Normal data rnorm(50, 100, 2.5) |> new_leem(variable = 2) |> variance(grouped = FALSE)