Probability with R. Jane M. Horgan. Читать онлайн. Newlib. NEWLIB.NET

Автор: Jane M. Horgan
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Математика
Год издания: 0
isbn: 9781119536987
Скачать книгу

      source("C:\\test")

      retrieves the program named test.R from the C directory. Another way of doing this, while working in R, is to click on

on the tool bar where you will be given the option to Source R code, and then you can browse and retrieve the program you require.

      Exercises 2.1

      1 For the class of 50 students of computing detailed in Exercise 1.1, use R to:obtain the summary statistics for each gender, and for the entire class;calculate the deciles for each gender and for the entire class;obtain the skewness coefficient for the females and for the males.

      2 It is required to estimate the number of message buffers in use in the main memory of the computer system at Power Products Ltd. To do this, 20 programs were run, and the number of message buffers in use were found to beCalculate the average number of buffers used. What is the standard deviation? Would you say these data are skewed?

      3 To get an idea of the runtime of a particular server, 20 jobs were processed and their execution times (in seconds) were observed as follows:Examine these data and calculate appropriate measures of central tendency and dispersion.

      4 Ten data sets were used to run a program and measure the execution time. The results (in milliseconds) were observed as follows:Use appropriate measures of central tendency and dispersion to describe these data.

      5 The following data give the amount of time (in minutes) in one day spent on Facebook by each of 15 students.Obtain appropriate measures of central tendency and measures of dispersion for these data.

      Pearson has given an approximate formula for the skewness that is easier to calculate than the exact formula given in Equation 2.1.

      Write a program to calculate this, and apply it to the data in results.txt. Is it a reasonable approximation?

      demo(graphics)

      you will see examples of the many graphical procedures of R, along with the code needed to implement them. In this chapter, we will examine some of the most common of these.

      A boxplot is a graphical summary based on the median, quartiles, and extreme values. To display the downtime data given in Example 1.1 using a boxplot, write

      boxplot(downtime)

      To improve the look of the graph, we could label the axes as follows:

      boxplot(downtime, xlab = "Downtime", ylab = "Minutes")

      Multiple boxplots can be displayed on the same axis, by adding extra arguments to the boxplot function. For example,

      boxplot(results$arch1, results$arch2, xlab = "Architecture Semesters 1 and 2")

      or simply

      boxplot(arch1, arch2, xlab = "Architecture Semesters 1 and 2")

c03f003

      Notice also in Fig. 3.3 that there are points outside the whiskers of the boxplot in Architecture in Semester 2. These points represent cases over 1.5 box lengths from the upper or lower end of the box and are called outliers. They are considered atypical of the data in general, being either extremely low or extremely high compared to the rest of the data.

      boxplot(marks˜gendermarks)c03f004

      Notice the outlier in Fig. 3.4 in the male boxplot, a value that appears large compared to the rest of the data. You will recall that a check on the examination results indicated that this value should have been 46, not 86, and we corrected it using

      marks[34] <- 46

      boxplot(marks˜gendermarks)

c03f005