-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patht-test.jl
More file actions
59 lines (53 loc) · 1.26 KB
/
t-test.jl
File metadata and controls
59 lines (53 loc) · 1.26 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
55
56
57
58
59
using LinearAlgebra
using Colors
using StatsBase
using HypothesisTests
using Random
using BSON: @load
values_hill = []
for i in 1:60
global values_hill
DIR = "genomes_roll_hill"
@load "$DIR/worker_$(lpad(i, 2, "0"))_results.bson" results
fit = results[end][3]
push!(values_hill, fit)
end
values_hill = []
for i in 1:60
global values_hill
DIR = "genomes_roll_hill"
open("$DIR/worker_$(lpad(i, 2, "0"))_best.txt") do f
fit = parse(Float64, read(f, String))
push!(values_hill, fit)
end
end
values_15 = []
for i in 1:60
global values_15
DIR = "genomes_15"
@load "$DIR/worker_$(lpad(i, 2, "0"))_results.bson" results
fit = results[end][3]
push!(values_15, fit)
end
values_15 = []
for i in 1:60
global values_15
DIR = "genomes_15"
open("$DIR/worker_$(lpad(i, 2, "0"))_best.txt") do f
fit = parse(Float64, read(f, String))
push!(values_15, fit)
end
end
x = values_hill
y = values_15
println(x)
println(y)
nx, ny = length(x), length(y)
xbar = StatsBase.mean(x)-StatsBase.mean(y)
varx, vary = StatsBase.var(x), StatsBase.var(y)
stderr = sqrt(varx/nx + vary/ny)
t = (xbar-0)/stderr
df = (varx / nx + vary / ny)^2 / ((varx / nx)^2 / (nx - 1) + (vary / ny)^2 / (ny - 1))
test = UnequalVarianceTTest(nx, ny, xbar, df, stderr, t, 0)
@show mean(x), mean(y)
@show pvalue(test)