Learn R Programming

discreteRV (version 1.2.2)

independent: Tests whether the random variables X and Y are independent

Description

Tests whether the random variables X and Y are independent

Usage

independent(X, Y)

Arguments

X
A random variable
Y
A random variable

Examples

Run this code
AandB <- jointRV(outcomes = list(1:3, 0:2), probs = 1:9 / sum(1:9))
A <- marginal(AandB, 1)
B <- marginal(AandB, 2)
independent(A, B) # FALSE
CandD <- jointRV(outcomes = list(1:3, 0:2))
C <- marginal(CandD, 1)
D <- marginal(CandD, 2)
independent(C, D) # FALSE

Run the code above in your browser using DataLab