-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_examen.R
More file actions
47 lines (32 loc) · 833 Bytes
/
script_examen.R
File metadata and controls
47 lines (32 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Exercises pour l'examen
virg <- read.csv("virginica.csv",header=TRUE)
vers <- read.csv("versicolor.csv",header=TRUE)
virg.pl <- virg$Petal.Length
vers.pl <- vers$Petal.Length
# Histogramme
hist(virg.pl)
hist(vers.pl)
# Boxplot
boxplot(virg.pl, vers.pl)
# Moyenne
mean(virg.pl)
mean(vers.pl)
# Médian
median(virg.pl)
median(vers.pl)
# Écart-type
sd(virg.pl)
sd(vers.pl)
# Variance
var(virg.pl)
var(vers.pl)
# Z-score:
virg.low <- (min(virg.pl) - mean(virg.pl))/sd(virg.pl)
(min(virg.pl) - mean(virg.pl)) / sd(virg.pl)
virg.up <- (max(virg.pl) - mean(virg.pl))/sd(virg.pl)
vers.low <- (min(vers.pl) - mean(vers.pl))/sd(vers.pl)
vers.up <- (max(vers.pl) - mean(vers.pl))/sd(vers.pl)
# Normalité:
shapiro.test(virg.pl)
shapiro.test(vers.pl)
t.test(virg.pl, vers.pl)