# Goodness-of-fit test to use for weighted data

Hello. I'm working on a AP stats project, but since what I'm doing is beyond the scope of what we do in class (i.e. learn how to use a calculator), I think it's safe to say this isn't a homework question.

What I'm trying to accomplish is extract some statistics (e.g. word frequencies, sentence lengths) from texts by various authors (with the help of Project Gutenberg), and then attempt to match "mystery" texts to those authors based on the similarity of those statistics. From what I understand, I'm looking for a goodness-of-fit test.

For word frequency tables, I think a chi-square GOF test is the way to go, since I am comparing an observed frequency distribution to a known one. However, I would like to combine this data (specifically the p-value?) with other statistics, such as average sentence length or dialogue-narration ratio, to get more accurate comparison. Ideally, I would like to be able to weight each statistic as well, since some (e.g. word frequencies) should count more than others (e.g. punctuation frequencies). What sort of test should I use for this scenario? I'm not sure if it's legal to weight the observations in a chi-square test, or if doing so would actually work. Also, the p-values would not be integers.

Sidenote: When I asked my teacher whether I could simply multiply each category by a constant to weight them, he kinda just shrugged at me

If you are willing to assume that the vocabulary is independent of the text structure, then you can add up the $\chi^2$ you are getting from the word distribution to the $\chi^2$ from sentence length distribution to the $\chi^2$ from dialogue-narration ratio. Be mindful of unique words -- Pearson test assumes that cell sizes are sufficiently large.