Class Announcements
- Computer Lab Attendance: Fluency in any language requires practice. Group settings where you can ‘speak’ the language of computer science with your peers and instructors will help build your skills as a confident coder. Your instructors have carefully annotated each lab to support self-study outside of class, but we must emphasize that weekly lab attendance is expected for all students. You must reach out to your instructors prior to lab if you will miss section, so we can discuss the best ways to support your learning. We’d also like to note that your instructors do want to see you in office hours if you have questions, but that office hours are a place for questions after reviewing the course material. Office hours are not a place for a repeated lab lesson if a student chooses to miss a section as an unexcused absence.
- This policy can be found on Gauchospace.
- Useful R cheatsheet below:
Base R Cheatsheet
A. How do we do tasks outside the base R environment? : External packages
- What are packages?
Packages are units of reproducible R code that contain functions (commands that tell R to do something).
There are eight default or base packages pre-supplied in R with a variety of functions within them (e.g., the sum() or mean() functions). There are >10,000 external packages that were built by everyday users in the R community (just like yourself!).
For example, the ‘graphics’ package is pre-supplied in R with the plot() function that allows users to visualize data. Over time, other users in the community have written other packages with new functions to visualize data in alternative ways.
It’s important to remember that you’ll need to call the external package of choice when you need it with the library() or require() function.
- Install sciplot with the
install.packages() function
install.packages("sciplot", dependencies = TRUE) # The dependencies argument indicates whether to also install uninstalled packages which these packages depend on.
# You only need to do this once!
- Load deSolve, ggplot and sciplot with the
library() function
library(sciplot) # equivalent to require(sciplot)
require(sciplot) # equivalent to library(sciplot) in order to download someone else's code
# You need to do this everytime you re-open an R session.
- Have questions? The
help() function calls documentation for functions.
?bargraph.CI # this a function WITHIN the sciplot package
# or
help("bargraph.CI")
C. Enter your data
- Make a vector of experimental timepoints with the
c() function and name the output ExptDays with variable assignment. Call the variable to confirm your vector is correct. Take note of the collection dates on the petri dish, they may differ by 1 or 2 days relative to other growth rings. Do not include NAs into your vector.
ExptDays <- c(1,2,3,5,6,8,12)
# Why did we use the c() function instead of the : operator? It's not consecutive so you cannot use the consecutive operator.
# What's another function we could have used? seq() if the intervals were even
- Make a vector of your measured diameters with the
c() function and name the output MyDiameters with variable assignment. Call the variable to confirm your vector is correct. Do not include NAs into your vector.
MyDiameters <- c(12, 18, 23, 30, 31, 34, 37)
MyDiameters
[1] 12 18 23 30 31 34 37
- Check to make your vectors are the same length with the
length() function and the == operator, which refers to an exact match.
length(ExptDays) == length(MyDiameters)
[1] TRUE
# Where are other places you can look in R studio to check? Environment
D. Calculate Growth Rate
- Transform your diameter data into area (a proxy for population size) and name the output MyAreas with variable assignment.
MyAreas <- (MyDiameters/2)^2 * pi
MyAreas
[1] 113.0973 254.4690 415.4756 706.8583 754.7676 907.9203 1075.2101
- Plot colony area (y-axis) as a function of the experimental time points (x-axis) with the
plot() function. The functions and most arguments have been entered for you. Enter in your ExptDays and MyAreas variables as x and y, respectively.
plot(x = ExptDays, y = MyAreas, xlab = 'Experimental Timepoints', ylab = 'Colony Area', las = 1)

# What do you think the arguments xlab and ylab do? xlab = name of x axis and ylab is y axis
# Note: 'las = 1' changes the orientation of the tick mark labels to all horizontal.
Observe your results. Do your data look more like exponential or logistic growth? # LOGISTIC
- Plot log-transformed colony areas (y-axis) as a function of the experimental time points (x-axis) with the ‘log’ argument in
plot() function. The function and most arguments have been entered for you. Enter in your ExptDays and MyAreas variables as x and y, respectively, in BOTH functions.
3A. Log-transform your areas with the log() function and name the output ln.MyAreas with variable assignment. Note: the function ‘log’ is actually the natural log which we commonly write as ‘ln’. You would use ‘log10’ to take the base 10 log.
ln.MyAreas <- log(MyAreas)
ln.MyAreas
[1] 4.728249 5.539179 6.029424 6.560830 6.626410 6.811157 6.980271
- Plot your log-transformed colony areas (y-axis) as a function of the experimental time points (x-axis) with the
plot() function. The function and most arguments have been entered for you. Enter in your ExptDays and ln.MyAreas variables as x and y, respectively, in BOTH functions.
plot(x = ExptDays, y = ln.MyAreas, xlab = 'Experimental Timepoints', ylab = 'ln(Colony Area)', las = 1)

Observe your results. Over what portion of the experiment (what experimental dates) does the data look linear? What range of timepoints will you use to calculate ‘r’, the exponential growth rate? Can estimate r by looking where points level off so around day 6.
- Inspect your log-transformed graph from #4 and select a range of x-values for which your points are linear. Use variable assignment to name the first day of your range of x-values as t_start and the last day of your range of x-values as t_end.
ExptDays
[1] 1 2 3 5 6 8 12
t_start <- ExptDays[1]
t_end <- ExptDays[3]
t_start
[1] 1
t_end
[1] 3
- Plot markers overlaying your data to check your choices. Adjust them if you need to. Can you adjust t_start and t_end in this chunk or do you need to look somewhere else?
plot(x = ExptDays, y = ln.MyAreas, xlab = 'Experimental Timepoints', ylab = 'ln(Colony Area)', las = 1)
abline(v = t_start, col = 'red') # v is the x value for vertical line
abline(v = t_end, col = 'red')

- Use a linear model to calculate the slope. To do this, we will constrain our data to only the timepoints of interest by selecting the entries from the vectors for time and area. Fill in the your t_start and t_end within the brackets using the colon
: operator to subset the ln.MyAreas and ExptDays vectors.
lm1 <- lm(ln.MyAreas[t_start:t_end] ~ ExptDays[t_start:t_end])
# lm(y~x) otherwise known as y as a function of x. Thus meaning y= expression of x
lm1
Call:
lm(formula = ln.MyAreas[t_start:t_end] ~ ExptDays[t_start:t_end])
Coefficients:
(Intercept) ExptDays[t_start:t_end]
4.1311 0.6506
# intercept is y intercept and 0.3611 is the slope thus little r.
- Add a plot of lm1 to your dataset. Do you want to make any adjustments to your selected data range? (Note that you’ll have to re-run the linear model function, above, if you do!)
plot(x = ExptDays, y = ln.MyAreas, xlab = 'Experimental Timepoints', ylab = 'ln(Colony Area)', las = 1)
abline(lm1, col='blue')

