Docsity

Brief Solutions for Statistics 371 - Fall 2002, Assignments of Statistics

Toggle sidebar
bg1
Statistics 371 Brief Solutions #2 Fall 2002
1. Problems 2.4 and 2.5 (page 30). Related R function: hist.
Solution: The data for these problems are measurements of the activity of monoamine oxydase (MAO) measured in nmoles
benzylaldehyde product per 108pletelets from 18 schizophrenia patients.
Here is a dotplot of the data.
R> source("dotplot.r")
R> mao <- c(6.8, 8.4, 8.7, 11.9, 14.2, 18.8, 9.9, 4.1, 9.7, 12.7,
+ 5.2, 7.8, 7.8, 7.4, 7.3, 10.6, 14.5, 10.7)
R> dotplot(mao)
5 10 15
Here is a histogram.
R> hist(mao)
Bret Larget September 16, 2002
pf3
pf4
pf5

Partial preview of the text

Download Brief Solutions for Statistics 371 - Fall 2002 and more Assignments Statistics in PDF only on Docsity!

  1. Problems 2.4 and 2.5 (page 30). Related R function: hist.

Solution: The data for these problems are measurements of the activity of monoamine oxydase (MAO) measured in nmoles benzylaldehyde product per 108 pletelets from 18 schizophrenia patients. Here is a dotplot of the data.

R> source("dotplot.r") R> mao <- c(6.8, 8.4, 8.7, 11.9, 14.2, 18.8, 9.9, 4.1, 9.7, 12.7,

  • 5.2, 7.8, 7.8, 7.4, 7.3, 10.6, 14.5, 10.7) R> dotplot(mao)

Here is a histogram.

R> hist(mao)

Histogram of mao

mao

Frequency

The histogram shows a bimodal distribution with peaks near 7.5 and 14.5, but the sample size is so small that the second peak may be an artifact. The distribution is skewed slightly to the right. The dotplot and the histogram show that the largest observation (18.8) is a bit of an outlier. Notes on grading: R does not have a dotplot function. R does have have a function called dotchart, but this should not be used as it produces a graph that is different than what we call a dotplot in the textbook. I have written a new dotplot function which produced the output in this solution. Here are some things for which you should be checking, especially with hand drawn graphs.

(a) The graph should not be made with dotchart. (b) The scale on the numeric axis should consistent without breaks and with the same scale throughout. (c) The bars on histograms should cover the entire range of the class without gaps (except where there is missing data). (d) The class intervals should all be the same size. (e) Students may have chosen different classes for the histogram, and that is fine.

  1. Problem 2.6 (page 30). Related R function: stem.

Solution: The data is the number of dendritic branch-segments emanating from nerve cells of newborn guinea pigs.

  1. Problem 2.24 (page 47). Related R functions: quantile and boxplot.

Solution: The data are the same MAO data from Exercise 2.4. Here are the medians and quartiles (computed with two different algorithms) displayed with a modified boxplot. Notice the outlier at 18.8.

R> fivenum(mao)

[1] 4.1 7.4 9.2 11.9 18.

R> quantile(mao)

0% 25% 50% 75% 100% 4.1 7.5 9.2 11.6 18.

R> boxplot(mao)

Notes on grading: Make sure that students sort the data before finding quartiles. There are different ways to define quartiles. The function fivenum produces a five number summary that is more consistent with how I defined quartiles in class, but I just learned of it today. The quantile function (which I suggested students use) actually does something different.

Students probably did not use a modified boxplot (with an outlier marked) if they constructed the boxplot by hand. This is okay, I did not lecture on that yet. As long as students are clear about the methods they use to find quartiles, different answers are acceptable.

  1. Problem 2.26 (page 47). Related R functions: boxplot, data.frame, split, and list. The data is self-reported numbers of hours of exercise per week given by 25 college students, 12 men and 13 women. Here are parallel boxplots. Solution:

R> male <- c(6, 0, 2, 1, 2, 4.5, 8, 3, 17, 4.5, 4, 5) R> female <- c(5, 13, 3, 2, 6, 14, 3, 1, 1.5, 1.5, 3, 8, 4) R> boxplot(list(male = male, fenale = female))

male fenale

The functions read.table and split would be useful to create parallel boxplots if the data were read in from a file. The function data.frame could also be used to create a “data frame” or matrix of the two variables. For example, you could create a text file ex2-26.txt with the values of the two variables like this.

hours sex 6 male