Dear statalister,
in my current project i would like to compare a sample attribute with the population's attribute in order to verify if the sample is representative for the population. For example, my sample includes the age of firms which I´ve also collected through a survey. I sent the survey to all firms in a databse (n=100) and received answers from about 50 (just as example). Now, I want to compare the age distribution of sample to the age distribution of the population database. My stata datatable looks like the following:
If i want to see the age distribution of the sample, i would for example use the following command (in order to omitt empty cells): tabulate AGE_Survey if Survey==1
How would I be able to compare the age distribution of AGE_Survey (Survey=1) with the age distribution of AGE_DB using Chi2 or similar tests? I want that stata omitts the empty cells of the column AGE_Survey when comparing.
I tried somehting like that: tab AGE_Survey if Survey==1 AGE_DB, chi2 but was not successful.
Maybe some has a recommendation?
Regards,
Alex
in my current project i would like to compare a sample attribute with the population's attribute in order to verify if the sample is representative for the population. For example, my sample includes the age of firms which I´ve also collected through a survey. I sent the survey to all firms in a databse (n=100) and received answers from about 50 (just as example). Now, I want to compare the age distribution of sample to the age distribution of the population database. My stata datatable looks like the following:
Survey | AGE_Survey (of Survey respondents (n=50)) | AGE_DB (in Database (n=100)) | |
Firm 1 | 1 | 5 | 5 |
Firm 2 | 1 | 2 | 2 |
Firm 3 | 0 | 3 | |
Firm 4 | 0 | 2 |
How would I be able to compare the age distribution of AGE_Survey (Survey=1) with the age distribution of AGE_DB using Chi2 or similar tests? I want that stata omitts the empty cells of the column AGE_Survey when comparing.
I tried somehting like that: tab AGE_Survey if Survey==1 AGE_DB, chi2 but was not successful.
Maybe some has a recommendation?
Regards,
Alex
Comment