---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- [ continuation from here, paragraph (N_1) ] # questio(data,s1,s2,N,I) evaluates the answers to a questionnaire, where: # data are results, s1 numbers of possible answers to information questions, s2 # numbers of possible answers to actual questions, N the particular question to be # examined, I the answers to informative questions to be tested (0 if all are tested). # questioP(data,s1,s2, OK,P, I) gives the scores, if the questions have an OK answer # and are evaluated with a certain weight. # An example of the use of questio (with little data, to understand the commands): # 1: 1 females, 2 males 2: 1,2,3 class # 3: answer (selected among 1,2,3,4) 4: answer (selected among 1,2,3,4) # 5: answer (selected among 1,2) D = c( 1,1, 2,3,1, 1,2, 1,4,2, 2,1, 3,1,1, 2,3, 4,2,2, 1,3, 3,2,1, 2,1, 3,1,2, 2,2, 1,2,2, 1,3, 2,2,1, 2,1, 3,4,2, 2,2, 1,2,2, 2,3, 2,2,1, 1,3, 1,4,2, 1,2, 1,4,2, 1,2, 1,3,2, 1,2, 1,1,2 ) BF=2; HF=2.3 # To resize the graphs. The histograms are shown below. info = c(2,3); cult = c(4,4,2) questio(D,info,cult, 1,0) # 1^ question # 15 total number of answers # [the distance of the sides of the grid is 10 %] # Frequencies and percentage freq.: # 8, 7 # 53.33,46.67 undery("F / M") questio(D,info,cult, 2,0) # 2^ question # 15 total number of answers # [the distance of the sides of the grid is 5 %] # Frequencies and percentage freq.: # 4, 6, 5 # 26.67,40,33.33 undery("1^ / 2^ / 3^") questio(D,info,cult, 3,0) # 3^ question # 15 total number of answers # [the distance of the sides of the grid is 5 %] # Frequencies and percentage freq.: # 7, 3, 4, 1 # 46.67,20,26.67,6.67 questio(D,info,cult, 5,0) # 5^ question # 15 total number of answers # [the distance of the sides of the grid is 10 %] # Frequencies and percentage freq.: # 5, 10 # 33.33,66.67 questio(D,info,cult, 4,c(1,2)) # 4^ question among the female of 2^ class # 4 total number of answers # [the distance of the sides of the grid is 10 %] # Frequencies and percentage freq.: # 1, 0, 1, 2 # 25,0,25,50 undery("F / 2^") # An example of the use of questio and of questioP # Two classes performed a verification test (of 6 questions): # 1: 1,2 class # 2: answer (selected among 1-4) 3: answer (selected among 1-4) # 4: answer (selected among 1-4) 5: answer (selected among 1-2) # 6: answer (selected among 1-6) 7: answer (selected among 1-3) # One informative question and 6 actual questions of 4,4,4,2,6,3 possible answers info = 2; cult = c(4,4,4,2,6,3) # The correct answers are OK and the scores of the various questions are P: OK = c(4,2,3,1,5,3); P = c(10,8,8,7,10,5) X = c( 1, 4,2,3,1,5,3, 1, 4,1,3,2,5,2, 2, 1,2,1,1,1,3, 2, 4,4,3,2,5,1, 1, 4,2,2,1,5,3, 2, 4,2,3,1,6,2, 2, 2,2,2,2,1,3, 1, 3,2,1,1,5,1, 1, 4,3,3,1,5,3, 2, 1,2,1,2,6,2, 2, 2,1,1,1,1,3, 1, 4,2,2,1,5,1, 2, 4,2,3,2,5,3, 2, 2,1,3,1,5,3, 2, 4,2,2,1,5,3, 1, 3,1,1,2,5,3, 1, 4,2,3,1,3,3, 1, 4,2,3,1,5,3, 1, 2,1,3,2,5,2, 2, 4,2,1,1,1,3, 2, 3,2,3,1,5,1, 1, 4,3,3,2,5,3, 1, 4,2,3,1,3,2 ) # Answers to "2", answers to "5", answer to "5" of female: questio(X, info,cult, 2,0) # 23 total number of answers # Frequencies and percentage freq.: # 2, 4, 3, 14 # 8.7,17.39,13.04,60.87 questio(X, info,cult, 5,0) # 23 total number of answers # Frequencies and percentage freq.: # 15, 8 # 65.22,34.78 questio(X, info,cult, 5,1) # 12 total number of answers # Frequencies and percentage freq.: # 8, 4 # 66.67,33.33 undery("F") # The scores (in hundredths) of the 23 students (see above for OK and P): questioP(X,info,cult, OK,P, 0) # 1 100 # 2 58 # 3 42 # 4 58 # 5 83 # 6 69 # 7 27 # 8 52 # 9 83 # 10 17 # 11 25 # 12 73 # 13 85 # 14 62 # 15 83 # 16 31 # 17 79 # 18 100 # 19 38 # 20 62 # 21 69 # 22 69 # 23 69 # The scores of the females: questioP(X,info,cult, OK,P, 1) # 1 100 # 2 58 # 5 83 # 8 52 # 9 83 # 12 73 # 16 31 # 17 79 # 18 100 # 19 38 # 22 69 # 23 69 # If I want to transform the scores I can use P_ S = P_; S # 100.00000 58.33333 83.33333 52.08333 83.33333 72.91667 31.25000 # 79.16667 100.00000 37.50000 68.75000 68.75000 # The scores of the females in tenths and in quarters: round(S/100*10) # 10 6 8 5 8 7 3 8 10 4 7 7 round(S/100*4) # 4 2 3 2 3 3 1 3 4 2 3 3 # If I want I can process other statistics: Histo(P_, 0,100, 10) # Frequencies and percentage freq.: # 0, 1, 2, 2, 1, 3, 6, 2, 4, 2 # 0,4.35,8.7,8.7,4.35,13.04,26.09,8.7,17.39,8.7 statistics(P_) # Min. 1st Qu. Median Mean 3rd Qu. Max. # 16.67 46.88 68.75 62.41 81.25 100.00 # The brown dots are 5^ and 95^ percentiles # The red dot is the mean