Читать книгу Statistics and Probability with Applications for Engineers and Scientists Using MINITAB, R and JMP - Bhisham C. Gupta, Irwin Guttman - Страница 51

MINITAB

Оглавление

1 Enter the data in column C1.

2 From the Menu bar select Data Recode To Text. This prompts the following dialog box to appear on the screen.

3 Enter C1 in the box under Recode values in the following columns.

4 Select Recode ranges of values from the pulldown menu next to Method.

5 Enter Lower and Upper endpoints as needed and make sure to change the final upper endpoint to 152.1. Type Recoded values in the interval format as previously shown.

6 Select Lower endpoint only from the pulldown menu next to Endpoints to include. Then, for the Storage location for the recoded columns, select At the end of the current worksheet from the pulldown menu.

7 Now from the Menu bar select Stat Tables Tally Individual Variables. This prompts the following dialog box to appear on the screen:

8 In this dialog box, enter C2 Recoded Data in the box under variables.

9 Check all the boxes under Display and click OK. The frequency distribution table as shown below will appear in the Session window

This frequency distribution table also can be obtained by using R as follows:

USING R

First, we define the required classes using the built in ‘seq()’ function. Then, we use the ‘cut()’ function to assign a corresponding class to each observation. As explained in Example 2.3.2, we then use the ‘table()’ function on class variable and the ‘cusum()’ function on the frequency results. The task can be completed by running the following R code in the R Console window.

#Assign given data to the variable RodData RodData = c(145,140,120,110,135,150,130,132,137,115,142,115,130, 124,139,133,118,127,144,143,131,120,117,129,148,130,121,136,133, 147,147,128,142,147,152,122,120,145,126,151) #To define the intervals breaks = seq(110, 152, by=7) #To assign each observation to its interval RodData.split = cut(RodData, breaks, right=FALSE) #To obtain the frequency of data in each class RodData.freq = table(RodData.split) #To combine necessary columns freq.dist = cbind(RodData.freq,100*RodData.freq/sum(RodData.freq), cumsum(RodData.freq), 100*cumsum(RodData.freq)/sum(RodData.freq)) #To name the table columns colnames(freq.dist) = c(‘Frequency’,‘Percentage’, ‘Cum.Frequency’,‘Cum.Percentage’) freq.dist #R output

Frequency Percentage Cum.Frequency Cum.Percentage
3.00 7.69 3.00 7.69
7.00 17.95 10.00 25.64
8.00 20.51 18.00 46.15
7.00 17.95 25.00 64.10
6.00 15.38 31.00 79.49
8.00 20.51 39.00 100.00
Statistics and Probability with Applications for Engineers and Scientists Using MINITAB, R and JMP

Подняться наверх