R Dataset / Package pscl / RockTheVote

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

Visual Summaries

Attachment Size
2.71 KB
GNU General Public License v2.0
Documentation

Voter turnout experiment, using Rock The Vote ads

Description

Voter turnout data spanning 85 cable TV systems, randomly allocated to a voter mobilization experiment targetting 18-19 year olds with "Rock the Vote" television advertisments

Usage

data(RockTheVote)

Format

A data frame with 85 observations on the following 6 variables.

strata

numeric, experimental strata

treated

numeric, 1 if a treated cable system, 0 otherwise

r

numeric, number of 18 and 19 year olds turning out

n

numeric, number of 19 and 19 year olds registered

p

numeric, proportion of 18 and 19 year olds turning out

treatedIndex

numeric, a counter indexing the 42 treated units

Details

Green and Vavreck (2008) implemented a cluster-randomized experimental design in assessing the effects of a voter mobilization treatment in the 2004 U.S. Presidential election. The clusters in this design are geographic areas served by a single cable television system. So as to facilitate analysis, the researchers restricted their attention to small cable systems whose reach is limited to a single zip code. Further, since the experiment was fielded during the last week of the presidential election, the researchers restricted their search to cable systems that were not in the 16 hotly-contested “battleground” states (as designated by the Los Angeles Times).

Eighty-five cable systems were available for randomization and were assigned to treatment after stratification on previous turnout levels in presidential elections (as determined from analysis of the corresponding states' voter registration files). Each cable system was matched with one or sometimes two other cable systems in the same state, yielding 40 strata. Then within each strata, cable systems were randomly assigned to treatment and control conditions. Strata 3, 8 and 25 have two control cable systems and 1 treated system each, while strata 6 and 20 have two treated cable systems and one control system. The remaining 35 strata have 1 treated cable system and 1 control system. In this way there are 38 + 4 = 42 treated systems, spanning 40 experiment strata.

The treatment involved researchers purchasing prime-time advertising spots on four channels in the respective cable system in which the researchers aired voter mobilization ads. The ads were produced by Rock the Vote, targeted at younger voters, and aired four times per night, per channel, over the last eight days of the election campaign. After the election, public records were consulted to assemble data on turnout levels in the treated and control cable systems. In the analysis reported in Green and Vavreck (2008), the researchers focused on turnout among registered voters aged 18 and 19 years old.

References

Green, Donald P. and Lynn Vavreck. 2008. Analysis of Cluster-Randomized Experiments: A Comparison of Alternative Estimation Approaches. Political Analysis 16:138-152.

Jackman, Simon, 2009. Bayesian Analysis for the Social Sciences. Wiley: Hoboken, New Jersey. Example 7.9.

Examples

data(RockTheVote)
## estimate MLEs of treatment effects
deltaFunction <- function(data){
model <- glm(cbind(r,n-r)~treated,
data=data,
family=binomial)
c(coef(model)[2],
confint(model)[2,])
}
tmp <- by(RockTheVote,
as.factor(RockTheVote$strata), deltaFunction)tmp <- matrix(unlist(tmp),ncol=3,byrow=TRUE)indx <- order(tmp[,1])plot(y=1:40, x=tmp[indx,1], pch=16,cex=1.25, xlim=range(tmp), ylab="", axes=FALSE, xlab="Estimated Treatment Effect (MLEs, Logit Scale)") text(y=1:40, x=par()$usr[1],
pos=4,
as.character((1:40)[indx]),
cex=.5)
segments(x0=tmp[indx,2],
x1=tmp[indx,3],
y0=1:40,
y1=1:40)
axis(1)
axis(3)
abline(v=0)

--

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