Learn R Programming

SciencesPo (version 1.3.9)

detail: Method to Produce Descriptive Statistics Summary

Description

Method to Produce Descriptive Statistics Summary

This function provides up to 14 statistics for an entire data object: number of cases, mean, standard deviation, variance, standard error, median, mad (median absolute deviation), trimmed and winsorized means, range, minimum, maximum, skewness, and kurtosis. Statistics for a factor variable might be computed based on its `levels`, and is shown accompained whit ans "*".

Usage

detail(.data, by = NULL, basic = FALSE, na.rm = TRUE, trim = 0.2,
  type = 2, k = 1)

detail(.data, by = NULL, basic = FALSE, na.rm = TRUE, trim = 0.2, type = 2, k = 1)

Arguments

.data
a data object (vector or data.frame).
by
a factor variable
basic
indicates if only a short version of the descriptive table should be returned, the default is basic=TRUE.
na.rm
a logical value for na.rm, default is na.rm=TRUE.
trim
is the proportion of the data to be replaced for estimating the average
type
a numeric value (fraction) to be trimmed. The value in trim will be discarded from the top and bottom of data. See in details below
k
a numeric value for observations in the data set to be discarded while computing the winsorized mean. See details below
...
Parameters which are typically ignored

Value

  • A data.frame of descriptive statistics

    A data frame containing the require computations

encoding

UTF-8

Details

Trimming is not winsorizing. The winsorization process is more complex than simply excluding data. For example, while in a trimmed estimator the extreme values are discarded, in a winsorized estimator, they are rather replaced by certain percentiles.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S.. Springer.

Examples

Run this code
#load some data
data(marriage)

# To apply the function
detail(marriage, trim = 0.5, k = 3)

Run the code above in your browser using DataLab