rc— title: “model test” output: html_document —
This file is the data fiddlings for the model built by Nic and Misty to explore the effects of forced renesting on the evolution of nest timing
all<-read.csv(file.choose(),header=T)
all <-read.csv("Results II/raw data _ one sheet.csv", header=TRUE)
names(all)
## [1] "Run" "Year"
## [3] "Population.size" "Proportion.late.nesters"
## [5] "Proportion.wild.born" "File.name"
levels(all$File.name)
## [1] "CP_000" "CP_025" "CP_050" "CP_075"
## [5] "CP_100" "defaults" "EN_025" "EN_075"
## [9] "J_CP_000_RC_00" "J_CP_000_RC_05" "J_CP_000_RC_10" "J_CP_000_RC_15"
## [13] "J_CP_010_RC_00" "J_CP_010_RC_05" "J_CP_010_RC_10" "J_CP_010_RC_15"
## [17] "J_CP_025_RC_00" "J_CP_025_RC_05" "J_CP_025_RC_10" "J_CP_025_RC_15"
## [21] "J_CP_050_RC_00" "J_CP_050_RC_05" "J_CP_050_RC_10" "J_CP_050_RC_15"
## [25] "J_CP_075_RC_00" "J_CP_075_RC_05" "J_CP_075_RC_10" "J_CP_075_RC_15"
## [29] "J_CP_100_RC_00" "J_CP_100_RC_05" "J_CP_100_RC_10" "J_CP_100_RC_15"
## [33] "NP_025" "NP_075" "RC_00" "RC_05"
## [37] "RC_10" "RC_15" "RNP_025" "RNP_075"
max(all$Year)
## [1] 2115
checking to make sure that each of the input files are the right size (i.e., no duplicates)
summary(all$File.name)
Building exploratory plots that show N, prop late nesters, and prop wild born in year 2115 across the different files.
par(mar=c(10,5,5,1))
plot(all$Population.size [all$Year == "2115"] ~ all$File.name [all$Year == "2115"], las=2, xlab="", ylab = "N [yr 100]")
plot(all$Proportion.late.nesters [all$Year == "2115"] ~ all$File.name [all$Year == "2115"], las=2, xlab="", ylab = "proportion late nesters [yr 100]")
plot(all$Proportion.wild.born [all$Year == "2115"] ~ all$File.name [all$Year == "2115"], las=2, xlab="", ylab = "proportion wild born [yr 100]")
These graphs included all populations, even those that were extremely small. The following code allows us to look at parameters in light of pops that didn’t drop below 100. For example, CP_000 had a high prop of late nesters but when we used only pops >100 it fell out.
successful = subset(all, all$Population.size>=100)
plot(successful$Proportion.late.nesters [successful$Year == "2115"] ~ successful$File.name [successful$Year == "2115"], las=2, xlab="", ylab = "prop late nesters [yr 100; N>100]")
plot(successful$Population.size [successful$Year == "2115"] ~ successful$File.name [successful$Year == "2115"], las=2, xlab="", ylab = "N [yr 100; N>100]")
plot(successful$Proportion.wild.born [successful$Year == "2115"] ~ successful$File.name [successful$Year == "2115"], las=2, xlab="", ylab = "prop wild born [yr 100; N>100]")
Thoughts:
We would need to have the RC or CP drop over time to force out the early nesters.
you have to release a few birds or pop crashes - RC_00 is <100
if CP is 0 or 0.1 we don’t get a population < 100
if RC fairly high (10, 15) and have CP start at 0.5 and drop to 0 after 100 years - that would prob work
Here we create vectors for our modifiable parameters and new data frames (the original data frame with all data gave a plot for RNP which the 0.5 had all of the other values combined (e.g., CP = 0, 0.25, 0.5…) which makes the middle box difficult to interpret.)
This code is based on the data frame successful and the graphs use 2115 data only
extract_cp <- function(filename) {
m <- regexec("CP_([0-9]+)", as.character(filename));
if (m[[1]][1] >= 0) {
as.integer(regmatches(filename, m)[[1]][2])/100.0;
} else {
0.5;
}
}
# all$CP <- sapply(all$File.name, extract_cp)
successful$CP <- sapply(successful$File.name, extract_cp)
plot(successful$CP ~ successful$File.name, las=2, xlab="")
just_cp <- subset(successful, successful$File.name == "CP_00" | successful$File.name == "CP_10" | successful$File.name == "CP_025" | successful$File.name == "defaults" | successful$File.name == "CP_075" | successful$File.name == "CP_100")
boxplot(just_cp$Population.size[just_cp$Year=="2115"]~just_cp$CP[just_cp$Year=="2115"], xlab="collection probability", ylab="N", axes=F)
axis(1, at=1:4, lab=c("0.25","0.5","0.75","1.0"))
axis(2)
boxplot(just_cp$Proportion.late.nesters[just_cp$Year=="2115"]~just_cp$CP[just_cp$Year=="2115"], xlab="collection probability", ylab="Proportion of late nesters", axes=F)
axis(1, at=1:4, lab=c("0.25","0.5","0.75","1.0"))
axis(2)
boxplot(just_cp$Proportion.wild.born[just_cp$Year=="2115"]~just_cp$CP[just_cp$Year=="2115"], xlab="collection probability", ylab="proportion of wild born", axes=F)
axis(1, at=1:4, lab=c("0.25","0.5","0.75","1.0"))
axis(2)
extract_en <- function(filename) {
m <- regexec("EN_([0-9]+)", as.character(filename));
if (m[[1]][1] >= 0) {
as.integer(regmatches(filename, m)[[1]][2])/100.0;
} else {
0.5;
}
}
successful$EN <- sapply(successful$File.name, extract_en)
plot(successful$EN ~ successful$File.name, las=2, xlab="")
just_en <- subset(successful, successful$File.name == "EN_025" | successful$File.name == "defaults" | successful$File.name == "EN_075")
boxplot(just_en$Population.size[just_en$Year=="2115"]~just_en$EN[just_en$Year=="2115"], axes=F, xlab = "proportion of early nesters", ylab="N")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_en$Proportion.late.nesters[just_en$Year=="2115"]~just_en$EN[just_en$Year=="2115"], axes=F, xlab = "proportion of early nesters", ylab="proportion of late nesters")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_en$Proportion.wild.born[just_en$Year=="2115"]~just_en$EN[just_en$Year=="2115"], axes=F, xlab = "proportion of early nesters", ylab="proportion of wild born")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
extract_rc <- function(filename) {
m <- regexec("RC_([0-9]+)", as.character(filename));
if (m[[1]][1] >= 0) {
as.integer(regmatches(filename, m)[[1]][2]);
} else {
6;
}
}
# all$RC <- sapply(all$File.name, extract_rc)
successful$RC <- sapply(successful$File.name, extract_rc)
plot(successful$RC ~ successful$File.name, las=2, xlab="")
just_rc <- subset(successful, successful$File.name == "RC_00" | successful$File.name == "RC_05" | successful$File.name == "defaults" | successful$File.name == "RC_10" | successful$File.name == "RC_15")
boxplot(just_rc$Population.size[just_rc$Year=="2115"]~just_rc$RC[just_rc$Year=="2115"], axes=F, xlab = "release count", ylab = "N")
axis(1, at=1:5, lab=c("0","5","6","10", "15"))
axis(2)
boxplot(just_rc$Proportion.late.nesters[just_rc$Year=="2115"]~just_rc$RC[just_rc$Year=="2115"], axes=F, xlab = "release count", ylab = "proportion late nesters")
axis(1, at=1:5, lab=c("0","5","6","10", "15"))
axis(2)
boxplot(just_rc$Proportion.wild.born[just_rc$Year=="2115"]~just_rc$RC[just_rc$Year=="2115"], axes=F, xlab = "release count", ylab = "proportion wild born")
axis(1, at=1:5, lab=c("0","5","6","10", "15"))
axis(2)
extract_np <- function(filename) {
m <- regexec("NP_([0-9]+)", as.character(filename));
if (m[[1]][1] >= 0) {
as.integer(regmatches(filename, m)[[1]][2])/100.0;
} else {
0.5;
}
}
successful$NP <- sapply(successful$File.name, extract_np)
plot(successful$NP ~ successful$File.name, las=2, xlab="")
just_np <- subset(successful, successful$File.name == "NP_025" | successful$File.name == "defaults" | successful$File.name == "NP_075")
boxplot(just_np$Population.size[just_np$Year=="2115"]~just_np$NP[just_np$Year=="2115"], axes=F, xlab = "nesting probability", ylab = "N")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_np$Proportion.late.nesters[just_np$Year=="2115"]~just_np$NP[just_np$Year=="2115"], axes=F, xlab = "nesting probability", ylab = "proportion of late nesters")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_np$Proportion.wild.born[just_np$Year=="2115"]~just_np$NP[just_np$Year=="2115"], axes=F, xlab = "nesting probability", ylab = "proportion wild born")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
extract_rnp <- function(filename) {
m <- regexec("RNP_([0-9]+)", as.character(filename));
if (m[[1]][1] >= 0) {
as.integer(regmatches(filename, m)[[1]][2])/100.0;
} else {
0.5;
}
}
successful$RNP <- sapply(successful$File.name, extract_rnp)
plot(successful$RNP ~ successful$File.name, las=2, xlab="")
just_rnp <- subset(successful, successful$File.name == "RNP_025" | successful$File.name == "defaults" | successful$File.name == "RNP_075")
boxplot(just_rnp$Population.size[just_rnp$Year=="2115"]~just_rnp$RNP[just_rnp$Year=="2115"], axes=F, xlab = "renesting probability", ylab = "N")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_rnp$Proportion.late.nesters[just_rnp$Year=="2115"]~just_rnp$RNP[just_rnp$Year=="2115"], axes=F, xlab = "renesting probability", ylab = "proportion late nesters")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
boxplot(just_rnp$Proportion.wild.born[just_rnp$Year=="2115"]~just_rnp$RNP[just_rnp$Year=="2115"], axes=F, xlab = "renesting probability", ylab = "proportion wild born")
axis(1, at=1:3, lab=c("0.25","0.5","0.75"))
axis(2)
rc_and_cp <- subset(successful, successful$File.name == "defaults" | successful$File.name == "J_CP_000_RC_00" | successful$File.name == "J_CP_000_RC_05" | successful$File.name == "J_CP_000_RC_10" | successful$File.name == "J_CP_000_RC_15"|successful$File.name == "J_CP_010_RC_00"| successful$File.name == "J_CP_010_RC_05"| successful$File.name == "J_CP_010_RC_10" | successful$File.name == "J_CP_010_RC_15"| successful$File.name == "J_CP_025_RC_00" | successful$File.name == "J_CP_025_RC_05" | successful$File.name == "J_CP_025_RC_10" | successful$File.name == "J_CP_025_RC_15" | successful$File.name == "J_CP_050_RC_00" | successful$File.name == "J_CP_050_RC_05" | successful$File.name == "J_CP_050_RC_10" | successful$File.name == "J_CP_050_RC_15" | successful$File.name == "J_CP_075_RC_00" | successful$File.name == "J_CP_075_RC_05" | successful$File.name == "J_CP_075_RC_10" | successful$File.name == "J_CP_075_RC_15" | successful$File.name == "J_CP_100_RC_00" | successful$File.name == "J_CP_100_RC_05" | successful$File.name == "J_CP_100_RC_10" | successful$File.name == "J_CP_100_RC_15")
rc_and_cp_2115 = subset(rc_and_cp, rc_and_cp$Year == 2115)
Below we have the population sizes in the final year for runs that had at least 100 individuals in that year as a function of both RC and CP. It’s clear that to get big final populations (at or near carrying capacity of 300), we want high RC (our maximum value of 15). RC of 10, however, also tends to have strong populations.
library("ggplot2")
## Warning: package 'ggplot2' was built under R version 3.3.2
p <- ggplot(rc_and_cp_2115, aes(RC, CP)) +
geom_tile(aes(fill = Population.size), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue")
p
Proportion of late nesters as a function of RC and CP suggests that we may want a “middling” value of RC (10 in this case) and perhaps a low-to-middling value of CP (0.5 or 0.75). The differences are small enough here, though, that they could be more noise than signal.
q <- ggplot(rc_and_cp_2115, aes(RC, CP)) +
geom_tile(aes(fill = Proportion.late.nesters), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue")
q
The impact of RC and CP on the proportion of wild born is particularly interesting, with the low and middle values of RC (5 and 10) and middle-to-high values of CP (0.5 and 0.75) both leading to higher proportions of wild born.
r <- ggplot(rc_and_cp_2115, aes(RC, CP)) +
geom_tile(aes(fill = Proportion.wild.born), colour = "white") +
scale_fill_gradient(low = "white", high = "steelblue")
r
I (Nic) rather suspect that what we’d want as a management strategy is to start with something like CP=0.5 and RC=10 (or 15) to get the population size up, and then start backing off on those to encourage late nesters. Careful observation would be needed, however, to make sure the population doesn’t start to collapse.