# How to detect variables discriminating a sample from the rest of the samples?

I have a traditionally structured data set where rows are observations and columns are variables. There are only a few observations but comparatively more variables. The observations are regions of a country and the variables are characteristics (i.e., population size, mean income, number of males, number of females, etc.). I need to find out which characteristics can distinguish one region from the rest. For example, I need to find out if population size distinguishes region 1 most from regions 2, 3, 4, etc.

Which statistical methods are available to perform this type of analysis? Your help is appreciated.

Just in case it is not clear, my data looks something like the following.

     A, B, C, D
R1   8, 9, 5, 4
R2   5, 8, 4, 5
R3   7, 9, 7, 4


Where R1 = region 1, R2 = region 2, R3 = region 3, A = population, B = average income, C = number of males, D = number of females. My queries are something like this:

• how is R1 different from the set {R2, R3}?
• how is R2 different from the set {R1, R3}?
• how is R3 different from {R1, R2}?

The expected answers look something like this:

• A make R1 different from {R2, R3}?
• {A, D} make R2 different from {R1, R3}?
-
You might consider having a look at analysis of variance (ANOVA), which generalizes the t-test to more than two groups. Take a look here and here for more details. –  Alexander May 17 '12 at 14:08
@Alexander i do not think ANOVA applies to my query of interest. ANOVA generalizes the t-test and compares the average of groups. my query is to compare (for each variable) 1 region vs all other regions and determine if this variable (i.e. its value) differentiates it by strength and/or significance. if i had a bunch of data on region 1, region 2, ..., region N, by variable, then i could see how ANOVA could help. but in this case, i only get an aggregate value (the value is at the region level, not sub-region level). thanks though. –  Jane Wayne May 17 '12 at 19:28
How many regions and observations do you have, roughly? –  jbowman May 17 '12 at 20:10
@jbowman i have up to 100 regions (samples) and up to 5,000 variables. i say up to because that is the upper limit. however, i will be working with only subsets at a time. so at any one time, i may be working with 10 regions and 5,000 or less variables. why do you ask or does it matter? –  Jane Wayne May 17 '12 at 23:03

I had similar problem and was advised to use Decision Tree Algorithm. In your case classes would be R1, R2, etc. It has R implementation in library(rpart) - function rpart.

-
thanks but i don't think a decision tree algorithm may work. unless i have multiple samples of R1, R2, .... RN, there will not be enough training data for the splitting criterion/function. but a decision rule seems to be an output that i may want (i.e. if A < 8 then R1, if {B < 9,C > 3} then R2). –  Jane Wayne May 18 '12 at 7:48

This is not a complete answer, but whenever I am exploring my data for the first time I like to use the describe() function from the Hmisc library in the free statistical program R. The library is available for download from within R or from its website.

Sample code for exploring your data might look like this:

## Generate example data
Data <- as.data.frame(matrix(data = c(10,11,10,27,5,3,4,15,55,10,10,9,1,2,1,9,12,12,12,17,50,40,50,100,1,2,4,3,9,7,8,10), nrow = 4, ncol = 8, byrow = FALSE))


The describe() command will provide you with the number of total, unique, and missing observations of each variable along with means and frequencies. You might also consider further exploring your data with the hist(), density(), and summary() functions. Type help(function_name) at the R command line for details.