calcularResumenVariablesDiscretas: Summary statistics for discrete variables

calcularResumenVariablesDiscretasR Documentation

Summary statistics for discrete variables

Description

calcularResumenVariablesDiscretas gives the main statistical summary for discrete variables (mean, standard deviation, coefficient of variation, skewness, kurtosis and quantiles). Also builds the frequency table

Usage

calcularResumenVariablesDiscretas(data,
                                  statistics = c("mean", "sd", "se(mean)", "IQR",
                                  "quantiles", "cv", "skewness", "kurtosis"),
                                  quantiles = c(0, 0.25, 0.5, 0.75, 1), groups = NULL,
                                  tablaFrecuencia = FALSE, cortes=NULL)

Arguments

data

data.frame with the discrete variables.

statistics

any of "mean", "sd", "se(mean)", "quantiles", "cv" (coefficient of variation - sd/mean), "skewness" or "kurtosis"; defaulting to c("mean", "sd", "quantiles", "IQR").

quantiles

quantiles to report; by default is c(0, 0.25, 0.5, 0.75, 1).

groups

optional variable, typically a factor, to be used to partition the data. By default is NULL.

tablaFrecuencia

logical value indicating whether or not to display the frequency table, by default is FALSE.

cortes

one of:

  • a numeric vector of two or more unique cut points,

  • a single number (greater than or equal to 2) giving the number of intervals into which data is to be cut,

  • a character string naming an algorithm to compute the number of intervals into which data is to be cut (see 'Details')

by default is NULL.

Details

calcularResumenVariablesDiscretas performs a descriptive analysis of discrete variables (quantitative variables that take as a finite or infinite numerable distinct values), generating a table of statistics (arithmetic mean, standard deviation, interquartile range, coefficient of variation, skewness, kurtosis, and quantiles) optionally allowing the partition of the data by a factor variable (groups).

It also allows to show the frequency table of selected discrete variables by selecting tablaFrecuencia=TRUE. Moreover it also allows to divide the range of the variables into intervals given by the argument cortes (breaks). See more info in cut and in hist.

Value

calcularResumenVariablesDiscretas returns a list of two elements:

.numsummary

an object of class "numSummary" containing the numerical summary of the discrete variables.

.table

a matrix containing the values of the frequency table.

See Also

cut, hist

Examples

## Not run: 
data(cars93)
calcularResumenVariablesDiscretas(data=cars93["Cylinders"],group=NULL)
calcularResumenVariablesDiscretas(data=cars93["Cylinders"],group=cars93$Airbags)
bb <- calcularResumenVariablesDiscretas(data=cars93["Cylinders"],group=cars93$Airbags,
                                        tablaFrecuencia=TRUE)
str(bb)
bb
bb$.summary
class(bb$.summary)

calcularResumenVariablesDiscretas(data=cars93["Horsepower"], tablaFrecuencia=TRUE)
calcularResumenVariablesDiscretas(data=cars93["Horsepower"], tablaFrecuencia=TRUE, cortes=5)
calcularResumenVariablesDiscretas(data=cars93["Horsepower"], tablaFrecuencia=TRUE,
                                  cortes=c(50,100,200,250,300))
calcularResumenVariablesDiscretas(data=cars93["Horsepower"], tablaFrecuencia=TRUE,
                                  cortes="Sturges")                                
calcularResumenVariablesDiscretas(data=cars93["Horsepower"], groups=cars93$Airbags, 
                                  tablaFrecuencia=TRUE, cortes=5)

## End(Not run)

RcmdrPlugin.TeachStat documentation built on Nov. 14, 2023, 5:08 p.m.