Skip to contents

w_kurtosis() measures how heavy the tails of your data's distribution are, using survey weights for population-representative results. Kurtosis tells you whether your data has unusually many extreme values (outliers) compared to a normal distribution:

  • Positive (excess) kurtosis: Heavier tails than normal (more outliers)

  • Negative (excess) kurtosis: Lighter tails than normal (fewer outliers)

  • Near zero: Similar tail behavior to a normal distribution

Usage

w_kurtosis(data, ..., weights = NULL, na.rm = TRUE, excess = TRUE)

Arguments

data

Your survey data (a data frame or tibble)

...

The numeric variables you want to analyze. You can list multiple variables or use helpers like starts_with("trust")

weights

Survey weights to make results representative of your population. Without weights, you get the simple sample kurtosis. Give a column name (unquoted or as a string), an expression such as sampling_weight * 2, or a numeric vector with one weight per row.

na.rm

Remove missing values before calculating? (Default: TRUE). With FALSE, the result for a variable that contains missing values is NA (as in base R).

excess

Show excess kurtosis? (Default: TRUE, matching SPSS). Excess kurtosis subtracts 3 so that a normal distribution has kurtosis of 0, making interpretation easier.

Value

Population-weighted kurtosis value(s) with sample size information, including the weighted kurtosis, effective sample size (effective N), and the number of valid observations used.

Details

Understanding the Results

  • Weighted Kurtosis (excess, default):

    • Near 0: Tail behavior similar to a normal distribution

    • Positive (> 0): Heavier tails, more extreme values than normal

    • Negative (< 0): Lighter tails, fewer extreme values than normal

    • Values beyond 2 or below -2 indicate notable departure from normality

  • Effective N: How many independent observations your weighted data represents.

  • N / Missing: Valid and missing cases. With weights, both are sums of weights (displayed rounded), as SPSS reports them under WEIGHT BY; Kish's effective N is shown by summary().

Kurtosis is often checked together with skewness to assess normality. Both should be close to zero for normally distributed data.

When to Use This

Use w_kurtosis() when:

  • You need to assess whether a variable follows a normal distribution

  • You want to check for unusually many outliers

  • You are deciding whether parametric tests are appropriate

  • You need SPSS-compatible weighted kurtosis values

Formula

Uses the SPSS Type 2 (sample-corrected) excess kurtosis formula. First, the population excess kurtosis (\(g_2\)) is calculated:

\(g_2 = \frac{m_4}{m_2^2} - 3\)

where \(m_2 = \sum w_i(x_i - \bar{x}_w)^2 / V_1\) and \(m_4 = \sum w_i(x_i - \bar{x}_w)^4 / V_1\) with \(V_1 = \sum w_i\).

Then, the bias-corrected (Type 2) kurtosis is:

\(G_2 = \frac{(n+1) \cdot g_2 + 6}{(n-2)(n-3)} \cdot (n-1)\)

where \(n = V_1\) for weighted data.

References

Joanes, D. N., & Gill, C. A. (1998). Comparing measures of sample skewness and kurtosis. The Statistician, 47(1), 183-189.

IBM Corp. (2023). IBM SPSS Statistics 29 Algorithms. IBM Corporation.

See also

w_skew for weighted skewness (distribution asymmetry).

describe for comprehensive descriptive statistics including kurtosis.

Other weighted_statistics: w_iqr(), w_mean(), w_median(), w_modus(), w_quantile(), w_range(), w_sd(), w_se(), w_skew(), w_var()

Examples

# Load required packages and data
library(dplyr)
data(survey_data)

# Basic weighted kurtosis (excess kurtosis, default)
survey_data %>% w_kurtosis(age, weights = sampling_weight)
#> 
#> Weighted Excess Kurtosis Statistics
#> -----------------------------------
#> Weights: sampling_weight
#> 
#>   ---------------------------------
#>   Variable  Kurtosis     N  Missing
#>   ---------------------------------
#>   age         -0.396  2516        0
#>   ---------------------------------

# Multiple variables
survey_data %>% w_kurtosis(age, income, life_satisfaction, weights = sampling_weight)
#> 
#> Weighted Excess Kurtosis Statistics
#> -----------------------------------
#> Weights: sampling_weight
#> 
#>   ------------------------------------------
#>   Variable           Kurtosis     N  Missing
#>   ------------------------------------------
#>   age                  -0.396  2516        0
#>   income                0.388  2201      315
#>   life_satisfaction    -0.598  2437       79
#>   ------------------------------------------

# Grouped data
survey_data %>% group_by(region) %>% w_kurtosis(age, weights = sampling_weight)
#> 
#> Weighted Excess Kurtosis Statistics
#> -----------------------------------
#> Weights: sampling_weight
#> 
#> Group: region = East
#> --------------------
#> 
#>   --------------------------------
#>   Variable  Kurtosis    N  Missing
#>   --------------------------------
#>   age         -0.389  509        0
#>   --------------------------------
#> 
#> Group: region = West
#> --------------------
#> 
#>   ---------------------------------
#>   Variable  Kurtosis     N  Missing
#>   ---------------------------------
#>   age         -0.396  2007        0
#>   ---------------------------------

# Raw kurtosis (not excess)
survey_data %>% w_kurtosis(age, weights = sampling_weight, excess = FALSE)
#> 
#> Weighted Kurtosis Statistics
#> ----------------------------
#> Weights: sampling_weight
#> 
#>   ---------------------------------
#>   Variable  Kurtosis     N  Missing
#>   ---------------------------------
#>   age          2.604  2516        0
#>   ---------------------------------

# In summarise context
survey_data %>% summarise(kurt_age = w_kurtosis(age, weights = sampling_weight))
#> # A tibble: 1 × 1
#>   kurt_age
#>      <dbl>
#> 1   -0.396

# Unweighted (for comparison)
survey_data %>% w_kurtosis(age)
#> 
#> Excess Kurtosis Statistics
#> --------------------------
#> 
#>   ---------------------------------
#>   Variable  Kurtosis     N  Missing
#>   ---------------------------------
#>   age         -0.364  2500        0
#>   ---------------------------------