Math, asked by dominicasoft3272, 1 year ago

How to find two highly correlated values in r

Answers

Answered by rishika79
0

Answer:

Step-by-step explanation:

vector of indices denoting the columns to remove (when names = TRUE) otherwise a vector of column names. If no correlations meet the criteria, integer(0) is returned.

Author(s)

Original R code by Dong Li, modified by Max Kuhn

See Also

leaps, genetic, anneal, findLinearCombos

R1 <- structure(c(1, 0.86, 0.56, 0.32, 0.85, 0.86, 1, 0.01, 0.74, 0.32,

0.56, 0.01, 1, 0.65, 0.91, 0.32, 0.74, 0.65, 1, 0.36,

0.85, 0.32, 0.91, 0.36, 1),

.Dim = c(5L, 5L))

colnames(R1) <- rownames(R1) <- paste0("x", 1:ncol(R1))

R1

findCorrelation(R1, cutoff = .6, exact = FALSE)

findCorrelation(R1, cutoff = .6, exact = TRUE)

findCorrelation(R1, cutoff = .6, exact = TRUE, names = FALSE)

R2 <- diag(rep(1, 5))

R2[2, 3] <- R2[3, 2] <- .7

R2[5, 3] <- R2[3, 5] <- -.7

R2[4, 1] <- R2[1, 4] <- -.67

corrDF <- expand.grid(row = 1:5, col = 1:5)

corrDF$correlation <- as.vector(R2)

levelplot(correlation ~ row + col, corrDF)

findCorrelation(R2, cutoff = .65, verbose = TRUE)

findCorrelation(R2, cutoff = .99, verbose

Hope it helps you....

Similar questions