-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoth.R
More file actions
54 lines (49 loc) · 1.24 KB
/
moth.R
File metadata and controls
54 lines (49 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
mothGeneration <- function(repFemales, fecundity, femaleProb, hatchProb, pupateProb, ecloseProb, repProb){
eggs <- sum(rpois(repFemales, fecundity))
femaleEggs <- rbinom(n=1, size=eggs, prob=femaleProb)
femaleLarvae <- rbinom(n=1, size=femaleEggs, prob=hatchProb)
femalePupae <- rbinom(n=1, size=femaleLarvae, prob=pupateProb)
femaleAdults <- rbinom(n=1, size=femalePupae, prob=ecloseProb)
repFemalesNew <- rbinom(n=1, size=femaleAdults, prob=repProb)
print(paste("There were: "
, eggs, "eggs produced. "
, femaleEggs, "female eggs. "
, femaleLarvae, "female larvae. "
, femalePupae, "female pupae. "
, femaleAdults, "emergent females. "
, repFemalesNew, "reproductive females. "
))
}
set.seed(202)
mothGeneration(repFemales=10
, fecundity=600
, femaleProb=0.5
, hatchProb=0.1
, pupateProb=0.1
, ecloseProb=0.5
, repProb=0.5
)
mothGeneration(repFemales=10
, fecundity=600
, femaleProb=0.5
, hatchProb=0.1
, pupateProb=0.1
, ecloseProb=0.5
, repProb=0.5
)
mothGeneration(repFemales=10
, fecundity=600
, femaleProb=0.5
, hatchProb=0.1
, pupateProb=0.1
, ecloseProb=0.5
, repProb=0.5
)
mothGeneration(repFemales=10
, fecundity=600
, femaleProb=0.5
, hatchProb=0.1
, pupateProb=0.1
, ecloseProb=0.5
, repProb=0.5
)