Example: tourism industry

The FREQ Procedure - Worcester Polytechnic Institute

Chapter 28 The freq ProcedureChapter Table of ..1259 OUTPUTS tatement .. Frequency with Formats ..1278 MissingValues ..1279 StatisticalComputations ..1281 DefinitionsandNotation ..1281 Chi-SquareTestsandStatistics ..1282 Measures of Proportion ..1298 RisksandRiskDifferences ..1299 Odds Ratio and Relative Risks for 2 2 Tables ..1304 Tests and Measures of ..1324 DisplayedOutput ..1327 ODST ableNames ..13321246 Chapter 28. The freq Creating an Output Data Set with Table Cell Frequencies .. 1335 Example Computing Chi-square Tests for One-Way Frequency Tables . 1337 Example Computing Binomial Proportions for One-Way Frequency Ta-bles ..1339 Example Analyzing a 2x2 ContingencyTable ..1342 Example Creating an Output Data Set Containing Chi-Square Statistics . 1345 Example Computing Cochran-Mantel-Haenszel Statistics for a .. sChi-SquareStatistic ..1352 Example Testing Marginal Homogeneity with Cochran OnlineDoc : Version 8 Chapter 28 The freq ProcedureOverviewThe freq Procedure produces one-way ton-way frequency and crosstabulation(contingency) tables.

1248 Chapter 28. The FREQ Procedure dependent or independent), the measurement scale of the variables (nominal, ordinal, or interval), the type of association that each measure is designed to detect, and any

Tags:

  Procedures, Freq, The freq procedure

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of The FREQ Procedure - Worcester Polytechnic Institute

1 Chapter 28 The freq ProcedureChapter Table of ..1259 OUTPUTS tatement .. Frequency with Formats ..1278 MissingValues ..1279 StatisticalComputations ..1281 DefinitionsandNotation ..1281 Chi-SquareTestsandStatistics ..1282 Measures of Proportion ..1298 RisksandRiskDifferences ..1299 Odds Ratio and Relative Risks for 2 2 Tables ..1304 Tests and Measures of ..1324 DisplayedOutput ..1327 ODST ableNames ..13321246 Chapter 28. The freq Creating an Output Data Set with Table Cell Frequencies .. 1335 Example Computing Chi-square Tests for One-Way Frequency Tables . 1337 Example Computing Binomial Proportions for One-Way Frequency Ta-bles ..1339 Example Analyzing a 2x2 ContingencyTable ..1342 Example Creating an Output Data Set Containing Chi-Square Statistics . 1345 Example Computing Cochran-Mantel-Haenszel Statistics for a .. sChi-SquareStatistic ..1352 Example Testing Marginal Homogeneity with Cochran OnlineDoc : Version 8 Chapter 28 The freq ProcedureOverviewThe freq Procedure produces one-way ton-way frequency and crosstabulation(contingency) tables.

2 For two-way tables, PROC freq computes tests and measuresof association. Forn-way tables, PROC freq does stratified analysis, computingstatistics within, as well as across, strata. Frequencies and statistics can also be out-put to SAS data one-way frequency tables, PROC freq can compute statistics to test for equalproportions, specified proportions, or the binomial proportion. For contingency ta-bles, PROC freq can compute various statistics to examine the relationships be-tween two classification variables adjusting for any stratification variables. PROCFREQ automatically displays the output in a report and can also save the output in aSAS data some pairs of variables, you may want to examine the existence or the strengthof any association between the variables. To determine if an association exists, chi-square tests are computed. To estimate the strength of an association, PROC freq computes measures of association that tend to be close to zero when there is no asso-ciation and close to the maximum (or minimum) value when there is perfect associa-tion.

3 The statistics for contingency tables include chi-square tests and measures measures of association risks (binomial proportions) and risk differences for2 2tables odds ratios and relative risks for2 2tables tests for trend tests and measures of agreement Cochran-Mantel-Haenszel statisticsPROC freq computes asymptotic standard errors, confidence intervals, and tests formeasures of association and measures of agreement. Exactp-values and confidenceintervals are available for various test statistics and measures. PROC freq alsoperforms stratified analyses that compute statistics within, as well as across, strata forn-way tables. The statistics include Cochran-Mantel-Haenszel statistics and measuresof choosing measures of association to use in analyzing a two-way table, you shouldconsider the study design (which indicates whether the row and column variables are1248 Chapter 28. The freq Proceduredependent or independent), the measurement scale of the variables (nominal, ordinal,or interval), the type of association that each measure is designed to detect, and anyassumptions required for valid interpretation of a measure.

4 You should exercise carein selecting measures that are appropriate for your comments apply to the choice and interpretation of the test statistics. Forexample, the Mantel-Haenszel chi-square statistic requires an ordinal scale for bothvariables and is designed to detect a linear association. The Pearson chi-square, onthe other hand, is appropriate for all variables and can detect any kind of association,but it is less powerful for detecting a linear association because its power is dispersedover a greater number of degrees of freedom (except for2 2tables).Several SAS procedures produce frequency counts; only PROC freq computes chi-square tests for one-way ton-way tables and measures of association and agreementfor contingency tables. Other procedures to consider for counting are TABULATE,CHART, and UNIVARIATE. When you want to fit models to categorical data, use aprocedure such as CATMOD, GENMOD, LOGISTIC, PHREG, or more information on selecting the appropriate statistical analyses, refer to Agresti(1996) or Stokes, Davis, and Koch (1995).

