﻿ VisualStat® Examples - Frequencies

Software to Simplify Statistical Practice ...

## Frequencies Tables - Example

#### Data

Subjects were students in grades 4-6 from three school districts in Ingham and Clinton Counties, Michigan. Chase and Dummer stratified their sample, selecting students from urban, suburban, and rural school districts with approximately 1/3 of their sample coming from each district. Students indicated whether good grades, athletic ability, or popularity was most important to them. They also ranked four factors: grades, sports, looks, and money, in order of their importance for popularity. The questionnaire also asked for gender, grade level, and other demographic information.

#### Analysis

1. Open the DataBook summary.vstz
open this data file via the Help / Open Examples menu; it is in the Sample Data
2. Select the sheet PopularKids
3. Choose the menu Analyze and the command FREQ Tables, under group Data Summaries
4. In Variables, select Gender, Race, Urban/Rural, and School
5. Click OK

#### Output

By default, R code is printed after parsing and before evaluation.

DataSheet is converted to DataFrame, in the form DataBook.DataSheet

```> .Table <- table(summary.PopularKids\$Gender, useNA = "ifany")
> .Table  # counts for Gender

boy girl
227  251

> round(100*.Table/sum(.Table), 2)  # percentages for Gender

boy  girl
47.49 52.51

> .Table <- table(summary.PopularKids\$Race, useNA = "ifany")
> .Table  # counts for Race

Other White
36   442

> round(100*.Table/sum(.Table), 2)  # percentages for Race

Other White
7.53 92.47

> .Table <- table(summary.PopularKids\$Urban.Rural, useNA = "ifany")
> .Table  # counts for Urban.Rural

Rural Suburban    Urban
149      151      178

> round(100*.Table/sum(.Table), 2)  # percentages for Urban.Rural

Rural Suburban    Urban
31.17    31.59    37.24

> .Table <- table(summary.PopularKids\$School, useNA = "ifany")
> .Table  # counts for School

Brentwood Elementary     Brentwood Middle         Brown Middle
67                   84                   52
Elm                 Main              Portage
21                   68                   61
Ridge                 Sand      Westdale Middle
48                   28                   49

> round(100*.Table/sum(.Table), 2)  # percentages for School

Brentwood Elementary     Brentwood Middle         Brown Middle
14.02                17.57                10.88
Elm                 Main              Portage
4.39                14.23                12.76
Ridge                 Sand      Westdale Middle
10.04                 5.86                10.25

> remove(.Table)```

#### Results

From the output, you might learn that 37.2% of students are urban, 31.6% are suburban, and 31.2% are rural.