Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/timcdlucas/PhDThesis
Browse files Browse the repository at this point in the history
  • Loading branch information
timcdlucas committed Jul 28, 2016
2 parents 2cbec8c + ae87ba0 commit 213d951
Show file tree
Hide file tree
Showing 23 changed files with 5,306 additions and 539 deletions.
15 changes: 8 additions & 7 deletions Appendix2.Rtex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ saveData <- TRUE

%%end.rcode

%%begin.rcode libs
%%begin.rcode libs, cache = FALSE

library(MetapopEpi)
library(cowplot)
Expand Down Expand Up @@ -322,8 +322,9 @@ noInvade1 <- pSIR(p1) +
guides(colour=guide_legend(title = '')) +
theme(legend.text.align = 0) +
xlab('Time (years)') +
xlim(0, maxt)
pop1 <- pPop(p1) + theme_tcdl + xlab('Time (years)') + xlim(0, maxt)
scale_x_continuous(breaks = c(0, 20, 40, 60, 80), limits = c(0, maxt))

pop1 <- pPop(p1) + theme_tcdl + xlab('Time (years)') + scale_x_continuous(breaks = c(0, 20, 40, 60, 80), limits = c(0, maxt))



Expand All @@ -337,8 +338,8 @@ noInvade2 <- pSIR(p2) +
guides(colour=guide_legend(title = '')) +
theme(legend.text.align = 0) +
xlab('Time (years)') +
xlim(0, maxt)
pop2 <- pPop(p2) + theme_tcdl + xlab('Time (years)') + xlim(0, maxt)
scale_x_continuous(breaks = c(0, 20, 40, 60, 80), limits = c(0, maxt))
pop2 <- pPop(p2) + theme_tcdl + xlab('Time (years)') + scale_x_continuous(breaks = c(0, 20, 40, 60, 80), limits = c(0, maxt))


# Combine and print the plots.
Expand Down Expand Up @@ -456,7 +457,7 @@ fullSim <- function(x){
}
%%end.rcode

%%begin.rcode runDispSim, eval = TRUE, cache = TRUE
%%begin.rcode runDispSim, eval = runSims, cache = TRUE

# Create and set seed (seed object is used to set seed in each seperate simulation.'
seed <- 33355
Expand Down Expand Up @@ -571,7 +572,7 @@ fullSim <- function(x){
}
%%end.rcode

%%begin.rcode runTopoSim, eval = TRUE, cache = TRUE
%%begin.rcode runTopoSim, eval = runSims, cache = TRUE

# Create and set seed (seed object is used to set seed in each seperate simulation.'
seed <- 1230202
Expand Down
266 changes: 266 additions & 0 deletions Appendix2.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
%--------------------------------------------------------------------------------------------------------------------------------%
% Code for "Appendix C: Understanding how population structure affects pathogen richness in a mechanistic model of bat populations"
% Appendix for Chapter 3 of thesis "The role of population structure and size in determining bat pathogen richness"
% by Tim CD Lucas
%
% NB The file is numbered Appendix2 as Chapter 3 was previously Chapter 2 in the thesis.
%
%---------------------------------------------------------------------------------------------------------------------------------%


















% --------------------------------------------------------------------------- %
% Invading pathogen plots
% --------------------------------------------------------------------------- %




\begin{knitrout}\footnotesize
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]

{\centering \includegraphics[width=\textwidth]{figure/A-plotsInvade-1}

}

\caption[
Examples of simulated SIR dynamics with successfull invasions
]{
Two examples (A and B) of a successful invasion plotted on a logged $y$-axis.
The lines are coloured such that blue represents susceptibles, brown represents individuals infected with one pathogen (the two seperate brown lines are Pathogen 1 and 2), black represents co-infected individuals and yellow represents recovered and immune individuals.
Pathogen 2 is seeded after \SI{300000} events (approximately 30 years).
Simulations are run on a fully-connected network.
Parameter values are: dispersal rate = 0.1, transmission rate = 0.2.
All other parameters are as stated in Table~\ref{t:params}.
}\label{fig:plotsInvade}
\end{figure}


\end{knitrout}



% --------------------------------------------------------------------------- %
% No invasion plots
% --------------------------------------------------------------------------- %







\begin{knitrout}\footnotesize
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]

{\centering \includegraphics[width=\textwidth]{figure/A-plotsNoInvade-1}

}