5 Getting StartedFrequency Tables and StatisticsThe freq Procedure provides easy access to statistics for testing for association in acrosstabulation this example, high school students applied for courses in a summer enrichmentprogram: these courses included journalism, art history, statistics, graphic arts, andcomputer programming. The students accepted were randomly assigned to classeswith and without internships in local companies. The following table contains countsof the students who enrolled in the summer program by gender and whether they wereassigned an internship Enrichment DataEnrollmentGenderInternshipYe sN oTo t a lboysyes352964boysno142741girlsyes321032 girlsno532376 The SAS data setSummerSchoolis created by inputting the summer enrichmentdata as cell count data, or providing the frequency count for each combinationof variable values. The following DATA step statements create the SAS data OnlineDoc : Version 8 Frequency Tables and Statistics 1249data SummerSchool;input Gender $ Internship $ Enrollment $ Count @@;datalines;boys yes yes 35 boys yes no 29boys no yes 14 boys no no 27girls yes yes 32 girls yes no 10girls no yes 53 girls no no 23;The variableGendertakes the values boys or girls , the variableInternshiptakesthe values yes and no , and the variableEnrollmenttakes the values yes and no.

6 The variableCountcontains the number of students corresponding to eachcombination of data values. The double at sign (@@) indicates that more than oneobservation is included on a single data line. In this DATA step, two observations areincluded on each are interested in whether there is an association between internship statusand summer program enrollment. The Pearson chi-square statistic is an appropriatestatistic to assess the association in the corresponding2 2table. The followingPROC freq statements specify this specify the table for which you want to compute statistics with the TABLES statement. You specify the statistics you want to compute with options after a slash(/) in the TABLES freq data=SummerSchool order=data;weight count;tables Internship*Enrollment / chisq;run;The ORDER= option controls the order in which variable values are displayed in therows and columns of the table. By default, the values are arranged according to thealphanumeric order of their unformatted values.

7 If you specify ORDER=DATA, thedata are displayed in the same order as they occur in the input data set. Here, since yes appears before no in the data, yes appears first in any table. Other options forcontrolling order include ORDER=FORMATTED, which orders according to the for-matted values, and ORDER=FREQUENCY, which orders by descending the TABLES statement,Internship*Enrollmentspecifies a table where the rowsare internship status and the columns are program enrollment. Since the input dataare in cell count form, the WEIGHT statement is required. The WEIGHT statementnames the variableCount, which provides the frequency of each combination ofdata values. Finally, the CHISQ option requests chi-square statistics for presents the crosstabulation ofInternshipandEnrollment. In each cell,the values printed under the cell count are the table percentage, row percentage, andcolumn percentage, respectively. For example, in the first cell, percent of thoseoffered courses with internships accepted them and percent did OnlineDoc : Version 81250 Chapter 28.

8 The freq ProcedureThe SAS SystemThe freq ProcedureTable of Internship by EnrollmentInternshipEnrollmentFrequency| Percent |Row Pct |Col Pct |yes |no | Total---------+--------+--------+yes | 67 | 39 | 106| | | | | || | |---------+--------+--------+no | 67 | 50 | 117| | | | | || | |---------+--------+--------+Total 134 89 TableThe next tables display the statistics produced by the CHISQ option. The Pearsonchi-square statistic is labeled Chi-Square and has a value of with 1 degreeof freedom. The associatedp-value is , which means that there is no signif-icant evidence of an association between internship status and program other chi-square statistics have similar values and are asymptotically other statistics (Phi Coefficient, Contingency Coefficient, and Cramer sV)aremeasures of association derived from the Pearson chi-square. For Fisher s exact test,the two-sidedp-value is , which also shows no association between internshipstatus and program OnlineDoc : Version 8 Frequency Tables and Statistics 1251 The freq ProcedureStatistics for Table of Internship by EnrollmentStatistic DF Value Prob------------------------------------ ------------------Chi-Square 1 Ratio Chi-Square 1 Adj.

9 Chi-Square 1 Chi-Square 1 Coefficient Coefficient s V s Exact Test----------------------------------Ce ll (1,1) Frequency (F) 67 Left-sided Pr <= F Pr >= F Probability (P) Pr <= P Size = 223 Figure Produced with the CHISQ OptionThe analysis, so far, has ignored gender. However, it may be of interest to ask whetherprogram enrollment is associated with internship status after adjusting for can address this question by doing an analysis of a set of tables, in this case, byanalyzing the set consisting of one for boys and one for girls. The Cochran-Mantel-Haenszel statistic is appropriate for this situation: it addresses whether rows andcolumns are associated after controlling for the stratification variable. In this case,you would be stratifying by freq statements for this analysis are very similar to those for the first analysis,except that there is a third variable,Gender, in the TABLES statement.

10 When youcross more than two variables, the two rightmost variables construct the rows andcolumns of the table, respectively, and the leftmost variables determine the freq data=SummerSchool;weight count;tables Gender*Internship*Enrollment / chisq cmh;run;This execution of PROC freq first produces two individual crosstabulation tablesofInternship*Enrollment, one for boys and one for girls. Chi-square statistics areproduced for each individual table. Note that the chi-square statistic for boys is sig-nificant at the =0:05level of significance. Boys offered a course with an internshipare more likely to enroll than boys who are OnlineDoc : Version 81252 Chapter 28. The freq ProcedureThe freq ProcedureTable 1 of Internship by EnrollmentControlling for Gender=boysInternshipEnrollmentFrequency |Percent |Row Pct |Col Pct |no |yes | Total---------+--------+--------+no | 27 | 14 | 41| | | | | || | |---------+--------+--------+yes | 29 | 35 | 64| | | | | || | |---------+--------+--------+Total 56 49 for Table 1 of Internship by EnrollmentControlling for Gender=boysStatistic DF Value Prob------------------------------------ ------------------Chi-Square 1 Ratio Chi-Square 1 Adj.


Related search queries