How to compare two samples of frequencies with categorical x values where one is subset of the other I am trying to compare two arrays of frequencies. The second is a subset of the first. I want to know if the second is a representative of the first. The arrays are:
x    All  Subset
a    136   38
5    127   27
b    103   23
1    102   17
6     71   11
2     27    4

I want a test that, where B behaves like A (i.e. can be viewed as A scaled), the test returns a p-value close to 1 (Null hypothesis is that for each point on x axis, percentage frequencies of B are the same of percentage frequencies of A).
I tried to use Chi-squared test but, since I could have missing values, I don't know if the test validity can be compromised.. Data is missing not for technical failures but because in one subset is likely to have only few features (x values) with non-zero frequencies. 
Moreover since the size of the second column (the subset) is not fixed, I don't know how to scale the first column in order to obtain a valid p-value (now magnitude order is 10e-80).
Thanks
 A: 
I am trying to compare two arrays of frequencies. The second is a subset of the first. 

This makes them dependent. Normally the right thing to do is compare two distinct sets:
x     Subset   Not-in-Subset
a       38        98
5       27       100
b       23        80
1       17        85
6       11        60
2        4        23

If they behave alike, then the subset behaves like the whole. This is fairly simple logic. Call the "not in subset" values "C". If B has the same distribution as C (the null in the test) and B obviously has the same distribution as itself(!), then B has the same distribution as B+C (i.e. A) -- if you require it, I could show it mathematically, but it's rather trivial.
Consider the subset. If the underlying proportions in each category of the subset (the things the sample proportions estimate) were not the same as the remainder, it could not be the as the population as a whole.

I tried to use Chi-squared test but, since I could have missing values, I don't know if the test validity can be compromised.

Can you say more about what is missing and how it arises?
Missingness may be a problem (or may not be a problem) for almost any procedure, depending on its nature.
However, note that categories with ordinary zero counts aren't 'missing values' in the required sense; our data here are counts, if they're just 0's, they aren't missing, you have an observed count of 0.

Moreover since the size of the second column (the subset) is not fixed, I don't know how to scale the first column in order to obtain a valid p-value (now magnitude order is 10e-80).

A chi-square can deal with this in the usual fashion.
A: Fisher's exact test is useful for cases where you WOULD have used a chi-square test but don't know if you will always meet the cell count conditions (automated testing of survey data for example). It should be noted that Fisher's exact test can be a bit more timid about proclaiming significance (it's more conservative than chi-square). 
It's part of the stats package in R... see ?fisher.test
A: Take the Spearman's Rank Correlation for the two columns. Perform the test of significance either using the Permutation test or the Fisher transform as has been defined in the wiki page. this will establish any monotone dependency between the two sets of numbers and is a non-parametric method so no assumptions required about the data.
