* [[en:ecovirt:roteiro:den_ind:di_edrcmdr|{{:ecovirt:logorcmdr01.png?20|}}]] * [[en:ecovirt:roteiro:den_ind:di_edr|{{:ecovirt:rlogo.png?20|}}]] * [[en:ecovirt:roteiro:den_ind:di_edr_passo|{{:ecovirt:prompt.png?20|}}]] ====== Density-independent population dynamics with demographic stochasticity - Tutorial in R ====== {{section>en:ecovirt:roteiro:den_ind:di_ed_base#density-independent_population_dynamics_with_demographic_stochasticity}} ====The binomial distribution==== {{section>en:ecovirt:roteiro:avisos#roteiro_r}} Let us get acquainted with the idea of a probability distribution, by calculating values from the binomial distribution. Below, we have te R code to make the plots of the binomial distribution mass function: x <- 0:10 # x axis of the plot plotDistr(x, dbinom(x, size=10, prob=0.5), xlab="Number of Successes", ylab="Probability Mass", main="Binomial Distribution: Binomial trials=10, Probability of success=0.5", discrete=TRUE) $dbinom$ is the function to calculate the density probability of success of each trial. $size$ is the number of trials, in our case $N_0$. $prob$ is the probability of sucess in each trial, in our case the probability of survival of each individual. Let's make the plot: - in $size$ use $2$ - in $prob$ use $0.5$ - run the code {{section>en:ecovirt:roteiro:den_ind:di_ed_base#the_binomial_distribution}} ==== Computer simulation ==== {{section>en:ecovirt:roteiro:den_ind:di_ed_base#computer_simulation}} We will use the function $estDem$ from **EcoVirtual** package. {{section>en:ecovirt:roteiro:den_ind:di_ed_base#parametros}} ==== Population size distribution ==== Let's inspect the distribution of the population sizes in the time $t=2$. To do this, we need to store the simulations in an R object. Run more simulations after setting the following options: # store the results in the object sim1 tmax = 2 nsim = 1000 N0 = 20 b = 0 d = 0.693 The results will be stored as a list of 1000 tables in R, called ''sim1''. Each table contains the times in which the population lost an individual and the size of the population after that time, up to the maximum time set in the options window. To see the first table, close the simulation window, copy the following command to the ''Script'' window of the Rcmdr and click ''Submit'' sim1[[1]] The table will be written on the window ''Output''. Inspect the other tables: run the same command again, now changing the numeric index inside the double brackets to any other value between one and one thousand. {{section>en:ecovirt:roteiro:den_ind:di_ed_base#population_size_distribution}} ===== Births and deaths ===== {{section>en:ecovirt:roteiro:den_ind:di_ed_base#births_and_deaths}} ===== To learn more ===== {{section>en:ecovirt:roteiro:den_ind:di_ed_base#to_learn_more}} {{tag>R uma_população crescimento_exponencial tempo_discreto estocasticidade_demográfica}}