



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




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,
Here is a histogram.
R> hist(mao)
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.
Solution: The data is the number of dendritic branch-segments emanating from nerve cells of newborn guinea pigs.
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.
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))
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