-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeKort05.jl
56 lines (55 loc) · 2.56 KB
/
deKort05.jl
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
55
56
# de Kort, S. R., Dickinson, A., and Clayton, N. S. (2005), Retrospective
# cognition by food-caching western scrub-jays, Learning and Motivation
# 36:159-176
function _summarize(::Experiment{:deKort05}, results)
datainspectpeanut = @where(results, :action .== "inspect", :foodtype .== "peanut")
datainspectwaxworm = @where(results, :action .== "inspect", :foodtype .== "other")
data = @transform datainspectwaxworm counts = datainspectwaxworm.counts ./
(1e-16 .+ datainspectpeanut.counts .+ datainspectwaxworm.counts)
combine(groupby(data, [:group, :action, :set, :RI]),
d -> DataFrame(μ = mean(d.counts), sem = sem(d.counts),
firstinspection = mean(d.firstinspection),
n = length(d.counts)))
end
function statistical_tests(exp::Experiment{:deKort05}, data)
tests = Test[]
id = "inspect"
push!(tests, Test(id,
splitplotanova(@where(data, :action .== "inspect"),
exp.tests[id].locals,
betweenfactors = :group,
withinfactors = [:RI, :set, :foodtype],
id = :id, data = :counts),
exp.tests))
d = @where(data, :action .== "inspect", :set .== 8)
sort!(d, [:id, :foodtype, :RI])
push!(tests, Test("first inspect trial 8",
chisqtest(firstinspect_dist(@where(d, :group .== "degrade")),
firstinspect_dist(@where(d, :group .== "ripen"))),
exp.tests))
TestCollection(tests)
end
function run!(::Experiment{:deKort05}, models)
results = DataFrame(group = Union{String,Missing}[],
foodtype = Union{String,Missing}[],
id = Int[], set = Int[], trial = Union{String,Missing}[],
RI = Union{Int,Missing}[],
action = String[], counts = Int[],
firstinspection = Union{Missing,Int}[])
id = 0
for group in ("degrade", "ripen")
for i in 1:(group == "degrade" ? 5 : 7)
id += 1
m = models[id]
for set in 1:8
for RI in (4u"hr", 28u"hr")
Clayton01_trial!(m, results, group, id, set, Peanut,
Waxworm, RI,
degrade = isdegrade(group, Waxworm, RI),
pilfer = false)
end
end
end
end
results
end