# What statistical calculation to use and which R function?

#### jonmrich

##### New Member
Here's the data I have...

I have a "national" sample (the control) showing the actual number and percentage of people in the sample that have a specific characteristic. Let's say there's data on 10,000 people that are all classified as either loving cats or hating cats (Yes or No).

I then have a "local" sample that I need to compare to the "national" sample. Let's say there are 1,000 people in the local sample that are also all classified as either loving cats or hating cats.

So, I might calculate that 50% of the national sample like cats and 45% of the local sample. What test could I run on this (and how would I need the data initially) in order to determine if the difference between the groups is significant?

It sounds like a contingency table, but I'm not sure and want to make sure I'm doing the right calculation.

Then...given the correct statistical method, is there a script in R that you can recommend that will help me actually do the calculations?

Thanks,
JMR

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Some may use chi-square (comparing two proportions), others may balk at this if there may be dependence between the two datasets.