correlation_within function

Within groups correlation

Within groups correlation

This function computes the correlation between the two attributes for individuals in the same group.

correlation_within(partition, attribute1, attribute2, group)

Arguments

  • partition: A partition (vector)
  • attribute1: A vector containing the values of the first attribute
  • attribute2: A vector containing the values of the second attribute
  • group: A number indicating the selected group

Returns

A number corresponding to the correlation coefficient

Examples

p <- c(1,2,2,3,3,4,4,4,5) at <- c(3,5,23,2,1,0,3,9,2) at2 <- c(3,5,20,2,1,0,0,9,0) correlation_within(p,at,at2,4)
  • Maintainer: Marion Hoffman
  • License: GPL (>= 3)
  • Last published: 2024-05-10