freq |

Compute frequency tables for columns of a matrix.

The freq command performs a one-way or N-way frequency tabulation.

• When used with a matrix containing a single column, freq performs a one-way frequency tabulation.

• When used with a matrix containing multiple columns, freq produces an N-way frequency tabulation for all of the columns in the matrix.

Frequencies are computed for all of the rows of the matrix. Rows with NAs are dropped unless included by option. You may use options to control automatic binning (grouping) of values and the order of the entries of the table.

Syntax

matrix_name.freq(options)

Options

Options common to both one-way and N-way frequency tables

dropna (default) / keepna | [Drop/Keep] NA as a category. |

v=integer (default=1000) | Make bins if the number of distinct values or categories exceeds the specified number. |

nov | Do not make bins on the basis of number of distinct values; ignored if you set “v=integer.” |

a=number | (optional) Make bins if average count per distinct value is less than the specified number. |

b=integer (default=50) | Maximum number of categories to bin into if performing automatic binning. |

n, obs, count (default) | Display frequency counts. |

nocount | Do not display frequency counts. |

nolimit | Remove prompt warning for continuing when the total number of cells is very large. |

sort=arg (default=“lohi”) | Sort order for entries in the frequency table: high data value to low ("hilo"), low data value to high ("lohi" –default), high frequency to low ("freqhilo"), low frequency to high ("freqlohi"). |

prompt | Force the dialog to appear from within a program. |

p | Print the table. |

Options for one-way tables

total (default) / nototal | [Display / Do not display] totals. |

pct (default) / nopct | [Display / Do not display] percent frequencies. |

cum (default) / nocum | (Display/Do not) display cumulative frequency counts/percentages. |

Options for N-way tables

table (default) | Display in table mode. |

list | Display in list mode. |

rowm (default) / norowm | [Display / Do not display] row marginals. |

colm (default) / nocolm | [Display / Do not display] column marginals. |

tabm (default) / notabm | [Display / Do not display] table marginals—only for more than two series. |

subm (default) / nosubm | [Display / Do not display] sub marginals—only for “l” option with more than two series. |

full (default) / sparse | (Full/Sparse) tabulation in list display. |

totpct / nototpct (default) | [Display / Do not display] percentages of total observations. |

tabpct / notabpct (default) | [Display / Do not display] percentages of table observations—only for more than two series. |

rowpct / norowpct (default) | [Display / Do not display] percentages of row total. |

colpct / nocolpct (default) | [Display / Do not display] percentages of column total. |

exp / noexp (default) | [Display / Do not display] expected counts under full independence. |

tabexp / notabexp (default) | [Display / Do not display] expected counts under table independence—only for more than two series. |

test (default) / notest | [Display / Do not display] tests of independence. |

Examples

matrix x(50, 4)

rndint(x, 10)

x.freq(nov, noa)

tabulates each value (no binning) of HRS in ascending order with counts, percentages, and cumulatives.

x.freq(v=200, b=100, keepna, noa)

tabulates X including NAs. The values will be binned if INC has more than 200 distinct values; EViews will create at most 100 equal value-width bins. The number of bins may be less than 100.

x.freq(v=10, norowm, nocolm)

displays tables of binned pairs of the first two columns of X for each bin/value of the remaining columns. The table will not contain row and column marginals.

x.freq(v=10, norowm, nocolm, sort=freqhilo)

displays the same table with the table rows and columns ordered from values with highest frequency to lowest.

Cross-references

See
“One-Way Tabulation” and
“N-Way Tabulation” for a discussion of frequency tables.