This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:ecovirt:roteiro:den_ind:di_tdr_passo [2022/09/15 13:45] adalardo [Projetando a População] |
en:ecovirt:roteiro:den_ind:di_tdr_passo [2022/09/15 13:59] (current) adalardo [Desafio] |
||
---|---|---|---|
Line 70: | Line 70: | ||
plot(tseq, Nseq, type="l") | plot(tseq, Nseq, type="l") | ||
</code> | </code> | ||
- | Mais sobre o texto originalÉ necessário fornecer o texto original para ver mais informações sobre a tradução | + | |
- | ===== Tamanho Inicial ===== | + | ===== Initial Size ===== |
- | Vamos agora explorar o tamanho inicial da população. | + | Let's now explore the initial population size. |
- | * $N_0 = 10,20,30, 40 $ | + | * $N_0 = 10,20,30, 40$ |
- | * $\lambda = 1,5$ | + | * $\lambda = 1.5$ |
- | * $ tempo = 1:10$ | + | * $time = 1:10$ |
<code> | <code> | ||
Line 88: | Line 88: | ||
colnames(Nt)<-paste("t", 0:10, sep="") | colnames(Nt)<-paste("t", 0:10, sep="") | ||
rownames(Nt)<-paste("N0", c(10,20,30,40), sep="_") | rownames(Nt)<-paste("N0", c(10,20,30,40), sep="_") | ||
- | Nt | + | nt |
matplot(0:10,t(Nt)) | matplot(0:10,t(Nt)) | ||
</code> | </code> | ||
- | Vamos agora colocar o mesmo gráfico em uma escala logarítmica para o eixo y. | + | Let's now put the same graph on a logarithmic scale for the y-axis. |
<code> | <code> | ||
par(mfrow=c(1,2)) | par(mfrow=c(1,2)) | ||
Line 99: | Line 99: | ||
</code> | </code> | ||
- | O que está acontecendo?? Parece que todas as populações crescem igualmente quando estamos em uma escala logarítmica! | + | What's up?? It seems that all populations grow equally when we are on a logarithmic scale! |
- | Vamos investigar a equação que estamos usando, $N_t=\lambda^T N_0$ e tirar o log dos dois lados da equação: | + | Let's investigate the equation we are using, $N_t=\lambda^T N_0$ and take the log of both sides of the equation: |
* $log{N_T} = log{\lambda^T N_0}$ | * $log{N_T} = log{\lambda^T N_0}$ | ||
* $ log{N_T} = (log{\lambda}) T + log{N_0} $ | * $ log{N_T} = (log{\lambda}) T + log{N_0} $ | ||
- | Essa equação lembra uma equação da reta $ y=ax+b $, onde o intercepto é $log(N_0)$ e a inclinação é iqual a $log{\lambda}$. | + | This equation resembles an equation of the line $ y=ax+b $, where the intercept is $log(N_0)$ and the slope is equal to $log{\lambda}$. |
- | ==== Desafio ==== | + | ==== Challenge ==== |
- | * Demonstre graficamente que a inclinação das populações do exemplo acima são iguais a $log{\lambda}$. | + | * Graphically show that the slope of the populations in the example above is equal to $log{(\lambda)}$. |
+ | ===== Average Population Growth ===== | ||
+ | {{:ecovirt:roteiro:den_ind:pardal.jpg?200 |}} | ||
- | ===== Média do Crescimento Populacional ===== | + | We will now investigate the population size data of a North American sparrow species (//Melopiza melody//) starting from the premise that this population grows in discrete time, since births occur in a short period of nesting time every year. |
- | {{pardal.jpg?200 |}} | + | |
- | Vamos agora investigar os dados do tamanho populacional de uma espécie de pardal norte-americano (//Melopiza melodia//) partindo da premissa que essa população cresce em tempo discreto, já que os nascimentos ocorrem em um intervalo curto de tempo de nidificação a cada ano. | + | |
<box 320 green> | <box 320 green> | ||
- | {{parda.png?300 |}} | + | {{:ecovirt:roteiro:den_ind:parda.png?300 |}} |
- | O gráfico representa a contagem de pardais cantores na cidade de Darrtown, OH, USA. | + | The graph represents the singing sparrow count in the city of Darrtown, OH, USA. |
- | Baixe os dodos do arquivo {{pardal.txt|}} no seu computador. | + | Download the data from the file {{:ecovirt:roteiro:den_ind:pardal.txt|}} on your computer. |
</box> | </box> | ||
- | Vamos calcular os $\lambda$ para os cinco primeiros intervalos: | + | Let's calculate the $\lambda$ for the first five intervals: |
<code> | <code> | ||
- | pardal<-read.table("pardal.txt", header=TRUE, sep="\t", as.is=TRUE) | + | sparrow<-read.table("sparrow.txt", header=TRUE, sep="\t", as.is=TRUE) |
- | str(pardal) | + | str(sparrow) |
- | head(pardal) | + | head(sparrow) |
- | pardal6= pardal[1:6,] | + | sparrow6= sparrow[1:6,] |
- | plot(pardal6$Count ~pardal6$Year) | + | plot(sparrow6$Count ~sparrow6$Year) |
lamb_pardal=pardal6$Count[2:6]/pardal6$Count[1:5] | lamb_pardal=pardal6$Count[2:6]/pardal6$Count[1:5] | ||
- | lamb_pardal | + | lamb_sparrow |
</code> | </code> | ||
- | Agora, vamos calcular a projeção da população pela média aritmética e geométrica dos $\lambda$ e desenhar as projeções junto com os dados observados! | + | Now, let's calculate the population projection by the arithmetic and geometric mean of the $\lambda$ and draw the projections along with the observed data! |
<code> | <code> | ||
- | #media aritmetica | + | #arithmetic average |
(lamb.art = mean(lamb_pardal)) | (lamb.art = mean(lamb_pardal)) | ||
- | #media geometrica | + | #geometric average |
(lamb.geo = prod(lamb_pardal)^(1/5)) | (lamb.geo = prod(lamb_pardal)^(1/5)) | ||
tseq=0:5 | tseq=0:5 | ||
- | plot(tseq, pardal6$Count, pch=19) | + | plot(tseq, sparrow6$Count, pch=19) |
- | N0=pardal6$Count[1] | + | N0=sparrow6$Count[1] |
- | lines(tseq, N0*lamb.art^tseq, lty=2, col="red") | + | lines(tseq, N0*lamb.art^tseq, lty=2, col="red") |
- | lines(tseq, N0*lamb.geo^tseq, lty=3, col="blue") | + | lines(tseq, N0*lamb.geo^tseq, lty=3, col="blue") |
</code> | </code> | ||
- | * Qual das duas médias parece se ajustar melhor aos dados observados? Por quê? | + | * Which of the two means seems to fit the observed data better? Why? |
+ | ==== Discrete Time Growth ==== | ||
- | ==== Crescimento Discreto ==== | + | Below is the code of a base function for projecting the growth of a population, which can be used as a basic structure for other functions that we will develop in the course. In this case, it is a function with 3 arguments: number of individuals at time 0 (N0), population growth rate (lamb) and maximum time (tmax) of population projection. |
- | + | ||
- | Abaixo tem o código de uma função base para a projeção do crescimento de uma população, que pode ser usada como estrutura básica para outras funções que iremos desenvolver no curso. No caso, é uma funcão com 3 argumentos: número de indivíduos no tempo 0 (N0), taxa de crescimento populacional (lamb) e o tempo máximo (tmax) de projeção da população. | + | |
<code> | <code> | ||
cresc.geom= function(No=100, lamb=1.04, tmax=10) | cresc.geom= function(No=100, lamb=1.04, tmax=10) | ||
{ | { | ||
- | resulta <- rep(NA,tmax) | + | result <- rep(NA,tmax) |
- | resulta[1] <- No | + | result[1] <- No |
- | for (i in 2:tmax) | + | for (i in 2:tmax) |
- | { | + | { |
- | tam=resulta[i-1]*lamb | + | tam=result[i-1]*lamb |
- | resulta[i]=tam | + | result[i]=tam |
- | } | + | } |
- | return(resulta) | + | return(result) |
} | } | ||
</code> | </code> | ||
- | Ao copiar esse código na área de trabalho do R, um novo objeto é criado, de nome //cresc.geom//. Ele é um objeto da classe função que você pode usá-lo digitando o seu nome e especificando seus argumentos, como no exemplo a seguir: | + | By copying this code to the R desktop, a new object is created, named //cresc.geom//. It is an object of the function class that you can use it by typing its name and specifying its arguments, as in the following example: |
- | <code> | + | <code> |
- | resultado <- cresc.geom(No=10, lamb=0.98, tmax=100) | + | result <- cresc.geom(No=10, lamb=0.98, tmax=100) |
</code> | </code> | ||
- | Note que o resultado da função, nesse caso, será guardado no objeto //resultado//. Para fazer um gráfico dos resultados pode utilizar o código abaixo: | + | Note that the result of the function, in this case, will be stored in the object //result//. To graph the results you can use the code below: |
- | + | ||
- | plot(1:length(resultado), resultado) | + | |
- | + | ||
- | ===== Estocasticidade Ambiental ===== | + | plot(1:length(result), result) |
- | Flutuações ambientais podem exercer efeito na taxa de crescimento instantâneo da população. De uma forma simples, podemos imaginar que essa variação funcione como um ruído no //r//, como se a população em média tivesse uma taxa, mas a cada realização ela pudesse ser um tanto diferente devido a condições externas a ela própria. A implementação dessa estocasticidade ambiental em modelos contínuos é um pouco mais complicada, mas podemos imaginá-la como realizações em algum intervalo pequeno de tempo. | + | ===== Environmental Stochasticity ===== |
- | Para um crescimento discreto a construção de simulações com estocasticidade ambiental é mais intuitivo: a cada realização o Lambda é afetado pela variação ambiental. Vamos fazê-la. | + | Environmental fluctuations can have an effect on the instantaneous population growth rate. In a simple way, we can imagine that this variation works like a noise in //r//, as if the population on average had a rate, but at each realization it could be somewhat different due to conditions external to itself. The implementation of this environmental stochasticity in continuous models is a little more complicated, but we can imagine it as realizations in some small time interval. |
+ | For a discrete growth, the construction of simulations with environmental stochasticity is more intuitive: at each realization the Lambda is affected by the environmental variation. Let's do it. | ||
<code> | <code> | ||
Line 196: | Line 191: | ||
matplot(0:5, Nt, type="l", lty=2:7) | matplot(0:5, Nt, type="l", lty=2:7) | ||
</code> | </code> | ||
+ | ==== Challenge ==== | ||
- | ==== Desafio ==== | + | It is possible to adapt our previous discrete growth function so that it can also model populations with environmental stochasticity! |
- | É possível adaptar a nossas função anterior de crescimento discreto para que possa também modelar populações com estocasticidade ambiental! | + | <box 70% green |Tips> |
- | + | The first step is always to think about what arguments we will need | |
- | <box 70% green |Dicas> | + | In this case, we only have one more argument o **//lamb.dp//** : the standard deviation of //lambda//. The rest remains the same, remember that if **//lamb.dp//** is 0, our population is deterministic! That is, the same function can be used to simulate both scenarios. |
- | O primeiro passo sempre e pensar quais argumentos vamos precisar | + | |
- | Nesse caso, temos apenas mais um argumento o **//lamb.dp//** : o desvio padrão de //lambda//. O resto continua o mesmo, lembre-se que se o **//lamb.dp//** for 0, nosso população é determinística! Ou seja, a mesma função pode se prestar para simular ambos cenários. | + | |
</box> | </box> | ||
- | {{tag>R uma_população crescimento_exponencial tempo_discreto tempo_contínuo estocasticidade_ambiental}} | + | {{tag>R a_population exponential_growth discrete_time continuous_time stochasticity_environmental}} |