Title: | Laboratory of Teaching to Statistics and Mathematics |
---|---|
Description: | An educational package for the teaching of statistics and mathematics in primary and higher education. The objective is to assist in teaching/learning for both student study planning and teacher teaching strategies. The leem package will try to bring, in a simple and at the same time in-depth, knowledge of statistics and mathematics to everyone who wants to study these areas of knowledge. The main function of the package is 'leem' function. |
Authors: | Ben Deivide [aut, cre] , Alexandre Celestino [ctb] , Juliane Nassarala [ctb] |
Maintainer: | Ben Deivide <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.0.9000 |
Built: | 2024-11-07 21:13:45 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)
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)
Generic function that allows inserting measures of position in plots
insert(dados, ...) ## Leem S3 method: insert(x, type = "black", lcol, tcol = lcol, acol = lcol, parrow = 0.5, larrow = 0.2, ptext = 0.6, side = "right", lwd = 2, lwdarrow = lwd) ## Default S3 method: insert(x)
insert(dados, ...) ## Leem S3 method: insert(x, type = "black", lcol, tcol = lcol, acol = lcol, parrow = 0.5, larrow = 0.2, ptext = 0.6, side = "right", lwd = 2, lwdarrow = lwd) ## Default S3 method: insert(x)
x |
R object (list) of class leem. Use |
type |
Type of measure of position. 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 |
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) 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 )
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()
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()
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 |
... |
further arguments passed to or from other methods. |
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)
Generic function that plots the culmulative frequency curve.
ogive(x, ...) ## Leem S3 method: ogive(x, 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, ...) ## Leem S3 method: ogive(x, 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 |
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, hist = 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, hist = 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 |
... |
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:
dist = "t-student"
: nu
argument () represents the degrees of freedom parameter. The PDF is
\frac{\Gamma\left\( \frac{\nu + 1}{2} \right\)}{\sqrt{\nu \pi}}\left\(1 + \frac{x^2}{\nu}\right\)
P
returns the probability and its graphical representation. The result can be given as a percentage or not.
# Loading package library(leem) # Example 1 - t-Student 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 - t-Student 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, ...) ## Leem S3 method: polyfreq.leem(x, 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)
polyfreq(x, ...) ## Leem S3 method: polyfreq.leem(x, 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 |
... |
further arguments passed to or from other methods. |
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 |
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 |
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 |
# 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()
Draw a pie chart.
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 )
col |
Character vector. Default |
x |
R object (list) of class leem. Use |
labels |
One or more expressions or character strings giving names for the slices |
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)
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)
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)
measures |
shows the measures of position or not (default |
showskew
returns a plot with the skewsness characteristics.
# 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(zvalue)
library(leem) # Example 1 showtabnormal(zvalue)
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 |
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
stickchartunction(x, ...)
stickchartunction(x, ...)
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(dados, ...) ## Leem S3 method: tabfreq(data, k = NULL, na.rm = FALSE, ordered = NULL, namereduction = TRUE, ...) ## Default S3 method: tabfreq(data)
tabfreq(dados, ...) ## Leem S3 method: tabfreq(data, k = NULL, na.rm = FALSE, ordered = NULL, namereduction = TRUE, ...) ## Default S3 method: tabfreq(data)
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 |
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. |
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)