Try   HackMD

ASE1 : Typical statement of an exam

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Format

Fichier excel deja pret ou on devra mettre nom + prenom + uid. Format CSV fr, separation des champs avec ,

Jouons avec R

UID<-20254 #UID de l'etudiant X<-runif(1000) #Loi uniforme pour une variable X et on en prend mille plot(X) #Affiche X Z<-1:1000 #Vecteur Z plot(Z) alpha<-UID/23000 K<-UID/7500
alpha
0.8806087
K
2.700533

Ces nombres sont differents pour tout le monde

V<-K*X^alpha W<-K*Z^alpha sort(V) #Loi uniforme de V sort(W) #Loi uniforme de W

Le vecteur W a ete construit par vous, il depend de votre numero. Vous devez etre capable de decrire W.

boxplot(W) #Ne sera pa demande au partiel

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

summary(W) #Decrit des valeurs utiles
Min    1st Qu.    Median    Mean    3rd Qu.    Max
2.7    350.1      643.5    630.1    919.1      1193.8 
sd(W) #Ecart type var(W) #Variance

On aura la commande dans l'enonce.

cor(V, W) #Correlation entre V et W
K<-2.5 alpha<-2.1 W<-K*Y^alpha summary(W)

Jouez avec mean, sd, boxplot, summary, var, cov, cor.

X<-1:100
Y<-X^2
plot(X, Y)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Le coefficient de correlation de X et Y au pif ?
Plutot proche de 1 car la courbe ressemble a une droite.
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

cor(X, Y)
0.96

Intervalle de confiance

On va s'interesser au poids d'un nouveau-ne.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • On en a pese 49
  • On a trouve une moyenne de 3.6 Kgs

Je sais que l'ecart-type est de 0.5 Kg. Je souhaite avoir un intervalle de confiance a

95% du poids moyen.

Derniere hypothese: le poids suit une loi normale.

Il y a 2 facons de faire:

  • Rappeler le raisonnement
  • Apprendre la formule du cours

Rappelons le raisonnement

En general "Observation = moyen + ecart = moyenne + k * ecart type" sauf qu'on doit faire une deduction sur la moyenne.

Estimation de moyenne de type moyenne observee ± k * ecart type. Quand on connait l'ecart type K depend de la distribution de la loi normale.

x.barre<-3.6 sigma<-0.5 n<-49

Formule du cours

Un intervalle de confiance a

95%,
α=5%
,
α2=2.5%
et
1−α2=0.975

On utilise qnorm

u<-qnorm(0.975) u
1.959964
mu.inferieur<-x.barre-u*sigma0/sqrt(n) #Formule du cours mu.superieur<-x.barre+u*sigma0/sqrt(n)

L'intervalle de confiance a

95% est
[3.46,3.74]
.

On a mesure un ecart type de 0.53 Kgs. Quel est l'intervalle de confiance?
On a mesure une moyenne de 3.6 Kgs et un ecart type de 0,53 Kgs sur 49 bebes.

v<-qt(0.975, 49-1) v
2.010635
ecart<-v*0.53/sqrt(n-1)
mu.inferieur<-x.barre-ecart mu.superieur<-x.barre+ecart
3.44
3.75

Patients malades

Pour une maladie donnee, un traitement gueri

90% des patients.
J'ai fait un test avec 1000 patients et 850 sont gueris au bout de 2 semaines.
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

J'accepte le 90% sur cette base?
Un test de chi2, dans le cours.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Ici : k=2 classes

  1. patients gueris, p1 = 0.9
  2. patients non gueris, p2 = 0.1


n<-1000 N1<-850 N2<-150 p1<-0.9 p2<-0.1
Z<-(N1-n*p1)^2/(n*p1) + (N2-n*p2)/(n*p2) Z
27.77778

qchisq(0.95, 1)
3.84
qchisq(0.99, 1)
6.63

La valeur de Z est trop grande, les ecarts de Z sont trop grands. En principe Z doit rester petit, on va refuser l'hypothese de guerison a

90%.
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

H0: la proba de guerison est de

90%, la proba de non guerison est
10%
.

Regression lineaire

plot(X, Y, col="blue")

On veut appliquer ces formules

mX<-mean(X) mY<-mean(Y) sX<-sd(X) sY<-sd(Y) rho<-cor(X, Y)
beta<-rho*sY/sX alpha<-mY-beta*mX
PREV<-beta*X+alpha
points(X,PREV,col="red",pch=19,cex=0.8)

ECARTS<-Y-PREV
var(PREV) var(ECARTS)
var(PREV) + var(ECARTS)
2174766

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →