Bt = bt * Nt & Dt = dt * Nt
library(ggplot2)
#Birth and Death Rates
b <- 1.25 #per capita birth rate
d <- 0.5 #per capita death rate
#number of individuals born at time Nt
geom.df$totalBirths <- geom.df$Nt*b
#number of individuals that die at time Nt
geom.df$totalDeaths <- geom.df$Nt*d
#graph births and deaths
geom.df.tmp <- melt(geom.df, id= c("t")) #long form data
geom.dfGraph <- subset(geom.df.tmp, variable == "totalBirths" | variable == "totalDeaths")
names(geom.dfGraph) <- c("t", "variable", "population")
p <- ggplot(geom.dfGraph, aes(x= t, y= population, color= variable))
p+ theme_classic() + geom_line() + geom_point()Figure: Graph showing population deaths and births throughout time.
The population at first was remaining stable but then started growing. The total birthrate after time t=10, the total birthrate began being greater than the total deathrate.
###changing the birthrate to 0.75 and the death rate to 0.85
b2 <- 0.75 #per capita birth rate
d2 <- 0.85 #per capita death rate
#number of individuals born at time Nt
geom.df$totalBirths2 <- geom.df$Nt*b2
#number of individuals that die at time Nt
geom.df$totalDeaths2 <- geom.df$Nt*d2
#graph births and deaths
geom.df.tmp2 <- melt(geom.df, id= c("t")) #long form data
geom.dfGraph2 <- subset(geom.df.tmp2, variable == "totalBirths2" | variable == "totalDeaths2")
names(geom.dfGraph2) <- c("t", "variable", "population")
p <- ggplot(geom.dfGraph2, aes(x= t, y= population, color= variable))
p+ theme_classic() + geom_line() + geom_point()Figure: Graph showing population deaths and births throughout time.
In this graph, the population is remaining stable with a slight increase because total birth rate is slightly higher than total death rate from time t=15 to time t=20.
#calculate R and lambda
#birth and death rates
birth <- 1.25
death <- 0.5
R <- birth - death #per capita rate increase
#lamba
lambda <- (R +1)
#column for the population size at Nt + 1
geom.df$Nt1 <- lead(geom.df$Nt, n=1L)
#calculates lambda at each time period
geom.df$lambda <- geom.df$Nt1 / geom.df$Nt
mean(geom.df$lambda, na.rm = TRUE)## [1] 1.75
timeInterval_t <- 21 #time interval of interest
#formula note: geom.df[1, "Nt"] = [1st row, second column]
#initial pop size (No)
pop_size_Nt <- geom.df[1, "Nt"] * lambda ^ timeInterval_t
pop_size_Nt # population size at t= 21## [1] 126998.6
timeInterval_t2 <- 40 #time interval of interest
#formula note: geom.df[1, "Nt"] = [1st row, second column]
#initial pop size (No)
pop_size_Nt2 <- geom.df[1, "Nt"] * lambda ^ timeInterval_t2
pop_size_Nt2 # population size at t= 40## [1] 5266498289
The size of the population at t=21 is 126,998.6 and at t=40 the population size is 5,266,498,289.
Bunnies on Loyola’s campus exhibit exponential growth, meaning that they do not have designated breeding times and breed throughout the year. This is an advantage for the bunnies because if they are exposed to new predators, they can still repopulate fast. Another example is humans, because they breed throughout the year. An advantage to this is when there is a disease outbreak, humans dont have to wait for their breeding time during the year to introduce genetic diversity to the gene pool. It gives them a better change of surviving a disease outbreak.
#input variables
No <- 100 #initial pop size
R2 <- 0.5 #geometric growth rate
lambda <- R + 1 #lambda
r2 <- 0.5 #constant growth rate
#creates datafram with time interval to 25
comparison <- data.frame(t= 0:25)
#calculate pop size (geomNt) for the geometric model:
comparison$geomNt <- No * (lambda)^(comparison$t)
#calculates pop size (exPt) for the continuous model:
#Nt= No * exp(r2*t)
comparison$expNt <- No * exp(r2 * comparison$t)
#graph the data
comparison.tmp <- melt(comparison, id = c("t"))
comparisonGraph <- subset(comparison.tmp, variable == "geomNt" | variable == "expNt")
names(comparisonGraph) <- c("t", "variable", "population")
p2 <- ggplot(comparisonGraph, aes(x= t, y= population, color= variable))
p2 + theme_classic() + geom_line() + geom_point()Figure: This is a graph displaying the exponential and geometric growth rates for the population over time.
The exponential growth model is experiencing faster population growth, which makes sense because there are no specific breeding times for organisms that display such growth. They are able to breed throughout the year, so it makes sense that the exponential growth model experiences a faster population growth rate.
#doubling time
R3 <- 0.5 #geometric growth rate
lambda2 <-R3 + 1
r3 <- 0.5 #continuous growth rate
doubleGeom <- log(2)/log(lambda2)
doubleGeom## [1] 1.709511
doubleExp <- log(2)/r3
doubleExp## [1] 1.386294
K <- 1000 #carrying capacity
No <- 100 #Initial population size
#Calculating pop size (logNt) with carrying capacity
#Nt = K / (1 + ((K- No) / No ) * exp (-r * compare.df$t))
comparison$logNt <- K / (1 + ((K - No) / No) * exp(-r3 * comparison$t))
carryCapGraph.tmp <- melt(comparison, id = c("t"))
carryCapGraph <- subset(carryCapGraph.tmp, variable == "logNt" | variable == "expNt")
names(carryCapGraph) <- c("t", "variable", "data")
p3 <- ggplot(carryCapGraph, aes(x = t, y = data, color = variable))
p3 + theme_classic() + geom_line() + geom_point()Figure: This is a graph displaying exponential growth and logistic growth for the population over time.
Exponential growth is so much greater than logistic growth that this kind of graph is expected. Exponential growth models assume growth until infinity, so it would make sense that it is so much greater than a logistic growth model that is a density dependent model that does not assume growth until infinity.
world <- read.csv("/Users/nicole/Documents/ENVS 321/world_population_SP17.csv")
#Create the Nt +1 column
world$Nt1 <- lead(world$Nt, n= 1L)
#calculate the instantaneous rate of increase for each time interval
world$r9 <- log(world$Nt1/world$Nt)
#create a new column to predict the population size
world$predict <- NA
#use the 1950 population size as a starting point
world[1, "predict"] <- world[1, "Nt"]
#per capita rate of increase in 1950
r9 <- world[1, "r9"]
#Predict population growth
#Nt = No * exp(r9*t)
world[2:151, "predict"] <- world[1, "predict"] * exp(r9 * world[2:151, "t"])
#GRAPHING
world.Graphtmp <- melt(world, id = c("t", "year", "r9"))
worldGraph <- subset(world.Graphtmp, variable == "Nt" | variable == "predict")
head(worldGraph)## t year r9 variable value
## 1 0 1950 0.01846519 Nt 2525778669
## 2 1 1951 0.01788949 Nt 2572850917
## 3 2 1952 0.01762465 Nt 2619292068
## 4 3 1953 0.01758971 Nt 2665865392
## 5 4 1954 0.01771024 Nt 2713172027
## 6 5 1955 0.01791509 Nt 2761650981
#Divide the population by 1 billion
worldGraph$PopSizeBillion <- worldGraph$value / 1e+09
p9 <- ggplot(worldGraph, aes(x = year, y = PopSizeBillion, color = variable))
p9 +theme_classic() + geom_line() + geom_point()Figure: This is a graph showing predicted population growth over time.
The blue line displays the population growing, assuming there will be no limits to the population while the coral line displays the population growing, assuming the population will hit carrying capacity. I think the coral curve is most realistic because populations will always reach carrying capacity at some point so this curve is much more realistic.
#doubling time formula
world$doubletime<- log(2)/world$r9In 1950, the time it takes to double the population at that time would be 37.5 years. In 1980, the time it takes to double the population at that time would be 39.3 years. In 2010, the time it takes to double the population at that time would be 58.9 years. In 2030, the time it takes to double the population at that time would be 89.5 years. Over time, it takes longer to double the population. I believe this may be because once the population gets closer to its carrying capacity, it takes longer to increase in size.
us <- read.csv("/Users/nicole/Documents/ENVS 321/us_population_sp17.csv")
us$website <- NULL
us$notes <- NULL
usgraph <- ggplot(us, aes(x = year, y = population))
usgraph + theme_classic() + geom_line() + geom_point(size= 0.4, colour="yellowgreen") + ylab ("population size") + xlab("year") + ggtitle("US Population Between 1776-2010") + theme(plot.background = element_rect(fill = 'darkolivegreen3', colour = 'lightsteelblue'))Figure: Graph displaying the US population between 1776-2010.
us$Nt1 <- lead(us$population, n= 1L)
us$r <- log((us$Nt1/ us$population))
USgraph <- ggplot(us, aes(x = year, y = r))
USgraph + theme_classic() + geom_point(size= 0.4, colour="cyan3") + ylab ("rate of population increase") + xlab("year") + ggtitle("US Population Rate of Increase Between 1776-2010") + geom_line(size= 0.1, colour="cyan3")Figure: A graph displaying the rate of increase of the US population between 1776-2010.
#doubling time formula
us$doubletime <- log(2)/us$r1800- 22.33804 | 1900- 35.74434 | 2000- 67.56717
Overall, I can conclude that over time the population rate of increase between 1776-2010 has declined. Also, overtime the estimated doubling time has increased overtime, meaning that as time goes on it takes longer for the population to double in its present population at that time. Since 1776, the US population has exhibited exponential growth but I believe the population will start to level out and come close to reaching carrying capacity within the next 100 years.