# R Dataset / Package HistData / Guerry

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
9.14 KB
Documentation

## Data from A.-M. Guerry, "Essay on the Moral Statistics of France"

### Description

Andre-Michel Guerry (1833) was the first to systematically collect and analyze social data on such things as crime, literacy and suicide with the view to determining social laws and the relations among these variables.

The Guerry data frame comprises a collection of 'moral variables' on the 86 departments of France around 1830. A few additional variables have been added from other sources.

### Usage

data(Guerry)

### Format

A data frame with 86 observations (the departments of France) on the following 23 variables.

dept

Department ID: Standard numbers for the departments, except for Corsica (200)

Region

Region of France ('N'='North', 'S'='South', 'E'='East', 'W'='West', 'C'='Central'). Corsica is coded as NA

Department

Department name: Departments are named according to usage in 1830, but without accents. A factor with levels Ain Aisne Allier ... Vosges Yonne

Crime_pers

Population per Crime against persons. Source: A2 (Compte général, 1825-1830)

Crime_prop

Population per Crime against property. Source: A2 (Compte général, 1825-1830)

Literacy

Percent Read & Write: Percent of military conscripts who can read and write. Source: A2

Donations

Donations to the poor. Source: A2 (Bulletin des lois)

Infants

Population per illegitimate birth. Source: A2 (Bureaau des Longitudes, 1817-1821)

Suicides

Population per suicide. Source: A2 (Compte général, 1827-1830)

MainCity

Size of principal city ('1:Sm', '2:Med', '3:Lg'), used as a surrogate for poulation density. Large refers to the top 10, small to the bottom 10; all the rest are classed Medium. Source: A1. An ordered factor with levels 1:Sm < 2:Med < 3:Lg

Wealth

Per capita tax on personal property. A ranked index based on taxes on personal and movable property per inhabitant. Source: A1

Commerce

Commerce and Industry, measured by the rank of the number of patents / population. Source: A1

Clergy

Distribution of clergy, measured by the rank of the number of Catholic priests in active service / population. Source: A1 (Almanach officiel du clergy, 1829)

Crime_parents

Crimes against parents, measured by the rank of the ratio of crimes against parents to all crimes– Average for the years 1825-1830. Source: A1 (Compte général)

Infanticide

Infanticides per capita. A ranked ratio of number of infanticides to population– Average for the years 1825-1830. Source: A1 (Compte général)

Donation_clergy

Donations to the clergy. A ranked ratio of the number of bequests and donations inter vivios to population– Average for the years 1815-1824. Source: A1 (Bull. des lois, ordunn. d'autorisation)

Lottery

Per capita wager on Royal Lottery. Ranked ratio of the proceeds bet on the royal lottery to population— Average for the years 1822-1826. Source: A1 (Compte rendus par le ministre des finances)

Desertion

Military disertion, ratio of the number of young soldiers accused of desertion to the force of the military contingent, minus the deficit produced by the insufficiency of available billets– Average of the years 1825-1827. Source: A1 (Compte du ministere du guerre, 1829 etat V)

Instruction

Instruction. Ranks recorded from Guerry's map of Instruction. Note: this is inversely related to Literacy (as defined here)

Prostitutes

Prostitutes in Paris. Number of prostitutes registered in Paris from 1816 to 1834, classified by the department of their birth Source: Parent-Duchatelet (1836), De la prostitution en Paris

Distance

Distance to Paris (km). Distance of each department centroid to the centroid of the Seine (Paris) Source: cakculated from department centroids

Area

Area (1000 km^2). Source: Angeville (1836)

Pop1831

1831 population. Population in 1831, taken from Angeville (1836), Essai sur la Statistique de la Population français, in 1000s

### Details

Note that most of the variables (e.g., Crime_pers) are scaled so that 'more is better' morally.

Values for the quantitative variables displayed on Guerry's maps were taken from Table A2 in the English translation of Guerry (1833) by Whitt and Reinking. Values for the ranked variables were taken from Table A1, with some corrections applied. The maximum is indicated by rank 1, and the minimum by rank 86.

### Source

Angeville, A. (1836). Essai sur la Statistique de la Population française Paris: F. Doufour.

Guerry, A.-M. (1833). Essai sur la statistique morale de la France Paris: Crochard. English translation: Hugh P. Whitt and Victor W. Reinking, Lewiston, N.Y. : Edwin Mellen Press, 2002.

Parent-Duchatelet, A. (1836). De la prostitution dans la ville de Paris, 3rd ed, 1857, p. 32, 36

### References

Dray, S. and Jombart, T. (2011). A Revisit Of Guerry's Data: Introducing Spatial Constraints In Multivariate Analysis. The Annals of Applied Statistics, Vol. 5, No. 4, 2278-2299. http://arxiv.org/pdf/1202.6485.pdf, DOI: 10.1214/10-AOAS356.

Brunsdon, C. and Dykes, J. (2007). Geographically weighted visualization: interactive graphics for scale-varying exploratory analysis. Geographical Information Science Research Conference (GISRUK 07), NUI Maynooth, Ireland, April, 2007.

Friendly, M. (2007). A.-M. Guerry's Moral Statistics of France: Challenges for Multivariable Spatial Analysis. Statistical Science, 22, 368-399.

Friendly, M. (2007). Data from A.-M. Guerry, Essay on the Moral Statistics of France (1833), http://datavis.ca/gallery/guerry/guerrydat.html.

The Guerry package for maps of France: gfrance and related data.

### Examples

data(Guerry)
## maybe str(Guerry) ; plot(Guerry) ...

--

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