# You must play both lines of code at once to see the experimental data and linear model overlap.
# You can output this plot into your plot window (bottom-right panel) by copying-pasting into console.
# must run the entire code at once!
- Print and examine the output from your linear model. For each estimated parameter (called ‘Coefficients’), the program will output a p-value (called ‘Pr(>|t|)’). Is your slope significant?
summary(lm1)
Call:
lm(formula = ln.MyAreas[t_start:t_end] ~ ExptDays[t_start:t_end])
Residuals:
1 2 3
-0.05345 0.10690 -0.05345
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.13111 0.19998 20.657 0.0308 *
ExptDays[t_start:t_end] 0.65059 0.09257 7.028 0.0900 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.1309 on 1 degrees of freedom
Multiple R-squared: 0.9802, Adjusted R-squared: 0.9603
F-statistic: 49.39 on 1 and 1 DF, p-value: 0.08998
# p value tells you how significantly the data you've chosen to evaluate
- Store the slope as the estimated growth rate
r.est <- lm1$coef[2]
r.est
ExptDays[t_start:t_end]
0.6505876
# Enter this value in the google spreadsheet
# What's the $ operator do? allows you to extract data and can use str(lm1) and will give you names of all outputs.
E. Simulate Exponential Growth / THINK PAIR SHARE 1
- Create a vector of timepoints that you’ll use to simulate exponential growth. The ‘seq’ command generates a SEQuence of values ranging from the first input (here, set as the starting experimental timepoint using the ‘min’ function) to the second input (here, set as the end experimental timepoint). The ‘length’ input tells the program how long the sequence of numbers should be.
HINT: Experiment with different ‘length’ values. How does this change the model fit? Why do you think this is the case?
exp.tmpts <- seq(from = min(ExptDays), to = max(ExptDays), length=1000)
exp.tmpts
[1] 1.000000 1.011011 1.022022 1.033033 1.044044 1.055055 1.066066
[8] 1.077077 1.088088 1.099099 1.110110 1.121121 1.132132 1.143143
[15] 1.154154 1.165165 1.176176 1.187187 1.198198 1.209209 1.220220
[22] 1.231231 1.242242 1.253253 1.264264 1.275275 1.286286 1.297297
[29] 1.308308 1.319319 1.330330 1.341341 1.352352 1.363363 1.374374
[36] 1.385385 1.396396 1.407407 1.418418 1.429429 1.440440 1.451451
[43] 1.462462 1.473473 1.484484 1.495495 1.506507 1.517518 1.528529
[50] 1.539540 1.550551 1.561562 1.572573 1.583584 1.594595 1.605606
[57] 1.616617 1.627628 1.638639 1.649650 1.660661 1.671672 1.682683
[64] 1.693694 1.704705 1.715716 1.726727 1.737738 1.748749 1.759760
[71] 1.770771 1.781782 1.792793 1.803804 1.814815 1.825826 1.836837
[78] 1.847848 1.858859 1.869870 1.880881 1.891892 1.902903 1.913914
[85] 1.924925 1.935936 1.946947 1.957958 1.968969 1.979980 1.990991
[92] 2.002002 2.013013 2.024024 2.035035 2.046046 2.057057 2.068068
[99] 2.079079 2.090090 2.101101 2.112112 2.123123 2.134134 2.145145
[106] 2.156156 2.167167 2.178178 2.189189 2.200200 2.211211 2.222222
[113] 2.233233 2.244244 2.255255 2.266266 2.277277 2.288288 2.299299
[120] 2.310310 2.321321 2.332332 2.343343 2.354354 2.365365 2.376376
[127] 2.387387 2.398398 2.409409 2.420420 2.431431 2.442442 2.453453
[134] 2.464464 2.475475 2.486486 2.497497 2.508509 2.519520 2.530531
[141] 2.541542 2.552553 2.563564 2.574575 2.585586 2.596597 2.607608
[148] 2.618619 2.629630 2.640641 2.651652 2.662663 2.673674 2.684685
[155] 2.695696 2.706707 2.717718 2.728729 2.739740 2.750751 2.761762
[162] 2.772773 2.783784 2.794795 2.805806 2.816817 2.827828 2.838839
[169] 2.849850 2.860861 2.871872 2.882883 2.893894 2.904905 2.915916
[176] 2.926927 2.937938 2.948949 2.959960 2.970971 2.981982 2.992993
[183] 3.004004 3.015015 3.026026 3.037037 3.048048 3.059059 3.070070
[190] 3.081081 3.092092 3.103103 3.114114 3.125125 3.136136 3.147147
[197] 3.158158 3.169169 3.180180 3.191191 3.202202 3.213213 3.224224
[204] 3.235235 3.246246 3.257257 3.268268 3.279279 3.290290 3.301301
[211] 3.312312 3.323323 3.334334 3.345345 3.356356 3.367367 3.378378
[218] 3.389389 3.400400 3.411411 3.422422 3.433433 3.444444 3.455455
[225] 3.466466 3.477477 3.488488 3.499499 3.510511 3.521522 3.532533
[232] 3.543544 3.554555 3.565566 3.576577 3.587588 3.598599 3.609610
[239] 3.620621 3.631632 3.642643 3.653654 3.664665 3.675676 3.686687
[246] 3.697698 3.708709 3.719720 3.730731 3.741742 3.752753 3.763764
[253] 3.774775 3.785786 3.796797 3.807808 3.818819 3.829830 3.840841
[260] 3.851852 3.862863 3.873874 3.884885 3.895896 3.906907 3.917918
[267] 3.928929 3.939940 3.950951 3.961962 3.972973 3.983984 3.994995
[274] 4.006006 4.017017 4.028028 4.039039 4.050050 4.061061 4.072072
[281] 4.083083 4.094094 4.105105 4.116116 4.127127 4.138138 4.149149
[288] 4.160160 4.171171 4.182182 4.193193 4.204204 4.215215 4.226226
[295] 4.237237 4.248248 4.259259 4.270270 4.281281 4.292292 4.303303
[302] 4.314314 4.325325 4.336336 4.347347 4.358358 4.369369 4.380380
[309] 4.391391 4.402402 4.413413 4.424424 4.435435 4.446446 4.457457
[316] 4.468468 4.479479 4.490490 4.501502 4.512513 4.523524 4.534535
[323] 4.545546 4.556557 4.567568 4.578579 4.589590 4.600601 4.611612
[330] 4.622623 4.633634 4.644645 4.655656 4.666667 4.677678 4.688689
[337] 4.699700 4.710711 4.721722 4.732733 4.743744 4.754755 4.765766
[344] 4.776777 4.787788 4.798799 4.809810 4.820821 4.831832 4.842843
[351] 4.853854 4.864865 4.875876 4.886887 4.897898 4.908909 4.919920
[358] 4.930931 4.941942 4.952953 4.963964 4.974975 4.985986 4.996997
[365] 5.008008 5.019019 5.030030 5.041041 5.052052 5.063063 5.074074
[372] 5.085085 5.096096 5.107107 5.118118 5.129129 5.140140 5.151151
[379] 5.162162 5.173173 5.184184 5.195195 5.206206 5.217217 5.228228
[386] 5.239239 5.250250 5.261261 5.272272 5.283283 5.294294 5.305305
[393] 5.316316 5.327327 5.338338 5.349349 5.360360 5.371371 5.382382
[400] 5.393393 5.404404 5.415415 5.426426 5.437437 5.448448 5.459459
[407] 5.470470 5.481481 5.492492 5.503504 5.514515 5.525526 5.536537
[414] 5.547548 5.558559 5.569570 5.580581 5.591592 5.602603 5.613614
[421] 5.624625 5.635636 5.646647 5.657658 5.668669 5.679680 5.690691
[428] 5.701702 5.712713 5.723724 5.734735 5.745746 5.756757 5.767768
[435] 5.778779 5.789790 5.800801 5.811812 5.822823 5.833834 5.844845
[442] 5.855856 5.866867 5.877878 5.888889 5.899900 5.910911 5.921922
[449] 5.932933 5.943944 5.954955 5.965966 5.976977 5.987988 5.998999
[456] 6.010010 6.021021 6.032032 6.043043 6.054054 6.065065 6.076076
[463] 6.087087 6.098098 6.109109 6.120120 6.131131 6.142142 6.153153
[470] 6.164164 6.175175 6.186186 6.197197 6.208208 6.219219 6.230230
[477] 6.241241 6.252252 6.263263 6.274274 6.285285 6.296296 6.307307
[484] 6.318318 6.329329 6.340340 6.351351 6.362362 6.373373 6.384384
[491] 6.395395 6.406406 6.417417 6.428428 6.439439 6.450450 6.461461
[498] 6.472472 6.483483 6.494494 6.505506 6.516517 6.527528 6.538539
[505] 6.549550 6.560561 6.571572 6.582583 6.593594 6.604605 6.615616
[512] 6.626627 6.637638 6.648649 6.659660 6.670671 6.681682 6.692693
[519] 6.703704 6.714715 6.725726 6.736737 6.747748 6.758759 6.769770
[526] 6.780781 6.791792 6.802803 6.813814 6.824825 6.835836 6.846847
[533] 6.857858 6.868869 6.879880 6.890891 6.901902 6.912913 6.923924
[540] 6.934935 6.945946 6.956957 6.967968 6.978979 6.989990 7.001001
[547] 7.012012 7.023023 7.034034 7.045045 7.056056 7.067067 7.078078
[554] 7.089089 7.100100 7.111111 7.122122 7.133133 7.144144 7.155155
[561] 7.166166 7.177177 7.188188 7.199199 7.210210 7.221221 7.232232
[568] 7.243243 7.254254 7.265265 7.276276 7.287287 7.298298 7.309309
[575] 7.320320 7.331331 7.342342 7.353353 7.364364 7.375375 7.386386
[582] 7.397397 7.408408 7.419419 7.430430 7.441441 7.452452 7.463463
[589] 7.474474 7.485485 7.496496 7.507508 7.518519 7.529530 7.540541
[596] 7.551552 7.562563 7.573574 7.584585 7.595596 7.606607 7.617618
[603] 7.628629 7.639640 7.650651 7.661662 7.672673 7.683684 7.694695
[610] 7.705706 7.716717 7.727728 7.738739 7.749750 7.760761 7.771772
[617] 7.782783 7.793794 7.804805 7.815816 7.826827 7.837838 7.848849
[624] 7.859860 7.870871 7.881882 7.892893 7.903904 7.914915 7.925926
[631] 7.936937 7.947948 7.958959 7.969970 7.980981 7.991992 8.003003
[638] 8.014014 8.025025 8.036036 8.047047 8.058058 8.069069 8.080080
[645] 8.091091 8.102102 8.113113 8.124124 8.135135 8.146146 8.157157
[652] 8.168168 8.179179 8.190190 8.201201 8.212212 8.223223 8.234234
[659] 8.245245 8.256256 8.267267 8.278278 8.289289 8.300300 8.311311
[666] 8.322322 8.333333 8.344344 8.355355 8.366366 8.377377 8.388388
[673] 8.399399 8.410410 8.421421 8.432432 8.443443 8.454454 8.465465
[680] 8.476476 8.487487 8.498498 8.509510 8.520521 8.531532 8.542543
[687] 8.553554 8.564565 8.575576 8.586587 8.597598 8.608609 8.619620
[694] 8.630631 8.641642 8.652653 8.663664 8.674675 8.685686 8.696697
[701] 8.707708 8.718719 8.729730 8.740741 8.751752 8.762763 8.773774
[708] 8.784785 8.795796 8.806807 8.817818 8.828829 8.839840 8.850851
[715] 8.861862 8.872873 8.883884 8.894895 8.905906 8.916917 8.927928
[722] 8.938939 8.949950 8.960961 8.971972 8.982983 8.993994 9.005005
[729] 9.016016 9.027027 9.038038 9.049049 9.060060 9.071071 9.082082
[736] 9.093093 9.104104 9.115115 9.126126 9.137137 9.148148 9.159159
[743] 9.170170 9.181181 9.192192 9.203203 9.214214 9.225225 9.236236
[750] 9.247247 9.258258 9.269269 9.280280 9.291291 9.302302 9.313313
[757] 9.324324 9.335335 9.346346 9.357357 9.368368 9.379379 9.390390
[764] 9.401401 9.412412 9.423423 9.434434 9.445445 9.456456 9.467467
[771] 9.478478 9.489489 9.500501 9.511512 9.522523 9.533534 9.544545
[778] 9.555556 9.566567 9.577578 9.588589 9.599600 9.610611 9.621622
[785] 9.632633 9.643644 9.654655 9.665666 9.676677 9.687688 9.698699
[792] 9.709710 9.720721 9.731732 9.742743 9.753754 9.764765 9.775776
[799] 9.786787 9.797798 9.808809 9.819820 9.830831 9.841842 9.852853
[806] 9.863864 9.874875 9.885886 9.896897 9.907908 9.918919 9.929930
[813] 9.940941 9.951952 9.962963 9.973974 9.984985 9.995996 10.007007
[820] 10.018018 10.029029 10.040040 10.051051 10.062062 10.073073 10.084084
[827] 10.095095 10.106106 10.117117 10.128128 10.139139 10.150150 10.161161
[834] 10.172172 10.183183 10.194194 10.205205 10.216216 10.227227 10.238238
[841] 10.249249 10.260260 10.271271 10.282282 10.293293 10.304304 10.315315
[848] 10.326326 10.337337 10.348348 10.359359 10.370370 10.381381 10.392392
[855] 10.403403 10.414414 10.425425 10.436436 10.447447 10.458458 10.469469
[862] 10.480480 10.491491 10.502503 10.513514 10.524525 10.535536 10.546547
[869] 10.557558 10.568569 10.579580 10.590591 10.601602 10.612613 10.623624
[876] 10.634635 10.645646 10.656657 10.667668 10.678679 10.689690 10.700701
[883] 10.711712 10.722723 10.733734 10.744745 10.755756 10.766767 10.777778
[890] 10.788789 10.799800 10.810811 10.821822 10.832833 10.843844 10.854855
[897] 10.865866 10.876877 10.887888 10.898899 10.909910 10.920921 10.931932
[904] 10.942943 10.953954 10.964965 10.975976 10.986987 10.997998 11.009009
[911] 11.020020 11.031031 11.042042 11.053053 11.064064 11.075075 11.086086
[918] 11.097097 11.108108 11.119119 11.130130 11.141141 11.152152 11.163163
[925] 11.174174 11.185185 11.196196 11.207207 11.218218 11.229229 11.240240
[932] 11.251251 11.262262 11.273273 11.284284 11.295295 11.306306 11.317317
[939] 11.328328 11.339339 11.350350 11.361361 11.372372 11.383383 11.394394
[946] 11.405405 11.416416 11.427427 11.438438 11.449449 11.460460 11.471471
[953] 11.482482 11.493493 11.504505 11.515516 11.526527 11.537538 11.548549
[960] 11.559560 11.570571 11.581582 11.592593 11.603604 11.614615 11.625626
[967] 11.636637 11.647648 11.658659 11.669670 11.680681 11.691692 11.702703
[974] 11.713714 11.724725 11.735736 11.746747 11.757758 11.768769 11.779780
[981] 11.790791 11.801802 11.812813 11.823824 11.834835 11.845846 11.856857
[988] 11.867868 11.878879 11.889890 11.900901 11.911912 11.922923 11.933934
[995] 11.944945 11.955956 11.966967 11.977978 11.988989 12.000000
- Create a holding vector for the simulation results of the same length as ‘exp.tmpts’. Name this vector exp.simu with variable assignment. Populate your holding vector with NaNs. ‘NaN’s are a useful placeholder because this will prevent anything from being plotted/output in analyses later on if there’s an issue with the ’for’ loop.
exp.simu <- rep(NaN, times = length(exp.tmpts))
# telling r to repeat the length that many times
exp.simu
[1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[20] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[39] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[58] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[77] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[96] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[115] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[134] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[153] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[172] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[191] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[210] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[229] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[248] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[267] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[286] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[305] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[324] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[343] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[362] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[381] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[400] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[419] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[438] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[457] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[476] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[495] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[514] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[533] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[552] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[571] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[590] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[609] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[628] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[647] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[666] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[685] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[704] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[723] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[742] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[761] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[780] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[799] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[818] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[837] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[856] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[875] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[894] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[913] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[932] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[951] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[970] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[989] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
- Set up the initial condition (i.e., the population size at the first timepoint) using your data
# PLEASE ANNOTATE THE FOLLOWING CODE:
exp.simu[1] <- MyAreas[1] # Storing data from day 1 into exp.simu vector; set first value of exp.simu to be the first value of MyAreas
exp.simu[1] # Area of colony on day 1
[1] 113.0973
exp.simu
[1] 113.0973 NaN NaN NaN NaN NaN NaN NaN
[9] NaN NaN NaN NaN NaN NaN NaN NaN
[17] NaN NaN NaN NaN NaN NaN NaN NaN
[25] NaN NaN NaN NaN NaN NaN NaN NaN
[33] NaN NaN NaN NaN NaN NaN NaN NaN
[41] NaN NaN NaN NaN NaN NaN NaN NaN
[49] NaN NaN NaN NaN NaN NaN NaN NaN
[57] NaN NaN NaN NaN NaN NaN NaN NaN
[65] NaN NaN NaN NaN NaN NaN NaN NaN
[73] NaN NaN NaN NaN NaN NaN NaN NaN
[81] NaN NaN NaN NaN NaN NaN NaN NaN
[89] NaN NaN NaN NaN NaN NaN NaN NaN
[97] NaN NaN NaN NaN NaN NaN NaN NaN
[105] NaN NaN NaN NaN NaN NaN NaN NaN
[113] NaN NaN NaN NaN NaN NaN NaN NaN
[121] NaN NaN NaN NaN NaN NaN NaN NaN
[129] NaN NaN NaN NaN NaN NaN NaN NaN
[137] NaN NaN NaN NaN NaN NaN NaN NaN
[145] NaN NaN NaN NaN NaN NaN NaN NaN
[153] NaN NaN NaN NaN NaN NaN NaN NaN
[161] NaN NaN NaN NaN NaN NaN NaN NaN
[169] NaN NaN NaN NaN NaN NaN NaN NaN
[177] NaN NaN NaN NaN NaN NaN NaN NaN
[185] NaN NaN NaN NaN NaN NaN NaN NaN
[193] NaN NaN NaN NaN NaN NaN NaN NaN
[201] NaN NaN NaN NaN NaN NaN NaN NaN
[209] NaN NaN NaN NaN NaN NaN NaN NaN
[217] NaN NaN NaN NaN NaN NaN NaN NaN
[225] NaN NaN NaN NaN NaN NaN NaN NaN
[233] NaN NaN NaN NaN NaN NaN NaN NaN
[241] NaN NaN NaN NaN NaN NaN NaN NaN
[249] NaN NaN NaN NaN NaN NaN NaN NaN
[257] NaN NaN NaN NaN NaN NaN NaN NaN
[265] NaN NaN NaN NaN NaN NaN NaN NaN
[273] NaN NaN NaN NaN NaN NaN NaN NaN
[281] NaN NaN NaN NaN NaN NaN NaN NaN
[289] NaN NaN NaN NaN NaN NaN NaN NaN
[297] NaN NaN NaN NaN NaN NaN NaN NaN
[305] NaN NaN NaN NaN NaN NaN NaN NaN
[313] NaN NaN NaN NaN NaN NaN NaN NaN
[321] NaN NaN NaN NaN NaN NaN NaN NaN
[329] NaN NaN NaN NaN NaN NaN NaN NaN
[337] NaN NaN NaN NaN NaN NaN NaN NaN
[345] NaN NaN NaN NaN NaN NaN NaN NaN
[353] NaN NaN NaN NaN NaN NaN NaN NaN
[361] NaN NaN NaN NaN NaN NaN NaN NaN
[369] NaN NaN NaN NaN NaN NaN NaN NaN
[377] NaN NaN NaN NaN NaN NaN NaN NaN
[385] NaN NaN NaN NaN NaN NaN NaN NaN
[393] NaN NaN NaN NaN NaN NaN NaN NaN
[401] NaN NaN NaN NaN NaN NaN NaN NaN
[409] NaN NaN NaN NaN NaN NaN NaN NaN
[417] NaN NaN NaN NaN NaN NaN NaN NaN
[425] NaN NaN NaN NaN NaN NaN NaN NaN
[433] NaN NaN NaN NaN NaN NaN NaN NaN
[441] NaN NaN NaN NaN NaN NaN NaN NaN
[449] NaN NaN NaN NaN NaN NaN NaN NaN
[457] NaN NaN NaN NaN NaN NaN NaN NaN
[465] NaN NaN NaN NaN NaN NaN NaN NaN
[473] NaN NaN NaN NaN NaN NaN NaN NaN
[481] NaN NaN NaN NaN NaN NaN NaN NaN
[489] NaN NaN NaN NaN NaN NaN NaN NaN
[497] NaN NaN NaN NaN NaN NaN NaN NaN
[505] NaN NaN NaN NaN NaN NaN NaN NaN
[513] NaN NaN NaN NaN NaN NaN NaN NaN
[521] NaN NaN NaN NaN NaN NaN NaN NaN
[529] NaN NaN NaN NaN NaN NaN NaN NaN
[537] NaN NaN NaN NaN NaN NaN NaN NaN
[545] NaN NaN NaN NaN NaN NaN NaN NaN
[553] NaN NaN NaN NaN NaN NaN NaN NaN
[561] NaN NaN NaN NaN NaN NaN NaN NaN
[569] NaN NaN NaN NaN NaN NaN NaN NaN
[577] NaN NaN NaN NaN NaN NaN NaN NaN
[585] NaN NaN NaN NaN NaN NaN NaN NaN
[593] NaN NaN NaN NaN NaN NaN NaN NaN
[601] NaN NaN NaN NaN NaN NaN NaN NaN
[609] NaN NaN NaN NaN NaN NaN NaN NaN
[617] NaN NaN NaN NaN NaN NaN NaN NaN
[625] NaN NaN NaN NaN NaN NaN NaN NaN
[633] NaN NaN NaN NaN NaN NaN NaN NaN
[641] NaN NaN NaN NaN NaN NaN NaN NaN
[649] NaN NaN NaN NaN NaN NaN NaN NaN
[657] NaN NaN NaN NaN NaN NaN NaN NaN
[665] NaN NaN NaN NaN NaN NaN NaN NaN
[673] NaN NaN NaN NaN NaN NaN NaN NaN
[681] NaN NaN NaN NaN NaN NaN NaN NaN
[689] NaN NaN NaN NaN NaN NaN NaN NaN
[697] NaN NaN NaN NaN NaN NaN NaN NaN
[705] NaN NaN NaN NaN NaN NaN NaN NaN
[713] NaN NaN NaN NaN NaN NaN NaN NaN
[721] NaN NaN NaN NaN NaN NaN NaN NaN
[729] NaN NaN NaN NaN NaN NaN NaN NaN
[737] NaN NaN NaN NaN NaN NaN NaN NaN
[745] NaN NaN NaN NaN NaN NaN NaN NaN
[753] NaN NaN NaN NaN NaN NaN NaN NaN
[761] NaN NaN NaN NaN NaN NaN NaN NaN
[769] NaN NaN NaN NaN NaN NaN NaN NaN
[777] NaN NaN NaN NaN NaN NaN NaN NaN
[785] NaN NaN NaN NaN NaN NaN NaN NaN
[793] NaN NaN NaN NaN NaN NaN NaN NaN
[801] NaN NaN NaN NaN NaN NaN NaN NaN
[809] NaN NaN NaN NaN NaN NaN NaN NaN
[817] NaN NaN NaN NaN NaN NaN NaN NaN
[825] NaN NaN NaN NaN NaN NaN NaN NaN
[833] NaN NaN NaN NaN NaN NaN NaN NaN
[841] NaN NaN NaN NaN NaN NaN NaN NaN
[849] NaN NaN NaN NaN NaN NaN NaN NaN
[857] NaN NaN NaN NaN NaN NaN NaN NaN
[865] NaN NaN NaN NaN NaN NaN NaN NaN
[873] NaN NaN NaN NaN NaN NaN NaN NaN
[881] NaN NaN NaN NaN NaN NaN NaN NaN
[889] NaN NaN NaN NaN NaN NaN NaN NaN
[897] NaN NaN NaN NaN NaN NaN NaN NaN
[905] NaN NaN NaN NaN NaN NaN NaN NaN
[913] NaN NaN NaN NaN NaN NaN NaN NaN
[921] NaN NaN NaN NaN NaN NaN NaN NaN
[929] NaN NaN NaN NaN NaN NaN NaN NaN
[937] NaN NaN NaN NaN NaN NaN NaN NaN
[945] NaN NaN NaN NaN NaN NaN NaN NaN
[953] NaN NaN NaN NaN NaN NaN NaN NaN
[961] NaN NaN NaN NaN NaN NaN NaN NaN
[969] NaN NaN NaN NaN NaN NaN NaN NaN
[977] NaN NaN NaN NaN NaN NaN NaN NaN
[985] NaN NaN NaN NaN NaN NaN NaN NaN
[993] NaN NaN NaN NaN NaN NaN NaN NaN
- Run a
for() loop to calculate the remainder of the simulation values.
# PLEASE ANNOTATE THE FOLLOWING CODE:
for(i in 2:length(exp.tmpts)){ # for every i from the second value to the length of exp.tmpts
deltat = exp.tmpts[i] - exp.tmpts[i-1] # change in time is calculated by taking the difference between 2 time points
deltaN = exp.simu[i-1] * r.est * deltat # change in population size by taking the population size at the previous time multiplying it by growth rate and multiplying that by change in time
exp.simu[i] = exp.simu[i-1] + deltaN # calculate population size by adding population size at previous time point to change in population size (deltaN)
}
exp.simu
[1] 113.0973 113.9075 114.7235 115.5454 116.3731 117.2067
[7] 118.0464 118.8920 119.7437 120.6015 121.4654 122.3356
[13] 123.2119 124.0946 124.9835 125.8789 126.7806 127.6888
[19] 128.6036 129.5248 130.4527 131.3872 132.3284 133.2764
[25] 134.2311 135.1927 136.1612 137.1366 138.1190 139.1084
[31] 140.1049 141.1086 142.1194 143.1375 144.1629 145.1956
[37] 146.2358 147.2833 148.3384 149.4011 150.4713 151.5492
[43] 152.6349 153.7283 154.8295 155.9387 157.0558 158.1809
[49] 159.3140 160.4553 161.6047 162.7624 163.9284 165.1027
[55] 166.2854 167.4766 168.6764 169.8847 171.1017 172.3274
[61] 173.5619 174.8052 176.0575 177.3187 178.5889 179.8683
[67] 181.1568 182.4545 183.7615 185.0779 186.4038 187.7391
[73] 189.0840 190.4385 191.8027 193.1767 194.5606 195.9544
[79] 197.3581 198.7719 200.1958 201.6300 203.0744 204.5291
[85] 205.9943 207.4699 208.9562 210.4531 211.9607 213.4791
[91] 215.0084 216.5486 218.0999 219.6623 221.2358 222.8207
[97] 224.4169 226.0245 227.6437 229.2744 230.9169 232.5711
[103] 234.2371 235.9151 237.6051 239.3072 241.0216 242.7481
[109] 244.4871 246.2385 248.0025 249.7791 251.5684 253.3705
[115] 255.1856 257.0136 258.8548 260.7091 262.5768 264.4578
[121] 266.3522 268.2603 270.1820 272.1175 274.0668 276.0301
[127] 278.0075 279.9991 282.0049 284.0250 286.0597 288.1089
[133] 290.1728 292.2515 294.3451 296.4537 298.5774 300.7163
[139] 302.8705 305.0401 307.2253 309.4262 311.6428 313.8753
[145] 316.1238 318.3884 320.6692 322.9663 325.2799 327.6101
[151] 329.9570 332.3207 334.7013 337.0990 339.5138 341.9460
[157] 344.3956 346.8627 349.3475 351.8501 354.3706 356.9092
[163] 359.4659 362.0410 364.6345 367.2466 369.8775 372.5271
[169] 375.1958 377.8835 380.5905 383.3170 386.0629 388.8285
[175] 391.6139 394.4193 397.2448 400.0905 402.9566 405.8432
[181] 408.7505 411.6787 414.6278 417.5980 420.5895 423.6025
[187] 426.6370 429.6933 432.7714 435.8717 438.9941 442.1389
[193] 445.3062 448.4962 451.7090 454.9449 458.2040 461.4864
[199] 464.7923 468.1219 471.4753 474.8528 478.2545 481.6805
[205] 485.1311 488.6064 492.1066 495.6319 499.1824 502.7583
[211] 506.3599 509.9873 513.6407 517.3202 521.0261 524.7585
[217] 528.5177 532.3038 536.1170 539.9576 543.8256 547.7214
[223] 551.6450 555.5968 559.5769 563.5855 567.6228 571.6891
[229] 575.7844 579.9091 584.0634 588.2474 592.4614 596.7056
[235] 600.9801 605.2853 609.6214 613.9885 618.3869 622.8167
[241] 627.2784 631.7720 636.2977 640.8559 645.4468 650.0705
[247] 654.7274 659.4176 664.1414 668.8991 673.6908 678.5169
[253] 683.3776 688.2730 693.2035 698.1694 703.1708 708.2081
[259] 713.2814 718.3911 723.5374 728.7205 733.9408 739.1985
[265] 744.4938 749.8271 755.1986 760.6086 766.0573 771.5450
[271] 777.0721 782.6387 788.2453 793.8920 799.5791 805.3070
[277] 811.0759 816.8862 822.7380 828.6318 834.5678 840.5464
[283] 846.5677 852.6322 858.7402 864.8918 871.0876 877.3278
[289] 883.6126 889.9425 896.3177 902.7386 909.2055 915.7187
[295] 922.2785 928.8854 935.5396 942.2414 948.9913 955.7895
[301] 962.6364 969.5324 976.4778 983.4729 990.5181 997.6138
[307] 1004.7604 1011.9581 1019.2074 1026.5086 1033.8621 1041.2683
[313] 1048.7276 1056.2403 1063.8068 1071.4275 1079.1028 1086.8331
[319] 1094.6188 1102.4602 1110.3578 1118.3120 1126.3232 1134.3917
[325] 1142.5181 1150.7027 1158.9459 1167.2481 1175.6099 1184.0315
[331] 1192.5135 1201.0562 1209.6601 1218.3257 1227.0533 1235.8434
[337] 1244.6966 1253.6131 1262.5935 1271.6383 1280.7478 1289.9226
[343] 1299.1631 1308.4699 1317.8432 1327.2838 1336.7919 1346.3682
[349] 1356.0131 1365.7271 1375.5106 1385.3643 1395.2885 1405.2838
[355] 1415.3508 1425.4898 1435.7015 1445.9863 1456.3448 1466.7775
[361] 1477.2850 1487.8677 1498.5262 1509.2611 1520.0729 1530.9621
[367] 1541.9294 1552.9752 1564.1001 1575.3047 1586.5896 1597.9554
[373] 1609.4025 1620.9317 1632.5434 1644.2384 1656.0171 1667.8802
[379] 1679.8282 1691.8619 1703.9818 1716.1885 1728.4826 1740.8648
[385] 1753.3357 1765.8959 1778.5462 1791.2870 1804.1191 1817.0432
[391] 1830.0598 1843.1696 1856.3734 1869.6718 1883.0654 1896.5550
[397] 1910.1412 1923.8247 1937.6063 1951.4866 1965.4663 1979.5462
[403] 1993.7269 2008.0092 2022.3939 2036.8815 2051.4730 2066.1690
[409] 2080.9702 2095.8775 2110.8916 2126.0133 2141.2432 2156.5823
[415] 2172.0313 2187.5909 2203.2620 2219.0453 2234.9417 2250.9520
[421] 2267.0770 2283.3175 2299.6743 2316.1483 2332.7403 2349.4512
[427] 2366.2818 2383.2330 2400.3056 2417.5005 2434.8185 2452.2607
[433] 2469.8277 2487.5207 2505.3403 2523.2877 2541.3636 2559.5689
[439] 2577.9047 2596.3719 2614.9713 2633.7040 2652.5709 2671.5729
[445] 2690.7111 2709.9863 2729.3996 2748.9520 2768.6445 2788.4780
[451] 2808.4537 2828.5724 2848.8352 2869.2432 2889.7974 2910.4988
[457] 2931.3485 2952.3476 2973.4971 2994.7982 3016.2518 3037.8591
[463] 3059.6212 3081.5392 3103.6142 3125.8473 3148.2397 3170.7925
[469] 3193.5069 3216.3840 3239.4249 3262.6310 3286.0033 3309.5430
[475] 3333.2513 3357.1295 3381.1787 3405.4002 3429.7952 3454.3650
[481] 3479.1107 3504.0338 3529.1354 3554.4168 3579.8793 3605.5242
[487] 3631.3529 3657.3665 3683.5665 3709.9542 3736.5310 3763.2981
[493] 3790.2569 3817.4089 3844.7554 3872.2978 3900.0375 3927.9759
[499] 3956.1145 3984.4546 4012.9977 4041.7454 4070.6989 4099.8599
[505] 4129.2297 4158.8100 4188.6022 4218.6078 4248.8283 4279.2653
[511] 4309.9204 4340.7950 4371.8909 4403.2095 4434.7524 4466.5213
[517] 4498.5178 4530.7435 4563.2001 4595.8891 4628.8124 4661.9715
[523] 4695.3681 4729.0039 4762.8808 4797.0003 4831.3642 4865.9743
[529] 4900.8323 4935.9400 4971.2993 5006.9118 5042.7794 5078.9040
[535] 5115.2874 5151.9314 5188.8379 5226.0088 5263.4460 5301.1514
[541] 5339.1268 5377.3744 5415.8959 5454.6933 5493.7687 5533.1240
[547] 5572.7612 5612.6824 5652.8896 5693.3848 5734.1701 5775.2475
[553] 5816.6192 5858.2873 5900.2539 5942.5211 5985.0911 6027.9661
[559] 6071.1482 6114.6396 6158.4426 6202.5594 6246.9922 6291.7434
[565] 6336.8151 6382.2096 6427.9294 6473.9767 6520.3538 6567.0632
[571] 6614.1072 6661.4882 6709.2086 6757.2709 6805.6775 6854.4308
[577] 6903.5334 6952.9877 7002.7963 7052.9617 7103.4865 7154.3733
[583] 7205.6245 7257.2429 7309.2311 7361.5917 7414.3274 7467.4409
[589] 7520.9348 7574.8120 7629.0751 7683.7270 7738.7703 7794.2080
[595] 7850.0428 7906.2776 7962.9152 8019.9586 8077.4105 8135.2741
[601] 8193.5522 8252.2477 8311.3637 8370.9033 8430.8693 8491.2649
[607] 8552.0931 8613.3571 8675.0600 8737.2049 8799.7950 8862.8334
[613] 8926.3235 8990.2683 9054.6712 9119.5355 9184.8645 9250.6614
[619] 9316.9297 9383.6727 9450.8938 9518.5965 9586.7842 9655.4603
[625] 9724.6285 9794.2921 9864.4547 9935.1200 10006.2915 10077.9728
[631] 10150.1677 10222.8797 10296.1126 10369.8701 10444.1560 10518.9740
[637] 10594.3280 10670.2218 10746.6593 10823.6444 10901.1809 10979.2729
[643] 11057.9243 11137.1392 11216.9215 11297.2753 11378.2048 11459.7140
[649] 11541.8071 11624.4883 11707.7618 11791.6318 11876.1027 11961.1786
[655] 12046.8641 12133.1633 12220.0808 12307.6209 12395.7881 12484.5869
[661] 12574.0218 12664.0974 12754.8182 12846.1890 12938.2143 13030.8989
[667] 13124.2473 13218.2646 13312.9553 13408.3243 13504.3765 13601.1169
[673] 13698.5502 13796.6815 13895.5158 13995.0581 14095.3134 14196.2870
[679] 14297.9839 14400.4093 14503.5685 14607.4666 14712.1091 14817.5011
[685] 14923.6482 15030.5556 15138.2289 15246.6735 15355.8950 15465.8989
[691] 15576.6909 15688.2765 15800.6614 15913.8515 16027.8524 16142.6699
[697] 16258.3100 16374.7784 16492.0812 16610.2244 16729.2138 16849.0556
[703] 16969.7560 17091.3210 17213.7568 17337.0698 17461.2661 17586.3521
[709] 17712.3341 17839.2187 17967.0122 18095.7212 18225.3522 18355.9118
[715] 18487.4067 18619.8436 18753.2292 18887.5703 19022.8738 19159.1466
[721] 19296.3956 19434.6277 19573.8502 19714.0699 19855.2942 19997.5301
[727] 20140.7849 20285.0660 20430.3806 20576.7363 20724.1403 20872.6003
[733] 21022.1238 21172.7185 21324.3920 21477.1519 21631.0062 21785.9627
[739] 21942.0292 22099.2137 22257.5242 22416.9688 22577.5556 22739.2928
[745] 22902.1886 23066.2514 23231.4894 23397.9111 23565.5250 23734.3396
[751] 23904.3636 24075.6055 24248.0742 24421.7783 24596.7268 24772.9286
[757] 24950.3926 25129.1279 25309.1436 25490.4489 25673.0530 25856.9651
[763] 26042.1948 26228.7513 26416.6443 26605.8833 26796.4779 26988.4379
[769] 27181.7730 27376.4931 27572.6081 27770.1279 27969.0628 28169.4227
[775] 28371.2179 28574.4587 28779.1555 28985.3186 29192.9586 29402.0861
[781] 29612.7117 29824.8461 30038.5002 30253.6848 30470.4109 30688.6895
[787] 30908.5319 31129.9490 31352.9524 31577.5532 31803.7630 32031.5933
[793] 32261.0557 32492.1619 32724.9236 32959.3527 33195.4613 33433.2612
[799] 33672.7646 33913.9837 34156.9308 34401.6183 34648.0587 34896.2644
[805] 35146.2482 35398.0229 35651.6011 35906.9958 36164.2202 36423.2871
[811] 36684.2100 36947.0020 37211.6765 37478.2471 37746.7273 38017.1307
[817] 38289.4713 38563.7627 38840.0192 39118.2546 39398.4831 39680.7192
[823] 39964.9770 40251.2712 40539.6163 40830.0270 41122.5181 41417.1044
[829] 41713.8011 42012.6232 42313.5860 42616.7047 42921.9949 43229.4721
[835] 43539.1519 43851.0501 44165.1827 44481.5655 44800.2149 45121.1469
[841] 45444.3780 45769.9245 46097.8032 46428.0307 46760.6237 47095.5994
[847] 47432.9747 47772.7668 48114.9931 48459.6710 48806.8180 49156.4518
[853] 49508.5903 49863.2513 50220.4531 50580.2137 50942.5514 51307.4849
[859] 51675.0325 52045.2132 52418.0457 52793.5490 53171.7423 53552.6448
[865] 53936.2760 54322.6553 54711.8025 55103.7375 55498.4801 55896.0505
[871] 56296.4690 56699.7558 57105.9317 57515.0173 57927.0335 58342.0011
[877] 58759.9414 59180.8757 59604.8254 60031.8122 60461.8577 60894.9839
[883] 61331.2128 61770.5667 62213.0680 62658.7392 63107.6030 63559.6824
[889] 64015.0002 64473.5798 64935.4444 65400.6177 65869.1234 66340.9852
[895] 66816.2272 67294.8738 67776.9491 68262.4779 68751.4848 69243.9948
[901] 69740.0329 70239.6245 70742.7950 71249.5700 71759.9753 72274.0370
[907] 72791.7812 73313.2344 73838.4230 74367.3739 74900.1141 75436.6705
[913] 75977.0707 76521.3421 77069.5124 77621.6096 78177.6619 78737.6975
[919] 79301.7450 79869.8331 80441.9908 81018.2472 81598.6317 82183.1738
[925] 82771.9034 83364.8504 83962.0451 84563.5179 85169.2994 85779.4204
[931] 86393.9122 87012.8059 87636.1332 88263.9258 88896.2156 89533.0349
[937] 90174.4162 90820.3920 91470.9954 92126.2595 92786.2177 93450.9035
[943] 94120.3509 94794.5940 95473.6671 96157.6048 96846.4420 97540.2138
[949] 98238.9555 98942.7027 99651.4913 100365.3574 101084.3374 101808.4678
[955] 102537.7857 103272.3282 104012.1326 104757.2367 105507.6784 106263.4961
[961] 107024.7281 107791.4133 108563.5908 109341.2998 110124.5801 110913.4715
[967] 111708.0142 112508.2488 113314.2159 114125.9566 114943.5124 115766.9248
[973] 116596.2359 117431.4878 118272.7232 119119.9848 119973.3160 120832.7600
[979] 121698.3608 122570.1625 123448.2094 124332.5463 125223.2183 126120.2707
[985] 127023.7492 127933.7000 128850.1693 129773.2038 130702.8506 131639.1570
[991] 132582.1708 133531.9400 134488.5130 135451.9386 136422.2657 137399.5439
[997] 138383.8230 139375.1530 140373.5846 141379.1686
## Why did we use 2:length(exp.tmpts) instead of 1:length(exp.tmpts)?
# have starting condition, iterating over previous value (cannot start at 1)
## Why don't we need to make holding vectors for deltat and deltaN?
#every time you run the for() deltat and deltaN will continue to change
- Make a plot overlaying your model output on your observed data. To help us see the divergence between the results, we’ll increase the scale of the y-axis (using the ‘ylim’ command) to 50% greater than the maximum observed colony area.
plot(x = ExptDays, y = MyAreas, xlab = 'Experimental Timepoints', ylab = 'Colony Area', las = 1, ylim = c(0, 1.5 * max(MyAreas))) # Plots experimental data
lines(x = exp.tmpts, y = exp.simu, col = 'blue') # Overlay the simulation result

- Observe your results. Any discrepancies between your simulation and your observations? What do you think may be responsible?
F. Estimate Carrying Capacity
- One reason your exponential growth model may not have fit well is because population growth slowed as your organisms approached their carrying capacity ‘K’. Now, we’ll estimate ‘K’ and repeat our simulation to see if we get a better fit.
Let’s assume that K is equal to the maximum colony area.
Use the max() function to find the maximum value of your MyAreas (experimental data) and assign it as K.est with variable assignment.
K.est <- max(MyAreas)
K.est
[1] 1075.21
# Enter this value in your google spreadsheet
NOTE: Can you think of a better way to estimate K? Try it out! You can just estimate and draw a line through the points.
G. Simulate Logistic Growth / THINK PAIR SHARE 2
- Create a vector of timepoints using the seq() function from the minimum ExptDays to the maximum Expt days of a length 10000. Name this vector log.tmpts with variable assignment.
log.tmpts <- seq(from = min(ExptDays), to = max(ExptDays), length.out = 10000)
log.tmpts
[1] 1.000000 1.001100 1.002200 1.003300 1.004400 1.005501 1.006601 1.007701
[9] 1.008801 1.009901 1.011001 1.012101 1.013201 1.014301 1.015402 1.016502
[17] 1.017602 1.018702 1.019802 1.020902 1.022002 1.023102 1.024202 1.025303
[25] 1.026403 1.027503 1.028603 1.029703 1.030803 1.031903 1.033003 1.034103
[33] 1.035204 1.036304 1.037404 1.038504 1.039604 1.040704 1.041804 1.042904
[41] 1.044004 1.045105 1.046205 1.047305 1.048405 1.049505 1.050605 1.051705
[49] 1.052805 1.053905 1.055006 1.056106 1.057206 1.058306 1.059406 1.060506
[57] 1.061606 1.062706 1.063806 1.064906 1.066007 1.067107 1.068207 1.069307
[65] 1.070407 1.071507 1.072607 1.073707 1.074807 1.075908 1.077008 1.078108
[73] 1.079208 1.080308 1.081408 1.082508 1.083608 1.084708 1.085809 1.086909
[81] 1.088009 1.089109 1.090209 1.091309 1.092409 1.093509 1.094609 1.095710
[89] 1.096810 1.097910 1.099010 1.100110 1.101210 1.102310 1.103410 1.104510
[97] 1.105611 1.106711 1.107811 1.108911 1.110011 1.111111 1.112211 1.113311
[105] 1.114411 1.115512 1.116612 1.117712 1.118812 1.119912 1.121012 1.122112
[113] 1.123212 1.124312 1.125413 1.126513 1.127613 1.128713 1.129813 1.130913
[121] 1.132013 1.133113 1.134213 1.135314 1.136414 1.137514 1.138614 1.139714
[129] 1.140814 1.141914 1.143014 1.144114 1.145215 1.146315 1.147415 1.148515
[137] 1.149615 1.150715 1.151815 1.152915 1.154015 1.155116 1.156216 1.157316
[145] 1.158416 1.159516 1.160616 1.161716 1.162816 1.163916 1.165017 1.166117
[153] 1.167217 1.168317 1.169417 1.170517 1.171617 1.172717 1.173817 1.174917
[161] 1.176018 1.177118 1.178218 1.179318 1.180418 1.181518 1.182618 1.183718
[169] 1.184818 1.185919 1.187019 1.188119 1.189219 1.190319 1.191419 1.192519
[177] 1.193619 1.194719 1.195820 1.196920 1.198020 1.199120 1.200220 1.201320
[185] 1.202420 1.203520 1.204620 1.205721 1.206821 1.207921 1.209021 1.210121
[193] 1.211221 1.212321 1.213421 1.214521 1.215622 1.216722 1.217822 1.218922
[201] 1.220022 1.221122 1.222222 1.223322 1.224422 1.225523 1.226623 1.227723
[209] 1.228823 1.229923 1.231023 1.232123 1.233223 1.234323 1.235424 1.236524
[217] 1.237624 1.238724 1.239824 1.240924 1.242024 1.243124 1.244224 1.245325
[225] 1.246425 1.247525 1.248625 1.249725 1.250825 1.251925 1.253025 1.254125
[233] 1.255226 1.256326 1.257426 1.258526 1.259626 1.260726 1.261826 1.262926
[241] 1.264026 1.265127 1.266227 1.267327 1.268427 1.269527 1.270627 1.271727
[249] 1.272827 1.273927 1.275028 1.276128 1.277228 1.278328 1.279428 1.280528
[257] 1.281628 1.282728 1.283828 1.284928 1.286029 1.287129 1.288229 1.289329
[265] 1.290429 1.291529 1.292629 1.293729 1.294829 1.295930 1.297030 1.298130
[273] 1.299230 1.300330 1.301430 1.302530 1.303630 1.304730 1.305831 1.306931
[281] 1.308031 1.309131 1.310231 1.311331 1.312431 1.313531 1.314631 1.315732
[289] 1.316832 1.317932 1.319032 1.320132 1.321232 1.322332 1.323432 1.324532
[297] 1.325633 1.326733 1.327833 1.328933 1.330033 1.331133 1.332233 1.333333
[305] 1.334433 1.335534 1.336634 1.337734 1.338834 1.339934 1.341034 1.342134
[313] 1.343234 1.344334 1.345435 1.346535 1.347635 1.348735 1.349835 1.350935
[321] 1.352035 1.353135 1.354235 1.355336 1.356436 1.357536 1.358636 1.359736
[329] 1.360836 1.361936 1.363036 1.364136 1.365237 1.366337 1.367437 1.368537
[337] 1.369637 1.370737 1.371837 1.372937 1.374037 1.375138 1.376238 1.377338
[345] 1.378438 1.379538 1.380638 1.381738 1.382838 1.383938 1.385039 1.386139
[353] 1.387239 1.388339 1.389439 1.390539 1.391639 1.392739 1.393839 1.394939
[361] 1.396040 1.397140 1.398240 1.399340 1.400440 1.401540 1.402640 1.403740
[369] 1.404840 1.405941 1.407041 1.408141 1.409241 1.410341 1.411441 1.412541
[377] 1.413641 1.414741 1.415842 1.416942 1.418042 1.419142 1.420242 1.421342
[385] 1.422442 1.423542 1.424642 1.425743 1.426843 1.427943 1.429043 1.430143
[393] 1.431243 1.432343 1.433443 1.434543 1.435644 1.436744 1.437844 1.438944
[401] 1.440044 1.441144 1.442244 1.443344 1.444444 1.445545 1.446645 1.447745
[409] 1.448845 1.449945 1.451045 1.452145 1.453245 1.454345 1.455446 1.456546
[417] 1.457646 1.458746 1.459846 1.460946 1.462046 1.463146 1.464246 1.465347
[425] 1.466447 1.467547 1.468647 1.469747 1.470847 1.471947 1.473047 1.474147
[433] 1.475248 1.476348 1.477448 1.478548 1.479648 1.480748 1.481848 1.482948
[441] 1.484048 1.485149 1.486249 1.487349 1.488449 1.489549 1.490649 1.491749
[449] 1.492849 1.493949 1.495050 1.496150 1.497250 1.498350 1.499450 1.500550
[457] 1.501650 1.502750 1.503850 1.504950 1.506051 1.507151 1.508251 1.509351
[465] 1.510451 1.511551 1.512651 1.513751 1.514851 1.515952 1.517052 1.518152
[473] 1.519252 1.520352 1.521452 1.522552 1.523652 1.524752 1.525853 1.526953
[481] 1.528053 1.529153 1.530253 1.531353 1.532453 1.533553 1.534653 1.535754
[489] 1.536854 1.537954 1.539054 1.540154 1.541254 1.542354 1.543454 1.544554
[497] 1.545655 1.546755 1.547855 1.548955 1.550055 1.551155 1.552255 1.553355
[505] 1.554455 1.555556 1.556656 1.557756 1.558856 1.559956 1.561056 1.562156
[513] 1.563256 1.564356 1.565457 1.566557 1.567657 1.568757 1.569857 1.570957
[521] 1.572057 1.573157 1.574257 1.575358 1.576458 1.577558 1.578658 1.579758
[529] 1.580858 1.581958 1.583058 1.584158 1.585259 1.586359 1.587459 1.588559
[537] 1.589659 1.590759 1.591859 1.592959 1.594059 1.595160 1.596260 1.597360
[545] 1.598460 1.599560 1.600660 1.601760 1.602860 1.603960 1.605061 1.606161
[553] 1.607261 1.608361 1.609461 1.610561 1.611661 1.612761 1.613861 1.614961
[561] 1.616062 1.617162 1.618262 1.619362 1.620462 1.621562 1.622662 1.623762
[569] 1.624862 1.625963 1.627063 1.628163 1.629263 1.630363 1.631463 1.632563
[577] 1.633663 1.634763 1.635864 1.636964 1.638064 1.639164 1.640264 1.641364
[585] 1.642464 1.643564 1.644664 1.645765 1.646865 1.647965 1.649065 1.650165
[593] 1.651265 1.652365 1.653465 1.654565 1.655666 1.656766 1.657866 1.658966
[601] 1.660066 1.661166 1.662266 1.663366 1.664466 1.665567 1.666667 1.667767
[609] 1.668867 1.669967 1.671067 1.672167 1.673267 1.674367 1.675468 1.676568
[617] 1.677668 1.678768 1.679868 1.680968 1.682068 1.683168 1.684268 1.685369
[625] 1.686469 1.687569 1.688669 1.689769 1.690869 1.691969 1.693069 1.694169
[633] 1.695270 1.696370 1.697470 1.698570 1.699670 1.700770 1.701870 1.702970
[641] 1.704070 1.705171 1.706271 1.707371 1.708471 1.709571 1.710671 1.711771
[649] 1.712871 1.713971 1.715072 1.716172 1.717272 1.718372 1.719472 1.720572
[657] 1.721672 1.722772 1.723872 1.724972 1.726073 1.727173 1.728273 1.729373
[665] 1.730473 1.731573 1.732673 1.733773 1.734873 1.735974 1.737074 1.738174
[673] 1.739274 1.740374 1.741474 1.742574 1.743674 1.744774 1.745875 1.746975
[681] 1.748075 1.749175 1.750275 1.751375 1.752475 1.753575 1.754675 1.755776
[689] 1.756876 1.757976 1.759076 1.760176 1.761276 1.762376 1.763476 1.764576
[697] 1.765677 1.766777 1.767877 1.768977 1.770077 1.771177 1.772277 1.773377
[705] 1.774477 1.775578 1.776678 1.777778 1.778878 1.779978 1.781078 1.782178
[713] 1.783278 1.784378 1.785479 1.786579 1.787679 1.788779 1.789879 1.790979
[721] 1.792079 1.793179 1.794279 1.795380 1.796480 1.797580 1.798680 1.799780
[729] 1.800880 1.801980 1.803080 1.804180 1.805281 1.806381 1.807481 1.808581
[737] 1.809681 1.810781 1.811881 1.812981 1.814081 1.815182 1.816282 1.817382
[745] 1.818482 1.819582 1.820682 1.821782 1.822882 1.823982 1.825083 1.826183
[753] 1.827283 1.828383 1.829483 1.830583 1.831683 1.832783 1.833883 1.834983
[761] 1.836084 1.837184 1.838284 1.839384 1.840484 1.841584 1.842684 1.843784
[769] 1.844884 1.845985 1.847085 1.848185 1.849285 1.850385 1.851485 1.852585
[777] 1.853685 1.854785 1.855886 1.856986 1.858086 1.859186 1.860286 1.861386
[785] 1.862486 1.863586 1.864686 1.865787 1.866887 1.867987 1.869087 1.870187
[793] 1.871287 1.872387 1.873487 1.874587 1.875688 1.876788 1.877888 1.878988
[801] 1.880088 1.881188 1.882288 1.883388 1.884488 1.885589 1.886689 1.887789
[809] 1.888889 1.889989 1.891089 1.892189 1.893289 1.894389 1.895490 1.896590
[817] 1.897690 1.898790 1.899890 1.900990 1.902090 1.903190 1.904290 1.905391
[825] 1.906491 1.907591 1.908691 1.909791 1.910891 1.911991 1.913091 1.914191
[833] 1.915292 1.916392 1.917492 1.918592 1.919692 1.920792 1.921892 1.922992
[841] 1.924092 1.925193 1.926293 1.927393 1.928493 1.929593 1.930693 1.931793
[849] 1.932893 1.933993 1.935094 1.936194 1.937294 1.938394 1.939494 1.940594
[857] 1.941694 1.942794 1.943894 1.944994 1.946095 1.947195 1.948295 1.949395
[865] 1.950495 1.951595 1.952695 1.953795 1.954895 1.955996 1.957096 1.958196
[873] 1.959296 1.960396 1.961496 1.962596 1.963696 1.964796 1.965897 1.966997
[881] 1.968097 1.969197 1.970297 1.971397 1.972497 1.973597 1.974697 1.975798
[889] 1.976898 1.977998 1.979098 1.980198 1.981298 1.982398 1.983498 1.984598
[897] 1.985699 1.986799 1.987899 1.988999 1.990099 1.991199 1.992299 1.993399
[905] 1.994499 1.995600 1.996700 1.997800 1.998900 2.000000 2.001100 2.002200
[913] 2.003300 2.004400 2.005501 2.006601 2.007701 2.008801 2.009901 2.011001
[921] 2.012101 2.013201 2.014301 2.015402 2.016502 2.017602 2.018702 2.019802
[929] 2.020902 2.022002 2.023102 2.024202 2.025303 2.026403 2.027503 2.028603
[937] 2.029703 2.030803 2.031903 2.033003 2.034103 2.035204 2.036304 2.037404
[945] 2.038504 2.039604 2.040704 2.041804 2.042904 2.044004 2.045105 2.046205
[953] 2.047305 2.048405 2.049505 2.050605 2.051705 2.052805 2.053905 2.055006
[961] 2.056106 2.057206 2.058306 2.059406 2.060506 2.061606 2.062706 2.063806
[969] 2.064906 2.066007 2.067107 2.068207 2.069307 2.070407 2.071507 2.072607
[977] 2.073707 2.074807 2.075908 2.077008 2.078108 2.079208 2.080308 2.081408
[985] 2.082508 2.083608 2.084708 2.085809 2.086909 2.088009 2.089109 2.090209
[993] 2.091309 2.092409 2.093509 2.094609 2.095710 2.096810 2.097910 2.099010
[ reached getOption("max.print") -- omitted 9000 entries ]
- Create a vector to hold population sizes of same length as ‘log.tmpts’ filled with NaNs. Name it log.simu with variable assignment.
log.simu <- rep(NaN, times = 10000) # or you can replace 10000 with length(log.tmpts) can write length of that vector or the vector itself
log.simu
[1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[20] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[39] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[58] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[77] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[96] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[115] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[134] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[153] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[172] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[191] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[210] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[229] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[248] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[267] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[286] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[305] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[324] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[343] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[362] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[381] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[400] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[419] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[438] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[457] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[476] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[495] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[514] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[533] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[552] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[571] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[590] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[609] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[628] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[647] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[666] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[685] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[704] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[723] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[742] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[761] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[780] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[799] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[818] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[837] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[856] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[875] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[894] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[913] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[932] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[951] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[970] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[989] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[ reached getOption("max.print") -- omitted 9000 entries ]
- Input your initial condition within the log.simu vector
log.simu[1] <- MyAreas[1]
log.simu
[1] 113.0973 NaN NaN NaN NaN NaN NaN NaN
[9] NaN NaN NaN NaN NaN NaN NaN NaN
[17] NaN NaN NaN NaN NaN NaN NaN NaN
[25] NaN NaN NaN NaN NaN NaN NaN NaN
[33] NaN NaN NaN NaN NaN NaN NaN NaN
[41] NaN NaN NaN NaN NaN NaN NaN NaN
[49] NaN NaN NaN NaN NaN NaN NaN NaN
[57] NaN NaN NaN NaN NaN NaN NaN NaN
[65] NaN NaN NaN NaN NaN NaN NaN NaN
[73] NaN NaN NaN NaN NaN NaN NaN NaN
[81] NaN NaN NaN NaN NaN NaN NaN NaN
[89] NaN NaN NaN NaN NaN NaN NaN NaN
[97] NaN NaN NaN NaN NaN NaN NaN NaN
[105] NaN NaN NaN NaN NaN NaN NaN NaN
[113] NaN NaN NaN NaN NaN NaN NaN NaN
[121] NaN NaN NaN NaN NaN NaN NaN NaN
[129] NaN NaN NaN NaN NaN NaN NaN NaN
[137] NaN NaN NaN NaN NaN NaN NaN NaN
[145] NaN NaN NaN NaN NaN NaN NaN NaN
[153] NaN NaN NaN NaN NaN NaN NaN NaN
[161] NaN NaN NaN NaN NaN NaN NaN NaN
[169] NaN NaN NaN NaN NaN NaN NaN NaN
[177] NaN NaN NaN NaN NaN NaN NaN NaN
[185] NaN NaN NaN NaN NaN NaN NaN NaN
[193] NaN NaN NaN NaN NaN NaN NaN NaN
[201] NaN NaN NaN NaN NaN NaN NaN NaN
[209] NaN NaN NaN NaN NaN NaN NaN NaN
[217] NaN NaN NaN NaN NaN NaN NaN NaN
[225] NaN NaN NaN NaN NaN NaN NaN NaN
[233] NaN NaN NaN NaN NaN NaN NaN NaN
[241] NaN NaN NaN NaN NaN NaN NaN NaN
[249] NaN NaN NaN NaN NaN NaN NaN NaN
[257] NaN NaN NaN NaN NaN NaN NaN NaN
[265] NaN NaN NaN NaN NaN NaN NaN NaN
[273] NaN NaN NaN NaN NaN NaN NaN NaN
[281] NaN NaN NaN NaN NaN NaN NaN NaN
[289] NaN NaN NaN NaN NaN NaN NaN NaN
[297] NaN NaN NaN NaN NaN NaN NaN NaN
[305] NaN NaN NaN NaN NaN NaN NaN NaN
[313] NaN NaN NaN NaN NaN NaN NaN NaN
[321] NaN NaN NaN NaN NaN NaN NaN NaN
[329] NaN NaN NaN NaN NaN NaN NaN NaN
[337] NaN NaN NaN NaN NaN NaN NaN NaN
[345] NaN NaN NaN NaN NaN NaN NaN NaN
[353] NaN NaN NaN NaN NaN NaN NaN NaN
[361] NaN NaN NaN NaN NaN NaN NaN NaN
[369] NaN NaN NaN NaN NaN NaN NaN NaN
[377] NaN NaN NaN NaN NaN NaN NaN NaN
[385] NaN NaN NaN NaN NaN NaN NaN NaN
[393] NaN NaN NaN NaN NaN NaN NaN NaN
[401] NaN NaN NaN NaN NaN NaN NaN NaN
[409] NaN NaN NaN NaN NaN NaN NaN NaN
[417] NaN NaN NaN NaN NaN NaN NaN NaN
[425] NaN NaN NaN NaN NaN NaN NaN NaN
[433] NaN NaN NaN NaN NaN NaN NaN NaN
[441] NaN NaN NaN NaN NaN NaN NaN NaN
[449] NaN NaN NaN NaN NaN NaN NaN NaN
[457] NaN NaN NaN NaN NaN NaN NaN NaN
[465] NaN NaN NaN NaN NaN NaN NaN NaN
[473] NaN NaN NaN NaN NaN NaN NaN NaN
[481] NaN NaN NaN NaN NaN NaN NaN NaN
[489] NaN NaN NaN NaN NaN NaN NaN NaN
[497] NaN NaN NaN NaN NaN NaN NaN NaN
[505] NaN NaN NaN NaN NaN NaN NaN NaN
[513] NaN NaN NaN NaN NaN NaN NaN NaN
[521] NaN NaN NaN NaN NaN NaN NaN NaN
[529] NaN NaN NaN NaN NaN NaN NaN NaN
[537] NaN NaN NaN NaN NaN NaN NaN NaN
[545] NaN NaN NaN NaN NaN NaN NaN NaN
[553] NaN NaN NaN NaN NaN NaN NaN NaN
[561] NaN NaN NaN NaN NaN NaN NaN NaN
[569] NaN NaN NaN NaN NaN NaN NaN NaN
[577] NaN NaN NaN NaN NaN NaN NaN NaN
[585] NaN NaN NaN NaN NaN NaN NaN NaN
[593] NaN NaN NaN NaN NaN NaN NaN NaN
[601] NaN NaN NaN NaN NaN NaN NaN NaN
[609] NaN NaN NaN NaN NaN NaN NaN NaN
[617] NaN NaN NaN NaN NaN NaN NaN NaN
[625] NaN NaN NaN NaN NaN NaN NaN NaN
[633] NaN NaN NaN NaN NaN NaN NaN NaN
[641] NaN NaN NaN NaN NaN NaN NaN NaN
[649] NaN NaN NaN NaN NaN NaN NaN NaN
[657] NaN NaN NaN NaN NaN NaN NaN NaN
[665] NaN NaN NaN NaN NaN NaN NaN NaN
[673] NaN NaN NaN NaN NaN NaN NaN NaN
[681] NaN NaN NaN NaN NaN NaN NaN NaN
[689] NaN NaN NaN NaN NaN NaN NaN NaN
[697] NaN NaN NaN NaN NaN NaN NaN NaN
[705] NaN NaN NaN NaN NaN NaN NaN NaN
[713] NaN NaN NaN NaN NaN NaN NaN NaN
[721] NaN NaN NaN NaN NaN NaN NaN NaN
[729] NaN NaN NaN NaN NaN NaN NaN NaN
[737] NaN NaN NaN NaN NaN NaN NaN NaN
[745] NaN NaN NaN NaN NaN NaN NaN NaN
[753] NaN NaN NaN NaN NaN NaN NaN NaN
[761] NaN NaN NaN NaN NaN NaN NaN NaN
[769] NaN NaN NaN NaN NaN NaN NaN NaN
[777] NaN NaN NaN NaN NaN NaN NaN NaN
[785] NaN NaN NaN NaN NaN NaN NaN NaN
[793] NaN NaN NaN NaN NaN NaN NaN NaN
[801] NaN NaN NaN NaN NaN NaN NaN NaN
[809] NaN NaN NaN NaN NaN NaN NaN NaN
[817] NaN NaN NaN NaN NaN NaN NaN NaN
[825] NaN NaN NaN NaN NaN NaN NaN NaN
[833] NaN NaN NaN NaN NaN NaN NaN NaN
[841] NaN NaN NaN NaN NaN NaN NaN NaN
[849] NaN NaN NaN NaN NaN NaN NaN NaN
[857] NaN NaN NaN NaN NaN NaN NaN NaN
[865] NaN NaN NaN NaN NaN NaN NaN NaN
[873] NaN NaN NaN NaN NaN NaN NaN NaN
[881] NaN NaN NaN NaN NaN NaN NaN NaN
[889] NaN NaN NaN NaN NaN NaN NaN NaN
[897] NaN NaN NaN NaN NaN NaN NaN NaN
[905] NaN NaN NaN NaN NaN NaN NaN NaN
[913] NaN NaN NaN NaN NaN NaN NaN NaN
[921] NaN NaN NaN NaN NaN NaN NaN NaN
[929] NaN NaN NaN NaN NaN NaN NaN NaN
[937] NaN NaN NaN NaN NaN NaN NaN NaN
[945] NaN NaN NaN NaN NaN NaN NaN NaN
[953] NaN NaN NaN NaN NaN NaN NaN NaN
[961] NaN NaN NaN NaN NaN NaN NaN NaN
[969] NaN NaN NaN NaN NaN NaN NaN NaN
[977] NaN NaN NaN NaN NaN NaN NaN NaN
[985] NaN NaN NaN NaN NaN NaN NaN NaN
[993] NaN NaN NaN NaN NaN NaN NaN NaN
[ reached getOption("max.print") -- omitted 9000 entries ]
- Run the ‘for’ loop to calculate the remainder of the simulation values using the logistic growth function. The equation for logistic growth to populate within your for() loop is given for you below: deltaN = log.simu[i-1] * r.est * (1 - log.simu[i-1] / K.est) * deltat
for(i in 2:length(log.tmpts)){ # for i from second value to the length of log.tmpts
# 1. calculate change in time
deltat = log.tmpts[i] - log.tmpts[i-1]
# 2. calculate change in population size
deltaN = log.simu[i-1] * r.est * (1 - log.simu[i-1] / K.est) * deltat
# 3. calculate new population size at next time step
log.simu[i] = log.simu[i-1] + deltaN}
log.simu # output vector
[1] 113.0973 113.1698 113.2422 113.3148 113.3873 113.4599 113.5325 113.6052
[9] 113.6779 113.7507 113.8235 113.8963 113.9692 114.0421 114.1151 114.1881
[17] 114.2612 114.3342 114.4074 114.4805 114.5538 114.6270 114.7003 114.7736
[25] 114.8470 114.9204 114.9939 115.0674 115.1409 115.2145 115.2881 115.3618
[33] 115.4355 115.5093 115.5831 115.6569 115.7308 115.8047 115.8786 115.9526
[41] 116.0267 116.1008 116.1749 116.2490 116.3233 116.3975 116.4718 116.5461
[49] 116.6205 116.6949 116.7694 116.8439 116.9184 116.9930 117.0676 117.1423
[57] 117.2170 117.2917 117.3665 117.4413 117.5162 117.5911 117.6661 117.7411
[65] 117.8161 117.8912 117.9663 118.0415 118.1167 118.1920 118.2673 118.3426
[73] 118.4180 118.4934 118.5689 118.6444 118.7199 118.7955 118.8711 118.9468
[81] 119.0225 119.0983 119.1741 119.2499 119.3258 119.4017 119.4777 119.5537
[89] 119.6297 119.7058 119.7820 119.8582 119.9344 120.0106 120.0870 120.1633
[97] 120.2397 120.3161 120.3926 120.4691 120.5457 120.6223 120.6989 120.7756
[105] 120.8524 120.9291 121.0059 121.0828 121.1597 121.2367 121.3136 121.3907
[113] 121.4677 121.5449 121.6220 121.6992 121.7765 121.8537 121.9311 122.0084
[121] 122.0859 122.1633 122.2408 122.3184 122.3959 122.4736 122.5512 122.6290
[129] 122.7067 122.7845 122.8624 122.9403 123.0182 123.0962 123.1742 123.2522
[137] 123.3303 123.4085 123.4867 123.5649 123.6432 123.7215 123.7998 123.8782
[145] 123.9567 124.0352 124.1137 124.1923 124.2709 124.3496 124.4283 124.5070
[153] 124.5858 124.6647 124.7435 124.8225 124.9014 124.9804 125.0595 125.1386
[161] 125.2177 125.2969 125.3761 125.4554 125.5347 125.6141 125.6935 125.7729
[169] 125.8524 125.9319 126.0115 126.0911 126.1708 126.2505 126.3303 126.4101
[177] 126.4899 126.5698 126.6497 126.7297 126.8097 126.8897 126.9698 127.0500
[185] 127.1302 127.2104 127.2907 127.3710 127.4514 127.5318 127.6122 127.6927
[193] 127.7732 127.8538 127.9344 128.0151 128.0958 128.1766 128.2574 128.3382
[201] 128.4191 128.5001 128.5810 128.6621 128.7431 128.8242 128.9054 128.9866
[209] 129.0678 129.1491 129.2305 129.3118 129.3933 129.4747 129.5562 129.6378
[217] 129.7194 129.8010 129.8827 129.9644 130.0462 130.1280 130.2099 130.2918
[225] 130.3737 130.4557 130.5378 130.6199 130.7020 130.7842 130.8664 130.9487
[233] 131.0310 131.1133 131.1957 131.2782 131.3606 131.4432 131.5258 131.6084
[241] 131.6910 131.7737 131.8565 131.9393 132.0221 132.1050 132.1880 132.2709
[249] 132.3540 132.4370 132.5201 132.6033 132.6865 132.7697 132.8530 132.9364
[257] 133.0198 133.1032 133.1867 133.2702 133.3537 133.4373 133.5210 133.6047
[265] 133.6884 133.7722 133.8560 133.9399 134.0238 134.1078 134.1918 134.2759
[273] 134.3600 134.4441 134.5283 134.6126 134.6968 134.7812 134.8655 134.9500
[281] 135.0344 135.1189 135.2035 135.2881 135.3727 135.4574 135.5422 135.6269
[289] 135.7118 135.7966 135.8816 135.9665 136.0515 136.1366 136.2217 136.3068
[297] 136.3920 136.4772 136.5625 136.6478 136.7332 136.8186 136.9041 136.9896
[305] 137.0752 137.1608 137.2464 137.3321 137.4178 137.5036 137.5894 137.6753
[313] 137.7612 137.8472 137.9332 138.0193 138.1054 138.1915 138.2777 138.3640
[321] 138.4502 138.5366 138.6230 138.7094 138.7958 138.8824 138.9689 139.0555
[329] 139.1422 139.2289 139.3156 139.4024 139.4893 139.5761 139.6631 139.7500
[337] 139.8371 139.9241 140.0112 140.0984 140.1856 140.2729 140.3602 140.4475
[345] 140.5349 140.6223 140.7098 140.7973 140.8849 140.9725 141.0602 141.1479
[353] 141.2357 141.3235 141.4113 141.4992 141.5872 141.6752 141.7632 141.8513
[361] 141.9394 142.0276 142.1158 142.2041 142.2924 142.3808 142.4692 142.5577
[369] 142.6462 142.7347 142.8233 142.9119 143.0006 143.0894 143.1782 143.2670
[377] 143.3559 143.4448 143.5338 143.6228 143.7118 143.8009 143.8901 143.9793
[385] 144.0686 144.1578 144.2472 144.3366 144.4260 144.5155 144.6050 144.6946
[393] 144.7842 144.8739 144.9636 145.0534 145.1432 145.2331 145.3230 145.4129
[401] 145.5029 145.5930 145.6831 145.7732 145.8634 145.9536 146.0439 146.1342
[409] 146.2246 146.3150 146.4055 146.4960 146.5866 146.6772 146.7678 146.8586
[417] 146.9493 147.0401 147.1310 147.2218 147.3128 147.4038 147.4948 147.5859
[425] 147.6770 147.7682 147.8594 147.9507 148.0420 148.1334 148.2248 148.3163
[433] 148.4078 148.4993 148.5909 148.6826 148.7743 148.8660 148.9578 149.0497
[441] 149.1416 149.2335 149.3255 149.4175 149.5096 149.6017 149.6939 149.7861
[449] 149.8784 149.9707 150.0631 150.1555 150.2479 150.3405 150.4330 150.5256
[457] 150.6183 150.7110 150.8037 150.8965 150.9894 151.0822 151.1752 151.2682
[465] 151.3612 151.4543 151.5474 151.6406 151.7338 151.8271 151.9204 152.0138
[473] 152.1072 152.2007 152.2942 152.3877 152.4813 152.5750 152.6687 152.7625
[481] 152.8563 152.9501 153.0440 153.1379 153.2319 153.3260 153.4201 153.5142
[489] 153.6084 153.7026 153.7969 153.8912 153.9856 154.0800 154.1745 154.2690
[497] 154.3636 154.4582 154.5529 154.6476 154.7424 154.8372 154.9321 155.0270
[505] 155.1219 155.2169 155.3120 155.4071 155.5022 155.5974 155.6927 155.7880
[513] 155.8833 155.9787 156.0742 156.1697 156.2652 156.3608 156.4564 156.5521
[521] 156.6478 156.7436 156.8394 156.9353 157.0312 157.1272 157.2232 157.3193
[529] 157.4154 157.5116 157.6078 157.7041 157.8004 157.8968 157.9932 158.0897
[537] 158.1862 158.2827 158.3793 158.4760 158.5727 158.6695 158.7663 158.8631
[545] 158.9600 159.0570 159.1540 159.2510 159.3481 159.4453 159.5425 159.6397
[553] 159.7370 159.8343 159.9317 160.0292 160.1267 160.2242 160.3218 160.4194
[561] 160.5171 160.6148 160.7126 160.8104 160.9083 161.0063 161.1042 161.2023
[569] 161.3003 161.3985 161.4966 161.5949 161.6931 161.7915 161.8898 161.9883
[577] 162.0867 162.1853 162.2838 162.3824 162.4811 162.5798 162.6786 162.7774
[585] 162.8763 162.9752 163.0742 163.1732 163.2722 163.3713 163.4705 163.5697
[593] 163.6690 163.7683 163.8676 163.9671 164.0665 164.1660 164.2656 164.3652
[601] 164.4648 164.5645 164.6643 164.7641 164.8640 164.9639 165.0638 165.1638
[609] 165.2639 165.3640 165.4641 165.5643 165.6646 165.7649 165.8652 165.9656
[617] 166.0661 166.1666 166.2671 166.3677 166.4684 166.5691 166.6698 166.7706
[625] 166.8715 166.9724 167.0733 167.1743 167.2753 167.3764 167.4776 167.5788
[633] 167.6800 167.7813 167.8827 167.9841 168.0855 168.1870 168.2885 168.3901
[641] 168.4918 168.5935 168.6952 168.7970 168.8989 169.0008 169.1027 169.2047
[649] 169.3067 169.4088 169.5110 169.6132 169.7154 169.8177 169.9201 170.0225
[657] 170.1249 170.2274 170.3300 170.4325 170.5352 170.6379 170.7406 170.8434
[665] 170.9463 171.0492 171.1521 171.2551 171.3582 171.4613 171.5644 171.6676
[673] 171.7709 171.8742 171.9775 172.0809 172.1844 172.2879 172.3914 172.4950
[681] 172.5987 172.7024 172.8061 172.9099 173.0138 173.1177 173.2216 173.3256
[689] 173.4297 173.5338 173.6380 173.7422 173.8464 173.9507 174.0551 174.1595
[697] 174.2640 174.3685 174.4730 174.5776 174.6823 174.7870 174.8918 174.9966
[705] 175.1014 175.2064 175.3113 175.4163 175.5214 175.6265 175.7317 175.8369
[713] 175.9422 176.0475 176.1529 176.2583 176.3638 176.4693 176.5748 176.6805
[721] 176.7861 176.8919 176.9976 177.1035 177.2093 177.3153 177.4213 177.5273
[729] 177.6334 177.7395 177.8457 177.9519 178.0582 178.1645 178.2709 178.3774
[737] 178.4838 178.5904 178.6970 178.8036 178.9103 179.0170 179.1238 179.2307
[745] 179.3376 179.4445 179.5515 179.6586 179.7657 179.8728 179.9800 180.0873
[753] 180.1946 180.3019 180.4093 180.5168 180.6243 180.7319 180.8395 180.9471
[761] 181.0548 181.1626 181.2704 181.3783 181.4862 181.5942 181.7022 181.8103
[769] 181.9184 182.0266 182.1348 182.2431 182.3514 182.4598 182.5682 182.6767
[777] 182.7852 182.8938 183.0024 183.1111 183.2198 183.3286 183.4375 183.5464
[785] 183.6553 183.7643 183.8733 183.9824 184.0916 184.2008 184.3100 184.4193
[793] 184.5287 184.6381 184.7476 184.8571 184.9666 185.0762 185.1859 185.2956
[801] 185.4054 185.5152 185.6250 185.7350 185.8449 185.9550 186.0650 186.1752
[809] 186.2853 186.3956 186.5058 186.6162 186.7266 186.8370 186.9475 187.0580
[817] 187.1686 187.2792 187.3899 187.5007 187.6115 187.7223 187.8332 187.9442
[825] 188.0552 188.1662 188.2773 188.3885 188.4997 188.6110 188.7223 188.8336
[833] 188.9451 189.0565 189.1680 189.2796 189.3912 189.5029 189.6146 189.7264
[841] 189.8382 189.9501 190.0621 190.1740 190.2861 190.3982 190.5103 190.6225
[849] 190.7347 190.8470 190.9594 191.0718 191.1842 191.2967 191.4093 191.5219
[857] 191.6346 191.7473 191.8600 191.9728 192.0857 192.1986 192.3116 192.4246
[865] 192.5377 192.6508 192.7640 192.8772 192.9905 193.1039 193.2172 193.3307
[873] 193.4442 193.5577 193.6713 193.7850 193.8987 194.0124 194.1262 194.2401
[881] 194.3540 194.4679 194.5819 194.6960 194.8101 194.9243 195.0385 195.1528
[889] 195.2671 195.3815 195.4959 195.6104 195.7249 195.8395 195.9541 196.0688
[897] 196.1836 196.2983 196.4132 196.5281 196.6430 196.7580 196.8731 196.9882
[905] 197.1034 197.2186 197.3338 197.4491 197.5645 197.6799 197.7954 197.9109
[913] 198.0265 198.1421 198.2578 198.3735 198.4893 198.6052 198.7210 198.8370
[921] 198.9530 199.0690 199.1851 199.3013 199.4175 199.5337 199.6500 199.7664
[929] 199.8828 199.9993 200.1158 200.2324 200.3490 200.4657 200.5824 200.6992
[937] 200.8160 200.9329 201.0498 201.1668 201.2838 201.4009 201.5181 201.6353
[945] 201.7525 201.8698 201.9872 202.1046 202.2221 202.3396 202.4571 202.5748
[953] 202.6924 202.8102 202.9279 203.0458 203.1636 203.2816 203.3996 203.5176
[961] 203.6357 203.7538 203.8720 203.9903 204.1086 204.2269 204.3453 204.4638
[969] 204.5823 204.7009 204.8195 204.9381 205.0569 205.1756 205.2945 205.4133
[977] 205.5323 205.6513 205.7703 205.8894 206.0085 206.1277 206.2470 206.3663
[985] 206.4856 206.6050 206.7245 206.8440 206.9635 207.0832 207.2028 207.3225
[993] 207.4423 207.5621 207.6820 207.8020 207.9219 208.0420 208.1621 208.2822
[ reached getOption("max.print") -- omitted 9000 entries ]
- Plot the results.
plot(x = ExptDays, y = MyAreas, xlab='Experimental Timepoints', ylab='Colony Area', las=1, ylim = c(0, 1.5 * max(MyAreas))) # Plots experimental data
lines(x = exp.tmpts, y = exp.simu,col='blue') # Overlay the exponential growth simulation result
lines(x = log.tmpts, y= log.simu,col='green') # Overlay the logistic growth simulation result

How’d it go? Did you get a good fit? Why or why not? No.
Do you think changes to any of your parameters might help your model fit better? Try them, and see!
Maybe I’ve underestimated K or growth rate. Change r to a higher number and will get model to fit better. Go back and plot only the first 3 values instead of 4 so it fits the lines better.
use line with the steepest slope
H. Download Class Data
- Download the class data from the Google Sheet in .csv format
https://docs.google.com/spreadsheets/d/1JnXW5A7k1buTT77MK5Ravoh1gXSJ8fw5oS8nCqlpSqs/edit#gid=0
6pm: https://docs.google.com/spreadsheets/d/1VfacGmZ6VXSxB85s4EbJzqcZEKHkJ8Kx059yn4AS9fY/edit#gid=0
Set your working directory
Your working directory is where R will look to load files into your environment pane and where your output files will be stored if you wish to export them from your R environment to your local disk.
Let’s check where the working directory is with the getwd() function:
getwd()
- Your working directory will be different. If you wish to change your working directory you can do so by changing the path to where R looks:
setwd("/Users/saigeberman/Downloads")
# Why are quotation marks needed? It does not work otherwise. Also it needs to be recognized as a file patch
- You can also change your working directory by pressing ‘Session’ > ‘Set Working Directory’ > ‘Choose Working Directory’
# Put the spreadsheet in your working directory. Read the spreadsheet in with the read.csv function and name it 'ClassData' with variable assignment.
ClassData <- read.csv("EEMB179_279_W20_Lab2_ClassData_6pm - Sheet1.csv", header = TRUE)
# look at the data !!
View(ClassData)
str(ClassData)
'data.frame': 27 obs. of 16 variables:
$ Plate : int 1 2 3 4 5 6 7 8 9 10 ...
$ Species : Factor w/ 3 levels "M. luteus","S. marcescens",..: 2 2 2 2 2 2 2 2 2 3 ...
$ Temperature: Factor w/ 3 levels "18C","24C","30C": 1 1 1 2 2 2 3 3 3 1 ...
$ StudentName: Factor w/ 23 levels "Alexander Hakanson",..: 23 12 10 22 18 9 20 21 13 15 ...
$ Day1 : num 0.6 5 4 5 12 13.5 12 12 11 4 ...
$ Day2 : num 0.9 8 10 7 18 18.5 18 19 16 5 ...
$ Day3 : num 1.2 12 12 10 20 23 23 25 21 NA ...
$ Day5 : num 1.7 16 14 12 26 30 30 32 26 7 ...
$ Day6 : num 2.3 NA NA 16 30 34 31 34 28 NA ...
$ Day8 : num 2.5 21 20 18 38 40 34 37 32 9 ...
$ Day10 : num 2.8 25.5 24 22 42 42 NA NA NA NA ...
$ Day12 : num 3.1 28 28 25 46 46 37 39 34 10 ...
$ Day16 : int NA NA NA NA NA 48 NA NA NA NA ...
$ r.est : Factor w/ 12 levels "","0.1767598",..: 12 11 1 9 6 7 10 1 1 5 ...
$ K.est : num 7.55 615.75 NA 380.13 415.48 ...
$ X : logi NA NA NA NA NA NA ...
ClassData$r.est <- as.numeric(as.character(ClassData$r.est))
NAs introduced by coercion
Trust your classmates? You can go ahead and use their estimated r and K values in the columns ‘r.est’ and ‘K.est’. Don’t trust them? Their raw diameter data are included in the Google Sheet so that you can re-calculate everything if you want to. :)
I. Compare Species Traits
- Make a box plot of growth rates by species
boxplot(ClassData$r.est~ClassData$Species, las=1, xlab='Species', ylab='Estimated growth rate, r')

HINT: If you prefer barplots to boxplots, I like ‘bargraph.CI’ from the ‘sciplot’ package as a quick plotting tool that will automatically compute error bars…
require(sciplot)
Loading required package: sciplot
bargraph.CI(Species,r.est,group=Temperature,data=ClassData,xlab='Species',ylab='Estimated growth rate, r',legend=TRUE,bty='y',x.leg=14.3)

- Is growth rate affected by the temperature at which the plate was incubated?
boxplot(ClassData$r.est~ClassData$Temperature*ClassData$Species)

- Are growth rates significantly different? We’ll perform an ANOVA using the ‘aov’ command. The ‘TukeyHSD’ wrapper function performs a Tukey’s Honestly Significant Difference test to correct for the testing of multiple hypotheses (i.e., that species X is different from species Y and X is different from Z and so forth)
aov(r.est~Species,data=ClassData) # response (r.est) ~ group (Species) , call data
Call:
aov(formula = r.est ~ Species, data = ClassData)
Terms:
Species Residuals
Sum of Squares 0.0970662 0.1078413
Deg. of Freedom 1 8
Residual standard error: 0.1161041
Estimated effects may be unbalanced
17 observations deleted due to missingness
TukeyHSD(aov(r.est~Species,data=ClassData))
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = r.est ~ Species, data = ClassData)
$Species
diff lwr upr p adj
S. marcescens D1-S. marcescens -0.1970444 -0.3663758 -0.02771291 0.027779
- In looking at the output, pay attention to the ‘p adj’ column, which shows the p-value (the ‘adj’ refers to adjustment by the Tukey test). This isn’t a stats class, but if the p-value is less than 0.05 we can say that the species being compared (listed in the leftmost column of the output) have significantly different growth rates.
What happens when we account for the different temperatures at which plates were incubated?
TukeyHSD(aov(r.est~Temperature,data=ClassData[ClassData$Species=="M. luteus",])) # The bracketed portion of this command allows us to subset the data so that we're considering our results species by species.
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
- Do the same comparison for carrying capacities.
TukeyHSD(aov(K.est~Temperature,data=ClassData[ClassData$Species== "S. marcescens D1",]))
#take class data frame and only look at data that applies to S marcescens D1 in only 1 column
- Let’s make a bifrucation diagram
# Make a sequence of carrying capacities to iterate over
Kset <- seq(from = 1, to = 100, length.out = 100)
# Make a holding vector to hold N* of the same length as Kset
Nstarset <- NaN*Kset
# Increase timepoints to iterate over to make sure we're at equilibrium
log.tmpts <- seq(from = min(ExptDays), to = max(ExptDays)+10, length = 1000)
# Nested for loop
for(j in 1:length(Kset)){ # Iterate over values of carrying capacity
K <- Kset[j] # for every variable in Kset, use variable assignment to set it as K
N.simu <- NaN*log.tmpts; N.simu[1] <- MyAreas[1] # Make a holding vector for simulated N values; set the initial condition as day 1 of colony areas
for(i in 2:length(log.tmpts)){ # iterate over timepoints for the logistic simulation
deltat = log.tmpts[i] - log.tmpts[i-1]
N <- N.simu[i-1]
deltaN = N * r.est * (1 - N / K) * deltat
N.simu[i] = N + deltaN
}
Nstarset[j] <- N.simu[length(log.tmpts)] # pull the last value of N.simu at equilibrium and store within Nstarset
}
plot(Kset, Nstarset, type='l', lwd=2, xlab = "Carrying Capacity, K", ylab = "Stable Equilibria of Popn Size, N*")
abline(v = 1, h = 1, col = 'red') # to demonstrate N* = K
abline(v = 50, h = 50, col = 'red') # to demonstrate N* = K
abline(v = 100, h = 100, col = 'red') # to demonstrate N* = K

