| StressAnxiety | R Documentation |
Data from a study examining the relationship between stress and anxiety levels among nonclinical women in Townsville, Queensland, Australia.
StressAnxiety
A data frame with 166 observations on 2 variables:
numeric. Stress score transformed to the open unit interval (0, 1). Original scale ranged from 0 to 42 on the Depression Anxiety Stress Scales (DASS).
numeric. Anxiety score transformed to the open unit interval (0, 1). Original scale ranged from 0 to 42 on the DASS.
Both stress and anxiety were assessed using the Depression Anxiety Stress Scales (DASS), ranging from 0 to 42. Smithson and Verkuilen (2006) transformed these scores to the open unit interval (without providing specific details about the transformation method).
The dataset is particularly interesting for demonstrating heteroscedastic relationships: not only does mean anxiety increase with stress, but the variability in anxiety also changes systematically with stress levels. This makes it an ideal case for beta regression with variable dispersion.
Data from Smithson and Verkuilen (2006) supplements. Original data source not specified.
Smithson, M., and Verkuilen, J. (2006). A Better Lemon Squeezer? Maximum-Likelihood Regression with Beta-Distributed Dependent Variables. Psychological Methods, 11(1), 54–71.
require(gkwreg)
require(gkwdist)
data(StressAnxiety)
# Example 1: Basic heteroscedastic relationship
# Mean anxiety increases with stress
# Variability in anxiety also changes with stress
fit_kw <- gkwreg(
anxiety ~ stress |
stress,
data = StressAnxiety,
family = "kw"
)
summary(fit_kw)
# Interpretation:
# - Alpha: Positive relationship between stress and mean anxiety
# - Beta: Precision changes with stress level
# (anxiety becomes more/less variable at different stress levels)
# Compare to homoscedastic model
fit_kw_homo <- gkwreg(anxiety ~ stress,
data = StressAnxiety, family = "kw"
)
anova(fit_kw_homo, fit_kw)
# Example 2: Nonlinear stress effects via polynomial
# Stress-anxiety relationship often shows threshold or saturation effects
fit_kw_poly <- gkwreg(
anxiety ~ poly(stress, 2) | # quadratic mean
poly(stress, 2), # quadratic precision
data = StressAnxiety,
family = "kw"
)
summary(fit_kw_poly)
# Interpretation:
# - Quadratic terms allow for:
# * Threshold effects (anxiety accelerates at high stress)
# * Saturation effects (anxiety plateaus at extreme stress)
# Test nonlinearity
anova(fit_kw, fit_kw_poly)
# Example 3: Exponentiated Kumaraswamy for extreme anxiety patterns
# Some individuals may show very extreme anxiety responses to stress
fit_ekw <- gkwreg(
anxiety ~ poly(stress, 2) | # alpha: quadratic mean
poly(stress, 2) | # beta: quadratic precision
stress, # lambda: linear tail effect
data = StressAnxiety,
family = "ekw"
)
summary(fit_ekw)
# Interpretation:
# - Lambda: Linear component captures asymmetry at extreme stress levels
# (very high stress may produce different tail behavior)
# Example 4: McDonald distribution for highly skewed anxiety
# Anxiety distributions are often right-skewed (ceiling effects)
fit_mc <- gkwreg(
anxiety ~ poly(stress, 2) | # gamma
poly(stress, 2) | # delta
stress, # lambda: extremity
data = StressAnxiety,
family = "mc",
control = gkw_control(method = "BFGS", maxit = 1500)
)
summary(fit_mc)
# Compare models
AIC(fit_kw, fit_kw_poly, fit_ekw, fit_mc)
# Visualization: Stress-Anxiety relationship
plot(anxiety ~ stress,
data = StressAnxiety,
xlab = "Stress Level", ylab = "Anxiety Level",
main = "Stress-Anxiety Relationship with Heteroscedasticity",
pch = 19, col = rgb(0, 0, 1, 0.3)
)
# Add fitted curve
stress_seq <- seq(min(StressAnxiety$stress), max(StressAnxiety$stress),
length.out = 100
)
pred_mean <- predict(fit_kw, newdata = data.frame(stress = stress_seq))
lines(stress_seq, pred_mean, col = "red", lwd = 2)
# Add lowess smooth for comparison
lines(lowess(StressAnxiety$stress, StressAnxiety$anxiety),
col = "blue", lwd = 2, lty = 2
)
legend("topleft",
legend = c("Kumaraswamy fit", "Lowess smooth"),
col = c("red", "blue"), lwd = 2, lty = c(1, 2)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.