In: Statistics and Probability
APPLIED STATISTICS 2
USE R CODE! SHOW R CODE
Use data file RecordMath2526.txt, to produce a plot graph with Exam1 as x, Exam2 as y, use Gender as color, and Hw1 as pch.
RecordMath2526 information
Index Gender Hw1 Hw2 Hw3 Exam1 Hw4 Exam2 Hw5 Hw6 Hw7 Final 1 F 9 6 8 60 7 82 10 10 9 69 2 M 10 10 10 94 9 98 10 10 8 91 3 M 9 10 8 79 9 55 10 6 8 43 4 F 10 9 9 91 8 88 10 9 8 84 5 F 9 8 9 71 9 97 10 9 9 89 6 F 9 9 7 64 9 87 10 9 9 58 7 M 9 9 9 55 7 59 10 6 0 68 8 M 9 10 7 71 10 70 10 8 10 59 9 M 8 10 9 81 10 100 10 10 9 98 10 F 9 9 7 76 6 58 10 5 8 50 11 F 10 6 7 69 5 55 10 4 8 47 12 F 9 5 4 46 7 72 10 6 7 78 13 M 9 9 10 71 9 85 10 8 7 67 14 M 8 9 8 60 10 71 10 8 10 75 15 M 10 9 10 71 10 93 10 9 9 67 16 F 9 10 8 70 7 80 10 10 8 83 17 F 9 10 9 72 7 89 10 9 9 78 18 M 10 10 10 80 10 94 10 9 10 71 19 F 10 10 9 66 9 78 10 6 8 83 20 F 8 9 7 78 6 81 9 7 8 84
APPLIED STATISTICS 2
USE R CODE! SHOW R CODE
The R-code is
#First we need to copy data and save in text file and after ruin this command choose the text file saved
d=read.table(file.choose(),header=T)
d
attach(d)
plot(Exam1,Exam2,col=Gender,pch=Hw1)
# If You want to add legend
plot(Exam1,Exam2,col=Gender,pch=Hw1)
legend("topleft",legend=levels(Gender),col=Gender,pch=Hw1)
The Output of the R-code is
> d=read.table(file.choose(),header=T)
> d
Index Gender Hw1 Hw2 Hw3 Exam1 Hw4 Exam2 Hw5 Hw6 Hw7 Final
1 1 F 9 6 8 60 7 82 10 10 9 69
2 2 M 10 10 10 94 9 98 10 10 8 91
3 3 M 9 10 8 79 9 55 10 6 8 43
4 4 F 10 9 9 91 8 88 10 9 8 84
5 5 F 9 8 9 71 9 97 10 9 9 89
6 6 F 9 9 7 64 9 87 10 9 9 58
7 7 M 9 9 9 55 7 59 10 6 0 68
8 8 M 9 10 7 71 10 70 10 8 10 59
9 9 M 8 10 9 81 10 100 10 10 9 98
10 10 F 9 9 7 76 6 58 10 5 8 50
11 11 F 10 6 7 69 5 55 10 4 8 47
12 12 F 9 5 4 46 7 72 10 6 7 78
13 13 M 9 9 10 71 9 85 10 8 7 67
14 14 M 8 9 8 60 10 71 10 8 10 75
15 15 M 10 9 10 71 10 93 10 9 9 67
16 16 F 9 10 8 70 7 80 10 10 8 83
17 17 F 9 10 9 72 7 89 10 9 9 78
18 18 M 10 10 10 80 10 94 10 9 10 71
19 19 F 10 10 9 66 9 78 10 6 8 83
20 20 F 8 9 7 78 6 81 9 7 8 84
> attach(d)
> plot(Exam1,Exam2,col=Gender,pch=Hw1)
> plot(Exam1,Exam2,col=Gender,pch=Hw1)
>
legend("topleft",legend=levels(Gender),col=Gender,pch=Hw1)