descript {misty} | R Documentation |
Descriptive Statistics
Description
This function computes summary statistics for one or more than one variable, optionally
by a grouping and/or split variable. By default, the function prints
the number of observations (n
), number of missing values (nNA
),
percentage of missing values (%NA
), arithmetic mean (M
), standard
deviation (SD
), minimum (Min
), percentage of observations at the
minimum (%Min
), maximum (Max
), percentage of observations at the
maximum (%Max
), skewness (Skew
), and kurtosis (Kurt
).
Usage
descript(data, ...,
print = c("all", "default", "n", "nNA", "pNA", "m", "se.m", "var", "sd",
"min", "p.min", "p25", "med", "p75", "max", "p.max", "range",
"iqr", "skew", "kurt"),
group = NULL, split = NULL, sample = FALSE, sort.var = FALSE,
na.omit = FALSE, digits = 2, as.na = NULL, write = NULL, append = TRUE,
check = TRUE, output = TRUE)
Arguments
data |
a numeric vector or data frame with numeric variables,
i.e., factors and character variables are excluded from
|
... |
an expression indicating the variable names in |
print |
a character vector indicating which statistical measures to be
printed on the console, i.e., |
group |
a numeric vector, character vector or factor as grouping variable.
Alternatively, a character string indicating the variable name
of the grouping variable in |
split |
a numeric vector, character vector or factor as split variable.
Alternatively, a character string indicating the variable name
of the split variable in |
sample |
logical: if |
sort.var |
logical: if |
na.omit |
logical: if |
digits |
an integer value indicating the number of decimal places to be used. |
as.na |
a numeric vector indicating user-defined missing values,
i.e. these values are converted to |
write |
a character string naming a file for writing the output into
either a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
Details
- Floor and Ceiling Effects
This function computes the percentage of observations at both the minimum and maximum to evaluate floor and ceiling effects in continuous variables. Historically, floor or ceiling effects are considered to be present if more than 15% of observations are at the lowest or highest possible score (McHorney & Tarlov, 1995; Terwee et al., 2007). Muthen (2023, see video at 7:58) noted that as a rule of thumb linear models should be avoided when the floor or ceiling effect of the outcome variable exceeds 25%.
Value
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
data |
list with the input specified in |
args |
specification of function arguments |
result |
result table |
Author(s)
Takuya Yanagida takuya.yanagida@univie.ac.at
References
McHorney, C. A., & Tarlov, A. R. (1995). Individual-patient monitoring in clinical practice: are available health status surveys adequate?. Quality of Life Research, 4(4), 293-307. https://doi.org/10.1007/BF01593882
Muthen, B. (2023, Feb. 28). Mplus Web Talk No. 6 - Using Mplus To Do Dynamic Structural Equation Modeling: Segment 3, Descriptive Analyses [Video]. YouTube. https://www.statmodel.com/Webtalk6.shtml
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. John Wiley & Sons.
Terwee, C. B., Bot, S. D., de Boer, M. R., van der Windt, D. A., Knol, D. L., Dekker, J., Bouter, L. M., & de Vet, H. C. (2007). Quality criteria were proposed for measurement properties of health status questionnaires. Journal of Clinical Epidemiology, 60(1), 34-42. https://doi.org/10.1016/j.jclinepi.2006.03.012
See Also
ci.mean
, ci.mean.diff
, ci.median
,
ci.prop
, ci.prop.diff
, ci.var
,
ci.sd
, freq
, crosstab
,
multilevel.descript
, na.descript
.
Examples
#----------------------------------------------------------------------------
# Descriptive statistics
# Example 1a: Descriptive statistics for 'mpg', 'cyl', and 'hp'
descript(mtcars, mpg, cyl, hp)
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")])
# Example 1b: Print all available statistical measures
descript(mtcars, mpg, cyl, hp, print = "all")
# Example 1c: Print default statistical measures plus median
descript(mtcars, mpg, cyl, hp, print = c("default", "med"))
#----------------------------------------------------------------------------
# Grouping and Split Variable
# Example 2a: Grouping variable
descript(mtcars, mpg, cyl, hp, group = "vs")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs)
# Example 2b: Split variable
descript(mtcars, mpg, cyl, hp, split = "am")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], split = mtcars$am)
# Example 2c: Grouping and split variable
descript(mtcars, mpg, cyl, hp, group = "vs", split = "am")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs, split = mtcars$am)
#----------------------------------------------------------------------------
# Write Output
## Not run:
# Example 3a: Text file
descript(mtcars, write = "Descript_Text.txt")
# Example 3b: Excel file
descript(mtcars, write = "Descript_Excel.xlsx")
## End(Not run)