# R Dataset / Package Ecdat / UStaxWords

Webform
Help

## Description

Describes how to create a bar plot based on count data. For an example of count data, see the email50 curated data set which was taken from the Open Intro AHSS textbook (not affiliated). An example of count data in this dataset would be the spam column.

## Usage

Select one (1) column to create its barplot and then click 'Submit'. If you do not choose count data, you may get unexpected results.

Students may also be interested in creating barplots for contingency tables.

For a stacked side-by-side barplot, see the other barplot app.

Category

Webform
Help

## Usage

Select 1 (one) column from a contingency table like the Gender and Politics or VADeaths curated datasets.

If you do not choose a contingency table, you may get unexpected results. You can import a dataset if you are logged-in.

## Details

Shows the student how to create a single stacked bar plot based on a column in a contingency table.

For a basic barplot (single column) based on count data see the count data barplot app.

For a stacked side-by-side barplot see the other stacked barplot app for categorical data.

Category

Webform
Help

## Usage

Select 1 (one) column from a contingency table. If you don't have your own dataset, you can choose the Gender and Politics or VADeaths curated datasets. If a contingency table is not chosen, you may get unexpected results.

A contingency table has columns like a regular dataset, but the first row contains row names that categorize and "split-up" the dataset. An example of a contingency table would be something like this:

LIBERAL CONSERVATIVE
F 762 468
M 484 477


This contingency table is take from the Gender and Politics dataset. You can get a preview by selecting the dataset from the Curated Data dropdown above.

## Details

This app shows the student how to create a pie chart from a contingency table by hand using a Quadstat dataset.

A pie chart shows proportions of a sample or population. Each piece of a pie chart corresponds to some subset of the sample or population. In this case, we will use the contingency table rows to subset the sample.

Students may also want to view the app for creating a pie chart from count data.

Category

Webform
Help

## Usage

Click "Submit" after selecting one column to see how to compute the arithmetic mean (average) of data (vectors).

## Description

If all the values of a sample were plotted on a number line, the average would be the point in the middle that would balance the two sides.

The average is greatly influenced by outliers, meaning extreme points can pull the average to the left or right.

If we are referring to the average of population (all observations), the symbol for the average (arithmetic mean) is $\mu$.

If we are referring to the average of a sample (a subset of the population), the symbol for the average (arithmetic mean) is $\bar{x}$.

## Computing the average

Suppose we have a sample consisting of $x_1, x_2, x_3,...,x_n$. This means we have $n$ observations. Then,

$$\bar{x}=\frac{x_1, x_2, x_3,...,x_n}{n}.$$

The formula tells us that we need to add all the observations and then divide by the number of observations to compute the mean.

## Example 1

Compute the mean of $A = \{1,2,3\}$.

$$\bar{x} = \frac{1+2+3}{3} = 2.$$
Category

Webform
Help

## Usage

Select two columns which are to be used in the scatterplot. The first column clicked will be the independent variable (X-axis).

## Description

This web application describes how to create a scatterplot of two dataset variables plotted on the xy-axes.

Category

Webform
Help

## Median Value

### Description

Compute the sample median.

### Usage

median(x, na.rm = FALSE, ...)


### Arguments

 x an object for which a method has been defined, or a numeric vector containing the values whose median is to be computed. na.rm a logical value indicating whether NA values should be stripped before the computation proceeds. ... potentially further arguments for methods; not used in the default method.

### Value

The default method returns a length-one object of the same type as x, except when x is logical or integer of even length, when the result will be double.

If there are no values or if na.rm = FALSE and there are NA values the result is NA of the same type as x (or more generally the result of x[FALSE][NA]).

### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Category

Attachment Size
503 bytes
Documentation

## Number of Words in US Tax Law

### Description

Thousands of words in US tax law for 1995 to 2015 in 10 year intervals. This includes income taxes and all taxes in the code itself (written by congress) and regulations (written by government administrators). For 2015 only "EntireTaxCodeAndRegs" is given; for other years, this number is broken down by income tax vs. other taxes and code vs. regulations.

### Usage

data(UStaxWords)

### Format

A data.frame containing:

year

tax year

IncomeTaxCode

number of words in thousands in the US income tax code

otherTaxCode

number of words in thousands in US tax code other than income tax

EntireTaxCode

number of words in thousands in the US tax code

IncomeTaxRegulations

number of words in thousands in US income tax regulations

otherTaxRegulations

number of words in thousands in US tax regulations other than income tax

