# R Dataset / Package DAAG / bomsoi

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

## Boxplot

Submitted by pmagunia on April 22, 2018 - 3:07 PM

## Correlation Coefficient

Submitted by pmagunia on April 22, 2018 - 3:08 PM

## Cumulative Frequency Histogram

Submitted by pmagunia on April 22, 2018 - 3:09 PM

## Dotplot

Submitted by pmagunia on April 22, 2018 - 3:10 PM

## Hollow Histogram

Submitted by pmagunia on April 22, 2018 - 3:10 PM

## Mean

Submitted by pmagunia on April 22, 2018 - 3:11 PM

## Pie Chart

Submitted by pmagunia on April 22, 2018 - 3:11 PM

## Plot

Submitted by pmagunia on April 22, 2018 - 3:07 PM

## Regression

Submitted by pmagunia on April 22, 2018 - 3:12 PM

## Stem and Leaf Plots

Submitted by pmagunia on April 22, 2018 - 3:12 PM

## Summary

Submitted by pmagunia on April 22, 2018 - 2:51 PM

## Visual Summaries

Submitted by pmagunia on April 22, 2018 - 3:13 PM
Submitted by pmagunia on March 9, 2018 - 1:06 PM
Attachment Size
12.63 KB
Documentation

## Southern Oscillation Index Data

### Description

The Southern Oscillation Index (SOI) is the difference in barometric pressure at sea level between Tahiti and Darwin. Annual SOI and Australian rainfall data, for the years 1900-2001, are given. Australia's annual mean rainfall is an area-weighted average of the total annual precipitation at approximately 370 rainfall stations around the country.

### Usage

bomsoi

### Format

This data frame contains the following columns:

Year

a numeric vector

Jan

average January SOI values for each year

Feb

average February SOI values for each year

Mar

average March SOI values for each year

Apr

average April SOI values for each year

May

average May SOI values for each year

Jun

average June SOI values for each year

Jul

average July SOI values for each year

Aug

average August SOI values for each year

Sep

average September SOI values for each year

Oct

average October SOI values for each year

Nov

average November SOI values for each year

Dec

average December SOI values for each year

SOI

a numeric vector consisting of average annual SOI values

avrain

a numeric vector consisting of a weighted average annual rainfall at a large number of Australian sites

NTrain

Northern Territory rain

northRain

north rain

seRain

southeast rain

eastRain

east rain

southRain

south rain

swRain

southwest rain

### Source

Australian Bureau of Meteorology web pages:

### References

Nicholls, N., Lavery, B., Frederiksen, C.\ and Drosdowsky, W. 1996. Recent apparent changes in relationships between the El Nino – southern oscillation and Australian rainfall and temperature. Geophysical Research Letters 23: 3357-3360.

### Examples


plot(ts(bomsoi[, 15:14], start=1900),
panel=function(y,...)panel.smooth(1900:2005, y,...))
pause()# Check for skewness by comparing the normal probability plots for
# different a, e.g.
par(mfrow = c(2,3))
for (a in c(50, 100, 150, 200, 250, 300))
qqnorm(log(bomsoi[, "avrain"] - a))
# a = 250 leads to a nearly linear plotpause()par(mfrow = c(1,1))
plot(bomsoi$SOI, log(bomsoi$avrain - 250), xlab = "SOI",
ylab = "log(avrain = 250)")
lines(lowess(bomsoi$SOI)$y, lowess(log(bomsoi$avrain - 250))$y, lwd=2)
# NB: separate lowess fits against time
lines(lowess(bomsoi$SOI, log(bomsoi$avrain - 250)))
pause()xbomsoi <-
with(bomsoi, data.frame(SOI=SOI, cuberootRain=avrain^0.33))
xbomsoi$trendSOI <- lowess(xbomsoi$SOI)$y xbomsoi$trendRain <- lowess(xbomsoi$cuberootRain)$y
rainpos <- pretty(bomsoi$avrain, 5) with(xbomsoi, {plot(cuberootRain ~ SOI, xlab = "SOI", ylab = "Rainfall (cube root scale)", yaxt="n") axis(2, at = rainpos^0.33, labels=paste(rainpos)) ## Relative changes in the two trend curves lines(lowess(cuberootRain ~ SOI)) lines(lowess(trendRain ~ trendSOI), lwd=2) }) pause()xbomsoi$detrendRain <-
with(xbomsoi, cuberootRain - trendRain + mean(trendRain))
xbomsoi\$detrendSOI <-
with(xbomsoi, SOI - trendSOI + mean(trendSOI))
oldpar <- par(mfrow=c(1,2), pty="s")
plot(cuberootRain ~ SOI, data = xbomsoi,
ylab = "Rainfall (cube root scale)", yaxt="n")
axis(2, at = rainpos^0.33, labels=paste(rainpos))
with(xbomsoi, lines(lowess(cuberootRain ~ SOI)))
plot(detrendRain ~ detrendSOI, data = xbomsoi,
xlab="Detrended SOI", ylab = "Detrended rainfall", yaxt="n")
axis(2, at = rainpos^0.33, labels=paste(rainpos))
with(xbomsoi, lines(lowess(detrendRain ~ detrendSOI)))
pause()par(oldpar)
attach(xbomsoi)
xbomsoi.ma0 <- arima(detrendRain, xreg=detrendSOI, order=c(0,0,0))
# ordinary regression modelxbomsoi.ma12 <- arima(detrendRain, xreg=detrendSOI,
order=c(0,0,12))
# regression with MA(12) errors -- all 12 MA parameters are estimated
xbomsoi.ma12
pause()xbomsoi.ma12s <- arima(detrendRain, xreg=detrendSOI,
seasonal=list(order=c(0,0,1), period=12))
# regression with seasonal MA(1) (lag 12) errors -- only 1 MA parameter
# is estimated
xbomsoi.ma12s
pause()xbomsoi.maSel <- arima(x = detrendRain, order = c(0, 0, 12),
xreg = detrendSOI, fixed = c(0, 0, 0,
NA, rep(0, 4), NA, 0, NA, NA, NA, NA),
transform.pars=FALSE)
# error term is MA(12) with fixed 0's at lags 1, 2, 3, 5, 6, 7, 8, 10
# NA's are used to designate coefficients that still need to be estimated
# transform.pars is set to FALSE, so that MA coefficients are not
# transformed (see help(arima))detach(xbomsoi)
pause()Box.test(resid(lm(detrendRain ~ detrendSOI, data = xbomsoi)),
type="Ljung-Box", lag=20)pause()attach(xbomsoi)
xbomsoi2.maSel <- arima(x = detrendRain, order = c(0, 0, 12),
xreg = poly(detrendSOI,2), fixed = c(0,
0, 0, NA, rep(0, 4), NA, 0, rep(NA,5)),
transform.pars=FALSE)
xbomsoi2.maSel
qqnorm(resid(xbomsoi.maSel, type="normalized"))
detach(xbomsoi)
--

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