Skip to content

Commit

Permalink
chore(mad): lab1 started
Browse files Browse the repository at this point in the history
  • Loading branch information
desolaye committed Sep 11, 2023
1 parent 91a8673 commit c901a87
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
config.php
node_modules
web/utils/connection.php
.Rproj.user
201 changes: 201 additions & 0 deletions mad/dataset.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
n/n;group;sex;age;yearBuy;averagePrice;averagePagesPerVisit;numberOfCallsYear;internetParticipation;Quality
1;1;1;25;36;539;21.7;20;3;72
2;1;2;24;26;290;29.7;17;2;97
3;1;1;28;29;335;15.7;20;3;34
4;1;1;22;22;492;27.9;15;2;85
5;1;1;26;34;332;25.8;26;3;80
6;1;2;27;23;262;22.9;18;4;63
7;1;1;25;34;103;17.7;19;2;60
8;1;2;24;30;335;25.8;19;4;85
9;1;1;27;27;151;27.3;16;3;89
10;1;1;25;27;328;26.8;15;2;91
11;1;1;27;29;330;14.1;16;1;43
12;1;1;26;26;328;18.8;20;2;46
13;1;2;23;33;459;22.2;15;3;84
14;1;1;26;29;243;24.0;17;3;78
15;1;1;24;31;100;23.3;20;3;79
16;1;2;24;26;258;23.0;23;4;55
17;1;1;26;27;261;15.6;23;1;36
18;1;2;23;30;378;24.5;15;4;89
19;1;1;22;25;206;20.5;14;2;65
20;1;2;25;28;596;24.1;20;4;75
21;1;1;25;30;331;25.2;25;3;72
22;1;2;27;32;450;30.1;24;3;98
23;1;1;24;29;353;22.8;11;2;89
24;1;1;24;21;343;21.5;21;1;50
25;1;1;23;31;317;27.3;6;1;99
26;1;2;25;20;312;21.4;17;3;49
27;1;1;24;30;356;21.1;26;1;53
28;1;2;27;31;521;29.1;16;2;99
29;1;1;21;31;348;24.6;20;1;83
30;1;1;24;34;296;26.5;22;1;90
31;1;1;22;27;394;20.5;20;2;52
32;1;1;26;26;324;30.0;22;3;85
33;1;2;25;31;429;22.5;15;4;85
34;1;1;26;24;330;32.6;16;2;99
35;1;1;27;26;443;21.6;15;1;71
36;1;2;23;31;310;18.4;15;4;70
37;1;1;22;35;341;23.9;19;1;87
38;1;2;26;28;178;25.1;11;3;90
39;1;1;26;24;115;25.7;18;3;77
40;1;2;24;25;160;21.1;23;3;48
41;1;1;27;25;332;22.6;20;2;59
42;1;2;25;29;219;18.1;18;4;56
43;1;1;26;24;341;24.1;15;3;72
44;1;1;22;29;362;25.2;21;2;78
45;1;1;29;29;156;24.3;15;3;81
46;1;2;24;35;496;24.6;20;4;90
47;1;1;27;33;197;30.5;22;2;100
48;1;2;24;29;438;20.8;18;2;67
49;1;1;20;33;304;23.6;16;3;92
50;1;1;23;27;337;26.2;21;1;75
51;1;1;26;27;385;27.1;24;2;75
52;1;1;24;18;409;22.0;24;3;35
53;1;2;22;28;449;27.6;23;2;74
54;1;1;26;26;305;26.3;22;3;74
55;1;1;25;31;317;17.6;17;3;59
56;1;2;24;20;419;22.6;21;2;55
57;1;1;25;28;236;22.3;20;3;63
58;1;2;26;26;519;22.2;18;2;60
59;1;1;26;22;363;17.2;9;1;56
60;1;2;28;29;230;21.3;22;4;53
61;1;1;23;30;435;23.2;18;3;83
62;1;2;26;35;276;24.6;19;2;93
63;1;1;25;34;362;18.4;22;3;61
64;1;1;25;27;498;22.5;24;2;57
65;1;1;24;28;275;25.2;11;2;99
66;1;2;27;33;354;27.1;19;2;92
67;1;1;28;20;411;21.5;20;2;45
68;1;2;26;24;432;25.4;16;4;79
69;1;1;25;22;343;25.4;12;1;81
70;1;1;27;26;319;23.1;13;2;75
71;1;1;26;29;276;19.3;19;2;55
72;1;1;27;29;464;19.4;22;2;54
73;1;2;27;28;212;16.4;12;2;61
74;1;1;25;31;217;20.4;16;3;72
75;1;1;24;34;323;23.8;20;2;80
76;1;2;24;27;332;25.9;22;2;72
77;1;1;28;23;322;20.3;15;2;59
78;1;2;29;29;198;26.2;24;4;71
79;1;1;28;22;360;21.1;24;2;41
80;1;2;27;32;405;26.3;18;4;86
81;1;1;22;22;343;24.9;14;1;79
82;1;2;24;20;432;25.2;25;3;49
83;1;1;27;24;296;28.5;16;1;95
84;1;1;25;38;198;18.4;19;2;70
85;1;1;27;28;338;27.7;22;2;85
86;1;2;25;25;339;18.8;20;3;47
87;1;1;27;28;284;18.3;21;3;48
88;1;2;27;23;314;29.2;18;2;88
89;1;1;20;25;373;26.8;13;1;91
90;1;1;23;29;351;22.6;23;3;60
91;1;1;22;27;297;24.9;7;2;99
92;1;1;26;26;332;26.1;14;3;82
93;1;2;27;25;337;21.8;12;2;84
94;1;1;28;23;178;31.7;24;3;85
95;1;1;24;37;275;22.9;13;1;100
96;1;2;26;27;161;20.9;21;3;58
97;1;1;24;27;261;20.9;13;2;73
98;1;2;27;25;325;24.6;26;4;57
99;1;1;25;23;405;24.3;24;2;53
100;1;2;26;25;335;25.8;15;3;83
101;2;2;44;33;553;18.7;20;2;63
102;2;1;42;40;555;21.1;19;1;89
103;2;1;42;35;611;29.1;20;3;100
104;2;2;40;30;728;18.2;12;2;67
105;2;2;36;35;634;20.4;19;4;75
106;2;1;45;37;746;25.4;20;3;96
107;2;2;38;29;458;26.8;17;4;90
108;2;2;42;33;571;16.9;17;4;56
109;2;2;37;39;594;23.3;18;2;96
110;2;1;33;32;563;16.3;20;1;55
111;2;2;40;42;521;19.3;15;3;94
112;2;2;38;37;532;22.5;12;4;100
113;2;2;44;42;500;19.2;18;4;87
114;2;1;44;33;534;14.5;19;3;48
115;2;2;36;32;458;18.5;23;4;48
116;2;2;42;36;719;24.1;16;4;93
117;2;1;42;28;530;17.5;22;1;40
118;2;2;42;38;504;22.1;20;4;79
119;2;1;36;33;516;22.6;14;1;85
120;2;1;46;31;617;22.9;20;3;73
121;2;2;42;42;569;20.5;18;3;93
122;2;1;38;27;445;29.4;18;3;99
123;2;1;35;33;358;22.4;19;1;78
124;2;2;30;30;609;18.9;21;4;58
125;2;2;34;40;390;25.6;19;2;100
126;2;1;40;35;789;29.1;15;2;100
127;2;2;46;36;574;21.7;16;3;92
128;2;2;33;27;706;20.9;17;3;63
129;2;2;39;40;516;25.0;17;3;109
130;2;1;37;38;612;20.0;16;3;92
131;2;2;37;30;658;17.7;22;2;51
132;2;2;40;40;661;21.9;14;2;98
133;2;2;36;38;637;21.7;13;3;96
134;2;1;39;36;685;24.4;21;2;94
135;2;2;43;38;553;21.8;13;3;98
136;2;2;35;33;475;18.9;21;3;57
137;2;1;34;34;396;23.8;23;1;77
138;2;2;45;37;503;21.7;13;3;93
139;2;1;37;30;581;23.2;19;3;74
140;2;1;31;25;639;19.2;16;2;52
141;2;2;43;42;477;24.1;19;4;100
142;2;1;35;28;666;21.9;19;3;64
143;2;1;44;41;628;21.4;23;3;77
144;2;2;38;27;632;23.6;16;2;83
145;2;2;40;30;578;28.0;20;2;88
146;2;1;37;34;620;18.9;12;3;80
147;2;2;36;34;478;28.7;17;4;100
148;2;2;35;37;504;24.3;21;3;86
149;2;2;41;29;554;19.0;16;4;62
150;2;1;45;33;416;23.8;19;2;87
151;2;2;48;41;625;16.3;16;4;80
152;2;2;40;33;545;21.0;22;2;60
153;2;2;48;35;645;23.5;14;3;100
154;2;1;40;36;647;20.8;12;3;95
155;2;2;41;36;702;20.9;17;2;82
156;2;2;37;29;674;15.8;23;3;37
157;2;1;41;35;650;22.7;22;1;78
158;2;2;41;21;564;27.1;15;2;84
159;2;1;46;30;565;23.3;13;3;83
160;2;1;37;33;423;10.4;15;3;36
161;2;2;42;31;699;31.1;20;2;100
162;2;1;45;38;773;23.2;13;2;100
163;2;1;40;33;614;28.4;16;2;100
164;2;2;37;35;637;25.5;25;3;85
165;2;2;46;44;517;23.9;28;3;88
166;2;1;36;29;632;21.7;18;1;70
167;2;2;39;32;566;21.3;12;2;77
168;2;2;37;29;782;23.2;20;4;69
169;2;2;38;31;487;29.4;16;4;100
170;2;1;45;29;603;26.1;20;3;84
171;2;2;38;40;519;22.7;15;2;98
172;2;2;37;40;667;21.5;22;4;77
173;2;2;40;31;487;28.9;18;3;100
174;2;1;37;36;766;22.1;19;1;81
175;2;2;45;29;606;20.1;23;3;57
176;2;2;39;36;784;19.6;19;2;70
177;2;1;43;34;514;23.2;23;2;75
178;2;2;42;36;547;23.7;13;3;100
179;2;1;46;42;656;14.5;20;2;61
180;2;1;41;35;529;18.9;15;3;79
181;2;2;41;29;637;27.9;23;4;83
182;2;1;39;28;519;19.1;16;2;58
183;2;1;41;40;671;18.3;19;1;80
184;2;2;37;34;573;28.0;8;2;100
185;2;2;43;37;607;17.1;11;3;84
186;2;1;41;39;670;21.8;23;3;80
187;2;2;42;33;734;21.6;14;3;84
188;2;2;39;34;601;24.6;17;3;93
189;2;2;43;30;467;25.5;20;2;81
190;2;1;46;20;623;21.9;13;3;58
191;2;2;38;33;516;19.9;21;3;64
192;2;2;42;31;471;20.9;16;2;77
193;2;2;36;35;543;28.0;16;4;100
194;2;1;45;29;657;23.5;22;1;67
195;2;2;52;30;696;29.1;18;2;99
196;2;2;43;40;609;21.9;24;4;76
197;2;1;38;23;665;22.5;17;3;58
198;2;2;40;31;611;27.2;19;2;96
199;2;1;40;45;558;23.8;13;1;100
200;2;1;43;39;566;23.7;18;2;97
54 changes: 54 additions & 0 deletions mad/lab1.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
data <- read.table('./dataset.csv', header = TRUE, sep = ';', stringsAsFactors = FALSE)
# View(data)
# data$n.n <- as.factor(data$n.n)

