cdda.vardist {dda} | R Documentation |
Conditional Directional Dependence Analysis: Variable Distributions
Description
cdda.vardist
computes DDA test statistics for observed
variable distributions of competing conditional models
(y ~ x * m
vs.x ~ y * m
with m
being a continuous or categorical moderator).
print
returns the output of standard linear model coefficients
for competing target and alternative models.
plot
returns graphs for CDDA test statistics obtained from competing conditional models.
summary
returns test statistics from the cdda.vardist
class object.
Usage
cdda.vardist(
formula,
pred = NULL,
mod = NULL,
data = list(),
modval = NULL,
B = 200,
boot.type = "perc",
conf.level = 0.95
)
## S3 method for class 'cdda.vardist'
print(x, ...)
## S3 method for class 'cdda.vardist'
plot(x, stat = NULL, ylim = NULL, ...)
## S3 method for class 'cdda.vardist'
summary(object, skew = TRUE, coskew = FALSE, kurt = TRUE, cokurt = FALSE, ...)
Arguments
formula |
Symbolic formula of the model to be tested or a |
pred |
A character indicating the variable name of the predictor which serves as the outcome in the alternative model. |
mod |
A character indicating the variable name of the moderator. |
data |
A required data frame containing the variables in the model. |
modval |
Characters or a numeric sequence specifying the moderator
values used in post-hoc probing. Possible characters
include |
B |
Number of bootstrap samples. |
boot.type |
A character indicating the type of bootstrap confidence intervals. Must be one of the two values |
conf.level |
Confidence level for bootstrap confidence intervals. |
x |
An object of class |
... |
Additional arguments to be passed to the function. |
stat |
A character indicating the statistic to be plotted, default is
|
ylim |
A numeric vector of length 2 indicating the y-axis limits. If |
object |
An object of class |
skew |
A logical value indicating whether skewness differences and separate D'Agostino skewness tests should be returned when using |
coskew |
A logical value indicating whether co-skewness differences should be returned when using |
kurt |
A logical value indicating whether excess kurtosis differences and Anscombe-Glynn kurtosis tests should be returned when using |
cokurt |
A logical value indicating whether co-kurtosis differences should be returned when using |
Value
A list of class cdda.vardist
containing the results of
CDDA tests to evaluate distributional properties of observed
variables for pre-specified moderator values.
References
Wiedermann, W., & von Eye, A. (2025). Direction Dependence Analysis: Foundations and Statistical Methods. Cambridge, UK: Cambridge University Press.
See Also
dda.vardist
for an unconditional version.
Examples
set.seed(321)
n <- 700
## --- generate moderator
z <- sort(rnorm(n))
z1 <- z[z <= 0]
z2 <- z[z > 0]
## --- x -> y when z <= 0
x1 <- rchisq(length(z1), df = 4) - 4
e1 <- rchisq(length(z1), df = 3) - 3
y1 <- 0.5 * x1 + e1
## --- y -> x when m z > 0
y2 <- rchisq(length(z2), df = 4) - 4
e2 <- rchisq(length(z2), df = 3) - 3
x2 <- 0.25 * y2 + e2
y <- c(y1, y2); x <- c(x1, x2)
d <- data.frame(x, y, z)
m <- lm(y ~ x * z, data = d)
result <- cdda.vardist(m, pred = "x", mod = "z", B = 50,
modval = c(-1, 1), data = d)
print(result)
plot(result, stat = "rtanh", ylim = c(-0.05, 0.05))
summary(result, skew = FALSE, kurt = FALSE, coskew = TRUE)