\caption[
Examples of simulated SIR dynamics with unsuccessfull invasions
]{
Two examples (A and B) of an unsuccessful invasion plotted on a logged $y$-axis.
The lines are coloured such that blue represents susceptibles, brown represents individuals infected with one pathogen (the two separate brown lines are Pathogen 1 and 2), black represents co-infected individuals and yellow represents recovered and immune individuals.
Pathogen 2 is seeded after \SI{300000} events (approximately 30 years).
It can be seen that after seeding Pathogen 2, there is a very short period before extinction as opposed to a long fade out of disease.
Simulations are run on a fully-connected network.
Parameter values are: dispersal rate = 0.1, transmission rate = 0.2.
All other parameters are as stated in Table~\ref{t:params}.
}\label{fig:plotsNoInvade1}
\end{figure}

\begin{figure}[t]

{\centering \includegraphics[width=0.8\textwidth]{figure/A-plotsNoInvade-2}

}

\caption[
Examples of colony size dynamics
]{
Two examples (A and B) of the change in colony sizes throughout a simulation (note the truncated $y$-axis).
The size of each colony changes as a random walk.
However, given the length of the simulations, there is little risk of colonies going extinct or becoming very large.
Birth and death rate are equal and set to 0.05, giving a generation time of 20 years.
The metapopulation network is fully-connected and the dispersal rate is 0.1 per year.
The starting colony size is \SI{3000}.
}\label{fig:plotsNoInvade2}
\end{figure}


\end{knitrout}














% ------------------------------------------------------------------ %
% Topology Sims
% ------------------------------------------------------------------ %

















% ------------------------------------------------ %
% Raw data tables
% ------------------------------------------------ %








































\clearpage
% latex table generated in R 3.3.1 by xtable 1.8-2 package
% Mon Jul 25 00:04:16 2016
\begin{table}[ht]
\centering
\caption[
Raw data for dispersal simulations
]{
Raw data for dispersal simulations.
The relevant parameters are shown along with the number of invasions and the number of simulations.
$\beta$ is the transmission rate.
}
\label{B-disp}
\begingroup\small
\begin{tabular}{@{}rrrr@{}}
\toprule
$\beta$ & Dispersal & Invasions & Sims \\
\midrule
0.1 & 0.000 & 0 & 100 \\
0.1 & 0.001 & 1 & 101 \\
0.1 & 0.010 & 0 & 100 \\
0.1 & 0.100 & 0 & 99 \\
0.2 & 0.000 & 4 & 100 \\
0.2 & 0.001 & 42 & 126 \\
0.2 & 0.010 & 41 & 126 \\
0.2 & 0.100 & 63 & 123 \\
0.3 & 0.000 & 47 & 100 \\
0.3 & 0.001 & 113 & 125 \\
0.3 & 0.010 & 113 & 126 \\
0.3 & 0.100 & 112 & 124 \\
0.4 & 0.000 & 75 & 100 \\
0.4 & 0.001 & 96 & 100 \\
0.4 & 0.010 & 98 & 100 \\
0.4 & 0.100 & 96 & 100 \\
\bottomrule
\end{tabular}
\endgroup
\end{table}





% latex table generated in R 3.3.1 by xtable 1.8-2 package
% Mon Jul 25 00:04:16 2016
\begin{table}[ht]
\centering
\caption[
Raw data for topology simulations
]{
Raw data for topology simulations.
The relevant parameters are shown along with the number of invasions and the number of simulations.
$\beta$ is the transmission rate.
}
\label{B-topo}
\begingroup\small
\begin{tabular}{@{}rllr@{}}
\toprule
$\beta$ & Topology & Invasions & Sims \\
\midrule
0.1 & Unconnected & 0 & 100 \\
0.1 & Minimally & 1 & 101 \\
0.1 & Fully & 1 & 99 \\
0.2 & Unconnected & 4 & 100 \\
0.2 & Minimally & 30 & 100 \\
0.2 & Fully & 28 & 100 \\
0.3 & Unconnected & 47 & 100 \\
0.3 & Minimally & 94 & 100 \\
0.3 & Fully & 88 & 100 \\
0.4 & Unconnected & 75 & 100 \\
0.4 & Minimally & 97 & 100 \\
0.4 & Fully & 99 & 100 \\
\bottomrule
\end{tabular}
\endgroup
\end{table}






Loading

0 comments on commit 213d951

Please sign in to comment.