data$group <- as.factor(data$group)
data$sex <- as.factor(data$sex)
data$internetParticipation <- as.factor(data$internetParticipation)

# str(data)
group_one <- subset(data, group == 1)
group_two <- subset(data, group == 2)

#print("FIRST GROUP")
#summary(group_one)

#print("SECOND GROUP")
#summary(group_two)

#library(psych)

#sm<-describe(group_one)
#sm2<-describe(group_two)
#View(sm)
#View(sm2)

# plot(data.frame(group_one$age, group_one$Quality))
# plot(data.frame(group_two$age, group_two$Quality))

#x<-c(summary(data$sex))
#piepercent<- round(100*x/sum(x), 1)
#pie(x, piepercent, radius=1, main="ОЧЕНь радикальная диаграмма", xlab="название оси X", ylab="название оси Y", col=c("red", "blue", "green", "brown"), clockwise=TRUE)
#legend("topright", c("One","Two", "Three", "Four"), cex = 0.8, fill =c("red", "blue", "green", "brown"))

M <- data[,unlist(lapply(data, is.numeric))]
N1<-cor(M,use="pairwise.complete.obs")

library("corrplot")
col <- colorRampPalette(c("#BB4444", "#EE9988", "#FFFFFF", "#77AADD",
"#4477AA"))
corrplot(N1, method="color", col=NULL,
type="upper", order="hclust",
addCoef.col = "black", tl.col="black", tl.srt=45,
sig.level = 0.01, insig = "blank",
diag=FALSE
)

a<-cor.test(data$Quality, data$averagePagesPerVisit)
# print(a)

hist(data$averagePrice)

b <- fisher.test(table(data$sex, data$internetParticipation))
print(b)
# system('read -p "Press [Enter] key to end..."')
13 changes: 13 additions & 0 deletions mad/mad.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

0 comments on commit c901a87

Please sign in to comment.