IncomeTaxCodeAndRegs

number of words in thousands in both the code and regulations for the US income tax

otherTaxCodeAndRegs

number of wrds in thousands in both code and regulations for US taxes apart from income taxes.

EntireTaxCodeAndRegs

number of words in thousands in US tax code and regulations

### Details

Thousands of words in the US tax code and federal tax regulations, 1955-2015. This is based on data from the Tax Foundation (taxfoundation.org), adjusted to eliminate an obvious questionable observation in otherTaxRegulations for 1965. The numbers of words in otherTaxRegulations was not reported directly by the Tax Foundation but is easily computed as the difference between their Income and Entire tax numbers. This series shows the numbers falling by 48 percent between 1965 and 1975 and by 1.5 percent between 1995 and 2005. These are the only declines seen in these numbers and seem inconsistent with the common concern (expressed e.g., in Moody, Warcholik and Hodge, 2005) about the difficulties of simplifying any governmental program, because vested interest appear to defend almost anything. Lessig (2011) notes that virtually all provisions of US law that favor certain segments of society are set to expire after a modest number of years. These sunset provisions provide recurring opportunities for incumbent politicians to extort campaign contributions from those same segments to ensure the continuation of the favorable treatment.

The decline of 48 percent in otherTaxRegulations seems more curious for two additional reasons: First, it was preceded by a tripling of otherTaxRegulations between 1955 and 1965. Second, it was NOT accompanied by any comparable behavior of otherTaxCode. Instead, the latter grew each decade by between 17 and 53 percent, similar to but slower than the growth in IncomeTaxCode and IncomeTaxRegulations.

Accordingly, otherTaxRegulations for 1965 is replaced by the average of the numbers for 1955 and 1975, and EntireTaxRegulations for 1965 is comparably adjusted. This replaces (1322, 2960) for those two variables for 1965 with (565, 2203). In addition, otherTaxCodeAndRegs and EntireTaxCodeAndRegulations are also changed from (1626, 3507) to (870, 2751).

Independent of whether this adjustment is correct or not, it's clear that there have been roughly 3 words of regulations for each word in the tax code. Most of these are income tax regulations, which have recently contained 4.5 words for every word in code. The income tax code currently includes roughly 50 percent more words than other tax code.

Spencer Graves

### References

J. Scott Moody, Wendy P. Warcholik, and Scott A. Hodge (2005) "The Rising Cost of Complying with the Federal Income Tax", The Tax Foundation Special Report No. 138.

### Examples

data(UStaxWords)
plot(EntireTaxCodeAndRegs/1000 ~ year, UStaxWords,
type='b',
ylab='Millions of words in US tax code & regs')# Write to a file for Wikimedia Commons
## Not run:
svg('UStaxWords.svg')## End(Not run)
matplot(UStaxWords$year, UStaxWords[c(2:3, 5:6)]/1000, type='b', bty='n', ylab='', ylim=c(0, max(UStaxWords$EntireTaxCodeAndRegs)/1000),
las=1, xlab="", cex.axis=2)
lines(EntireTaxCodeAndRegs/1000~year, UStaxWords, lwd=2)
## Not run:
dev.off()## End(Not run)
# lines 1:4 = IncomeTaxCode, otherTaxCode,
#   IncomeTaxRegulations,
#   and otherTaxRegulations, respectively##
## Plotting the original numbers without the adjustment
##
UStax. <- UStaxWords
UStax.[2,c(6:7, 9:10)] <- c(1322, 2960, 1626, 3507)
matplot(UStax.$year, UStax.[c(2:3, 5:6)]/1000, type='b', bty='n', ylab='', ylim=c(0, max(UStax.$EntireTaxCodeAndRegs)/1000),
las=1, xlab="", cex.axis=2)
lines(EntireTaxCodeAndRegs/1000~year, UStax., lwd=2)
# Note especially the anomalous behaviour of line 4 =
# otherTaxRegulations.  As noted with "details" above,
# otherTaxRegulations could have tripled between 1955
# and 1965, then fallen by 48 percent between 1965 and
# 1975.  However, that does not seem credible,
# especially since there was no corresponding behavior
# in otherTaxCode.##
## linear trend
##
(newWdsPerYr <- lm(EntireTaxCodeAndRegs~year,
UStaxWords))
plot(UStaxWords\$year, resid(newWdsPerYr))
# since 1955.
# No indication of nonlinearity.  
--

Dataset imported from https://www.r-project.org.