- Árboles filogenéticos cuentan las relaciones evolutivas
- En ACF nos interesa (también) los patrones evolutivos de especies y sus rasgos
- El tiempo (tempo) se refiere a la tasa evolutiva
- El modo describe los mecanismos evolutivos subyacentes
06 04 2016
Tiempo
Modo
En términos evolutivos:
En términos evolutivos:
Varios procesos no selectivos pueden asemejar evolución por MB:
Evolución por movimiento es básicamente la acumulación de cambios con generados en forma aleatoria
t <- 100 sig2 <- 0.1 nsimul <- 100 mb<-rnorm(t, mean=0, sd=sqrt(sig2)) hist(mb, main = "Disrtubucion de cambios en MB")
bmt <- cumsum(mb) plot(bmt, type="l", xlab ="Tiempo (generaciones)", ylab = "Rasgo")
plot(cumsum(rnorm(t, mean=0, sd=sqrt(sig2))), type="l", ylim=c(-30,30), ylab="Rasgo", xlab = "Tiempo") lines(cumsum(rnorm(t, mean=0, sd=sqrt(sig2))), col="red") lines(cumsum(rnorm(t, mean=0, sd=sqrt(sig2))), col="blue") lines(cumsum(rnorm(t, mean=0, sd=sqrt(sig2))), col="green")
t <- 1000 mbsims <- replicate(t, cumsum(rnorm(t, mean=0, sd=sqrt(sig2)))) matplot(mbsims, type = "l", col = 1, main = "MB",ylab="Rasgo", xlab = "Tiempo")
Histograma de la variacion en cada generacion en MB
Histograma del estado final de 100 rasgos con evolución MB
Crear un arbol filogenetico
require(phytools, quietly = T)
## ## # maps v3.1: updated 'world': all lakes moved to separate new # ## # 'lakes' database. Type '?world' or 'news(package="maps")'. #
t <- 100 n <- 30 sig2 = 0.1 arbol<-pbtree(b=(log(n)-log(2))/t ,n=n,t=t,type="discrete")
## simulating with both taxa-stop (n) and time-stop (t) is ## performed via rejection sampling & may be slow ## ## 121 trees rejected before finding a tree
Simular un rasgo con un modelo browniano
plot(arbol)
n <- 10 arbol<-pbtree(b= (log(n)-log(2))/t ,n=n,t=t,type="discrete")
## simulating with both taxa-stop (n) and time-stop (t) is ## performed via rejection sampling & may be slow ## ## 2 trees rejected before finding a tree
rasgoMB<-fastBM(arbol, sig2=sig2, internal=TRUE) phenogram(arbol, rasgoMB, spread.labels=TRUE, spread.cost=c(1,0), ylab = "Rasgo", xlab = "Tiempo")
Graficar un fenograma (rasgo + filogenia)
rasgoMB<-fastBM(arbol, sig2=sig2, internal=TRUE) phenogram(arbol, rasgoMB, spread.labels=TRUE, spread.cost=c(1,0), ylab = "Rasgo", xlab = "Tiempo")
sim.ou = function(t, alpha, sig2) { x.ou = numeric(t) for (i in 2:t) x.ou[i] = x.ou[i - 1] + rnorm(1, mean=0, sd=sqrt(sig2)) - (alpha * x.ou[i - 1]) return(x.ou) } ou.1 <- replicate(1000, sim.ou(t = 100, alpha = 1, sig2 = 0.5)) ou.0.5 <- replicate(1000, sim.ou(t = 100, alpha = 0.5, sig2 = 0.5)) ou.0.25 <- replicate(1000, sim.ou(t = 100, alpha = 0.25, sig2 = 0.5)) ou.0.1 <- replicate(100, sim.ou(t = 100, alpha = 0.1, sig2 = 0.5))
par(mfrow = c(2,2), mar = rep(2, 4)) matplot(ou.1, type = "l", col = 1, main = "alpha = 1", ylim = c(-5, 5)) matplot(ou.0.5, type = "l", col = 1, main = "alpha = 0.5", ylim = c(-5, 5)) matplot(ou.0.25, type = "l", col = 1, main = "alpha = 0.25", ylim = c(-5, 5)) matplot(ou.0.1, type = "l", col = 1, main = "alpha = 0.1", ylim = c(-5, 5))
ou.0.01 <- replicate(1000, sim.ou(t = 100, alpha = 0.01, sig2 = 0.5)) ou.0.001 <- replicate(1000, sim.ou(t = 100, alpha = 0.001, sig2 = 0.5)) ou.0 <- replicate(1000, sim.ou(t = 100, alpha = 0, sig2 = 0.5)) mb <- replicate(1000, cumsum(rnorm(n = 100, mean=0, sd=sqrt(0.5))))
par(mfrow = c(2,2), mar = rep(2, 4)) matplot(ou.0.01, type = "l", col = 1, main = "alpha = 0.01", ylim = c(-30, 30)) matplot(ou.0.001, type = "l", col = 1, main = "alpha = 0.001", ylim = c(-30, 30)) matplot(ou.0, type = "l", col = 1, main = "alpha = 0", ylim = c(-30, 30)) matplot(mb, type = "l", col = 1, main = "MB", ylim = c(-30, 30))
rasgoOU<-fastBM(arbol,alpha=0.2,sig2=0.1, internal=TRUE)
## Warning: alpha but not theta specified in OU model, setting theta to a.
phenogram(arbol,rasgoOU,spread.labels=TRUE,spread.cost= c(1,0.01))
OU vs MB
par(mfrow= c(1,2)) phenogram(arbol,rasgoOU,spread.labels=TRUE,spread.cost= c(1,0.01), main = "OU") rasgoMB2<-fastBM(arbol, sig2=0.1, internal=TRUE) phenogram(arbol,rasgoMB2,spread.labels=TRUE,spread.cost= c(1,0.01), main = "MB")
OU vs MB