Question 1 on a calculé µ , la moyenne et segma²
pop=seq(10,100,10)
pop
## [1] 10 20 30 40 50 60 70 80 90 100
N=10
mu=mean(pop)
mu
## [1] 55
sigma2= ((N-1)/N)*var(pop)
sigma2
## [1] 825
Question2 a/b/c/ réalisation d’ un tirage aléatoire simple sans remise a proba nulle on a calculer la moyenne y_bar estimé variance de y_bar estimé variance estimé de y_bar estimé
TIRAGE_SIMPLE_ALEATOIRE=function(pop) {
n=3
N=100
ech=sample(x = pop ,size = n,replace = TRUE ,prob=NULL)
y_bar_pear=mean(ech)
var_pear= sigma2 /n
s2c=var(ech)
var_estim_y_bar_pear=s2c/n
v=c(ech,y_bar_pear,var_pear,var_estim_y_bar_pear)
return(v)
}
Question 2 d/ on a constuire un intervalle de confiance de niveau 0.95 pour µ
res=replicate(5,TIRAGE_SIMPLE_ALEATOIRE(pop))
res
## [,1] [,2] [,3] [,4] [,5]
## [1,] 90.0000 90.0000 100.00000 30.00000 90.00000
## [2,] 80.0000 10.0000 100.00000 30.00000 40.00000
## [3,] 40.0000 50.0000 50.00000 100.00000 70.00000
## [4,] 70.0000 50.0000 83.33333 53.33333 66.66667
## [5,] 275.0000 275.0000 275.00000 275.00000 275.00000
## [6,] 233.3333 533.3333 277.77778 544.44444 211.11111
Question 3 la representation de 5 intervalles de confiance
ICinf=1:5
ICsup=1:5
for(i in 1:5){
ICinf[i]=res[4,i]-(1.96*sqrt(res [6,i]))
ICsup[i]=res[4,i]+(1.96*sqrt(res [6,i]))
}
plot(1:5,ICinf,type = "o" ,ylim=c(min(min(ICinf),min(ICsup)),max(max(ICinf),max(ICsup))))
par(new=T)
plot(1:5,ICsup,type = "o" ,ylim=c(min(min(ICinf),min(ICsup)),max(max(ICinf),max(ICsup))))
abline(mu,0)