pairwise_phi: Pairwise Pearson's Phi

View source: R/pairwise_phi.R

pairwise_phiR Documentation

Pairwise Pearson's Phi

Description

Calculates the pairwise Pearson's Phi coefficient of correlation.

Usage

pairwise_phi(data, cols, case_weights)

Arguments

data

A data frame.

cols

Columns to analyze.

case_weights

An optional column of case weights.

Details

  • Metric: Correlation/similarity

  • Symmetrical: Yes

  • Upper Limit: 1

  • Lower Limit: -1

B
1 0
A 1 a b
0 c d

Phi = ((a*d)-(c*b))/sqrt((a+c)*(c+d)*(a+b)*(b+d))

Value

A matrix.

Examples

res <- pairwise_phi(
    data = FoodSample,
    cols = Bisque:Turkey
)

print(res)

tidy(res)


ttrodrigz/onezero documentation built on May 9, 2023, 2:59 p.m.