Here is an example of my data
Subject1 <- data.frame(Group = c("A","B","C","D"), Value = c(0.2,0.3,0.1,0.4)) Subject2 <- data.frame(Group = c("C","D","E","G"), Value = c(0.5,0.1,0.2,0.2))
I have two tables with a group and value associated with each group.
I want the weight to be based on the sum of values which match and the correlation based on the values with a matching group.
In this example there are two matching groups “C” and “D” each with a number associated.
In my real dataset, 1 subject might have 20 groups whilst the other might have only 5. THey may or may not have matching groups. If they don’t have any matching groups I’d expect a value of 0. The sum of values always equal 1 for each subject.
Any ideas how to do this?