Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: TP3-4 Mar 4 Avr à 16:44 | |
| - Code:
-
> getwd() #[1] "C:/Program Files/R/rw1091" > getwd() #[1] "C:/Documents and Settings/etudiant/Mes documents/R_STAT_2" > t<-read.table('deug.txt') > t V1 V2 V3 V4 1 Etudiant Mention P1(janv) P2(juin) 2 1 P 10 12 3 2 AB 16 10 4 3 P 9 13 5 4 AB 13 9 6 5 B 15 13 7 6 P 7 14 8 7 P 6 8 9 8 AB 14 7 10 9 P 8 10 11 10 P 13 15 12 11 AB 13 13 13 12 P 12 8 14 13 P 9 10 15 14 B 17 18
Edit Data Editor... t
> V1<-t[,1] > V2<-t[,2] > V3<-t[,3] > V4<-t[,4]
> cat('moyenne:',mean(V3),'\n'); cat('mediane :',median(V3),'\n'); cat('1er quartile :',quantile(V3,0.25),'\n'); cat('2e quartile :',quantile(V3,0.5),'\n'); cat('3e quartile :',quantile(V3,0.75),'\n'); quantile(V3,0.1); quantile(V3,0.2); var(V3); sd(V3); moyenne: 11.57143 mediane : 12.5 1er quartile : 9 2e quartile : 12.5 3e quartile : 13.75 10% 7.3 20% 8.6 [1] 11.80220 [1] 3.435433
> cat('moyenne:',mean(V4),'\n'); cat('mediane :',median(V4),'\n'); cat('1er quartile :',quantile(V4,0.25),'\n'); cat('2e quartile :',quantile(V4,0.5),'\n'); cat('3e quartile :',quantile(V4,0.75),'\n'); quantile(V4,0.1); quantile(V4,0.2); var(V4); sd(V4); moyenne: 11.42857 mediane : 11 1er quartile : 9.25 2e quartile : 11 3e quartile : 13 10% 8 20% 8.6 [1] 9.648352 [1] 3.106180 > > cat('coefficient de corrrelation lineaire empirique :',cor(V3,V4), '\n') coefficient de corrrelation lineaire empirique : 0.270836 >
POUR OBTENIR LES MODES DE P1 et P2 > hist(V3) > hist(V4)
___________________________________________________________________________________________
Mention P1(janv) P2(juin) 1 P 10 12 2 AB 16 10 3 P 9 13 4 AB 13 9 5 B 15 13 6 P 7 14 7 P 6 8 8 AB 14 7 9 P 8 10 10 P 13 15 11 AB 13 13 12 P 12 8 13 P 9 10 14 B 17 18
> t<-read.table('deug.txt') > t Mention P1.janv. P2.juin. 1 P 10 12 2 AB 16 10 3 P 9 13 4 AB 13 9 5 B 15 13 6 P 7 14 7 P 6 8 8 AB 14 7 9 P 8 10 10 P 13 15 11 AB 13 13 12 P 12 8 13 P 9 10 14 B 17 18
> t["Mention"] Mention 1 P 2 AB 3 P 4 AB 5 B 6 P 7 P 8 AB 9 P 10 P 11 AB 12 P 13 P 14 B
> passable<-t[t["Mention"]=='P',] > passable Mention P1.janv. P2.juin. 1 P 10 12 3 P 9 13 6 P 7 14 7 P 6 8 9 P 8 10 10 P 13 15 12 P 12 8 13 P 9 10 > asbien<-t[t["Mention"]=='AB',] > asbien Mention P1.janv. P2.juin. 2 AB 16 10 4 AB 13 9 8 AB 14 7 11 AB 13 13 > bien<-t[t["Mention"]=='B',] > bien Mention P1.janv. P2.juin. 5 B 15 13 14 B 17 18
> mean(passable) Mention P1.janv. P2.juin. NA 9.25 11.25 Warning message: argument is not numeric or logical: returning NA in: mean.default(X[[1]], ...)
> mean(passable["P1.janv."]) P1.janv. 9.25 > var(passable["P1.janv."]) P1.janv. P1.janv. 5.642857
PAS DUR, A FAIRE...
------------------------------------
> M<-t["P1.janv."]+t["P2.juin."] > M<-M/2 > M P1.janv. 1 11.0 2 13.0 3 11.0 4 11.0 5 14.0 6 10.5 7 7.0 8 10.5 9 9.0 10 14.0 11 13.0 12 10.0 13 9.5 14 17.5
PAS DUR, A FAIRE...
Pour trouver la boîte à moustache
> boxplot(V3) > x11() > boxplot(V4) >
Pour trouver un graphe en secteur de la répartition des mentions > pie(table(t[,1])) > x11() > pie(table(t[,1])) >
--------------------------------------- > plot(t[,2],t[,3],type='p') >
_________________________________ __________________________________
PROBLEME DU BIAIS
moment.txt
Mom2=function(x) { barx=mean(x) Mat1=x-barx Mom2=mean(Mat1^2)
return(Mom2) }
> source('moment.txt') > vect<-c(11,14,13,11) > var(vect) [1] 2.25 > Mom2(vect) [1] 1.687
asym=function(x) { barx=mean(x) Mat1=x-barx Mom3=mean(Mat1^3)
Mom2=var(x) divis=Mom2^(3/2) asym=Mom3/divis
return(asym) } | |
|