J. Homework
Output these plots: (1) Plot of your COLONY AREA DATA, overlaid by your exponential and logistic model fits. Be sure to include a legend indicating which model fit is which!
log.tmpts<- seq(from = min(ExptDays), to = max(ExptDays), length = 1000)
log.simu<-rep(NaN, length(log.tmpts))
log.simu[1] = MyAreas[1]
for(i in 2:length(log.tmpts)){
deltat = log.tmpts[i] - log.tmpts[i-1]
deltaN = log.simu[i-1] * r.est * (1 - log.simu[i-1] / K.est) * deltat
log.simu[i] = log.simu[i-1] + deltaN
}
plot(x = ExptDays, y = MyAreas, xlab='Experimental Timepoints', ylab='Colony Area', las=1, ylim = c(0, 1.5 * max(MyAreas)))
lines(x = exp.tmpts, y = exp.simu,col='blue')
lines(x = log.tmpts, y= log.simu,col='green')
legend("topleft", legend=c("Exponential", "Logistic"),
col=c("blue", "green"), lty=1:1, cex=0.8)

?legend
/1 for your colony area data
/1 for exponential fit
/1 for logistic model fit
/1 for correct legend
= /4 points total
- Boxplot (or bargraph) of class GROWTH RATE estimates by species and incubation temperature.
boxplot(ClassData$r.est~ClassData$Temperature*ClassData$Species)

