Question 0:

Selon moi, la population Pi aura moins d’individus aux yeux bleus que la population P0. Cependant, le nombre d’allèles Bleus et marrons devraient rester constant.

Question 1:

0=> Personne avec 2 allèles bleus 1=> Personne avec 2 allèles différentes 2=> Personne avec 2 allèles marrons

Exemple 1:

set.seed(666);
k=0;
l=0;
m=0;
P= 20;
i= 20;
nb0=c();
nb1=c();
nb2=c();
"ti<-sample(0:2,P, replace = T)"
## [1] "ti<-sample(0:2,P, replace = T)"
ti=c(0,0,0,0,0,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1)
"ti=c(0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,1,1,1)
ti=c(0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1)"
## [1] "ti=c(0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,1,1,1)\nti=c(0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1)"
  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 6.35
moy1
## [1] 5.15
moy2
## [1] 8.5
  plot(nb0)

  plot(nb1)

  plot(nb2)

Exemple 2:

set.seed(666);
k=0;
l=0;
m=0;
P= 20;
i= 20;
nb0=c();
nb1=c();
nb2=c();
"ti<-sample(0:2,P, replace = T)"
## [1] "ti<-sample(0:2,P, replace = T)"
"ti=c(0,0,0,0,0,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1)
ti=c(0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,1,1,1)"
## [1] "ti=c(0,0,0,0,0,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1)\nti=c(0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,1,1,1)"
ti=c(0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1)

  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 6.55
moy1
## [1] 5.5
moy2
## [1] 7.95
  plot(nb0)

  plot(nb1)

  plot(nb2)

Exemple 3:

set.seed(666);
k=0;
l=0;
m=0;
P= 20;
i= 20;
nb0=c();
nb1=c();
nb2=c();
"ti<-sample(0:2,P, replace = T)"
## [1] "ti<-sample(0:2,P, replace = T)"
"ti=c(0,0,0,0,0,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1)"
## [1] "ti=c(0,0,0,0,0,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1)"
ti=c(0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,1,1,1)
"ti=c(0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1)"
## [1] "ti=c(0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1)"
  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 7.3
moy1
## [1] 4.05
moy2
## [1] 8.65
  plot(nb0)

  plot(nb1)

  plot(nb2)

Les résultats ne nous permettent pas de conclure, il faudrait prendre plus de personnes sur un plus grand nombre de générations pour obtenir un résultat correct.

Question 2:

Exemple 1:

set.seed(666);

k=0;
l=0;
m=0;
P= 2000;
i= 100;
nb0=c();
nb1=c();
nb2=c();

nbb=400;
nbm=1200;
h=1;
ti=c()

while(h!=nbb+1){
  ti[h]=0
  h=h+1
}
while(h!=nbb+nbm+1){
  ti[h]=2
  h=h+1
}
while(h!=2001){
  ti[h]=1
  h=h+1
}

  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 734.61
moy1
## [1] 471.06
moy2
## [1] 794.33

Exemple 2:

set.seed(666);

k=0;
l=0;
m=0;
P= 2000;
i= 100;
nb0=c();
nb1=c();
nb2=c();

nbb=1200;
nbm=400;
h=1;
ti=c()

while(h!=nbb+1){
  ti[h]=0
  h=h+1
}
while(h!=nbb+nbm+1){
  ti[h]=2
  h=h+1
}
while(h!=2001){
  ti[h]=1
  h=h+1
}

  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 777.43
moy1
## [1] 474.35
moy2
## [1] 748.22

Exemple 3:

set.seed(666);

k=0;
l=0;
m=0;
P= 2000;
i= 100;
nb0=c();
nb1=c();
nb2=c();

nbb=500;
nbm=500;
h=1;
ti=c()

while(h!=nbb+1){
  ti[h]=0
  h=h+1
}
while(h!=nbb+nbm+1){
  ti[h]=2
  h=h+1
}
while(h!=2001){
  ti[h]=1
  h=h+1
}

  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }

  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 754.59
moy1
## [1] 479.65
moy2
## [1] 765.76

D’aprés les résultats, le nombre de personnes avec 2 allèles bleus finit par être équivalent au nombre de ceux avec 2 allèles marrons (environ 750 personnes).

Question 3:

set.seed(666);

k=0;
l=0;
m=0;
P= 20;
i= 2000;
nb0=c();
nb1=c();
nb2=c();

nbb=4;
nbm=4;
h=1;
ti=c()

while(h!=nbb+1){
  ti[h]=0
  h=h+1
}
while(h!=nbb+nbm+1){
  ti[h]=2
  h=h+1
}
while(h!=2001){
  ti[h]=1
  h=h+1
}

  for(j in (1:P)){
    if(ti[j]==0){ k=k+1}
    
    if(ti[j]==1){l=l+1}
    
    if(ti[j]==2){ m=m+1}
    
  }
  nb0[1]=k
  nb1[1]=l
  nb2[1]=m
  k=0
  l=0
  m=0

t=c();

for(v in (2:i)){
  
  for(j in (1:P-2)){
    a=sample(1:P,1);
    b=sample(1:P,1);
    while (b==a){
      b=sample(1:P,1);
    }
    pere=ti[a]
    mere=ti[b]
    if(pere==0 && mere==0){
      t[j]=0
    }
    else if(pere==2 && mere==2){
      t[j]=2
    }
    else
    {
      t[j]=sample(0:2,1)
    }
  }
  
  t[P-1]=0
  t[P]=2
  
  
  for(j in (1:P)){
    if(t[j]==0){ k=k+1}
    
    if(t[j]==1){l=l+1}
    
    if(t[j]==2){ m=m+1}
    
    ti[j]=t[j]
    
  }
  nb0[v]=k
  nb1[v]=l
  nb2[v]=m
  k=0
  l=0
  m=0

}

moy0= sum(nb0)/i
moy1=sum(nb1)/i
moy2=sum(nb2)/i
moy0
## [1] 7.847
moy1
## [1] 4.023
moy2
## [1] 8.13

Le nombre d’individus avec 2 allèles bleus est équivalent à celui avec 2 allèles marrons (environ 8). Cette méthode rajoute un individu pour chaques groupes à allèles identiques, cela rend les groupe BB et MM plus attractifs.

Question 4:

Le résultat de ce devoir est différent de mon intuition initiale. On pourrait faire des testes aves des yeux vert en plus pour voir si un type d’allèle disparaitra avec le temps.