/1 if your graph is a bar or boxplot
/1 for correct response variable (growth rate)
/1 for categorical species x-axis
/1 for categorical colony-per-plate x-axis
= /4 points total
- Boxplot (or bargraph) of class CARRYING CAPACITY estimates by species and incubation temperature.
boxplot(ClassData$K.est~ClassData$Temperature*ClassData$Species)

/1 if your graph is a bar or boxplot
/1 for correct response variable (carrying capacity)
/1 for categorical species x-axis
/1 for categorical colony-per-plate x-axis
= /4 points
Comment on the following: (1) Which of your model runs ‘fit’ your empirical data best? Why? What discrepancies were there, and what might improve the model fit?
The model run that ‘fit’ my empirical data the best was the logistical model fit. I increased the r.est and decreased the range where the x value points were linear. This makes sense because as you look at the numerical data, the x values level off.A discrepency could have been the estimate not being very accurate. If the estimates of k and r are off even a little bit then the whole logisitcal and exponential lines would shift. Increasing the r.est and decreasing the range at which the x value points are linear would improve the model fit.
/1 point for model fit /1 point for explanation /1 point for discrepancies /1 point for adjustments to improve model fit = /4 points
- Compare and contrast the different species in terms of their growth rates and carrying capacities. What are some possible explanations for differences that you observed?
Both S. marcescens and S. marcescens D1 have increased growth rates. However, S. marcescens has a higher carrying capacity than S. marcescens D1. A possible explanation for the observed differences could be due to S. marcescens D1 being a very unstable species where it does not have a high carrying capacity and consistently is unable to reproduce enough to reach carrying capacity.
/2 points for comparison and contrast /2 points for explanations that integrate the biology or ecology of these organisms = /4 points
Total = /20
LS0tCnRpdGxlOiAnRUVNQiAxNzkgLS0gTGFiIDI6IE1pY3JvYmlhbCBHcm93dGggTW9kZWxzJwpkYXRlOiAiSmFudWFyeSAxNiwgMjAyMCIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6IGRlZmF1bHQKICBodG1sX2RvY3VtZW50OiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0CiAgd29yZF9kb2N1bWVudDogZGVmYXVsdAotLS0KCiMjIyBDbGFzcyBBbm5vdW5jZW1lbnRzCgoqIENvbXB1dGVyIExhYiBBdHRlbmRhbmNlOiAKRmx1ZW5jeSBpbiBhbnkgbGFuZ3VhZ2UgcmVxdWlyZXMgcHJhY3RpY2UuIEdyb3VwIHNldHRpbmdzIHdoZXJlIHlvdSBjYW4gJ3NwZWFrJyB0aGUgbGFuZ3VhZ2Ugb2YgY29tcHV0ZXIgc2NpZW5jZSB3aXRoIHlvdXIgcGVlcnMgYW5kIGluc3RydWN0b3JzIHdpbGwgaGVscCBidWlsZCB5b3VyIHNraWxscyBhcyBhIGNvbmZpZGVudCBjb2Rlci4gWW91ciBpbnN0cnVjdG9ycyBoYXZlIGNhcmVmdWxseSBhbm5vdGF0ZWQgZWFjaCBsYWIgdG8gc3VwcG9ydCBzZWxmLXN0dWR5IG91dHNpZGUgb2YgY2xhc3MsIGJ1dCB3ZSBtdXN0IGVtcGhhc2l6ZSB0aGF0IHdlZWtseSBsYWIgYXR0ZW5kYW5jZSBpcyBleHBlY3RlZCBmb3IgYWxsIHN0dWRlbnRzLiBZb3UgbXVzdCByZWFjaCBvdXQgdG8geW91ciBpbnN0cnVjdG9ycyB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