Skip to content

Commit 7c5daf4

Browse files
committed
test for permute
1 parent 5d18608 commit 7c5daf4

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

test/missing_test.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module MissingTest
2+
3+
using MultiResponseVarianceComponentModels
4+
using Test
5+
6+
@testset "permute" begin
7+
Y = reshape(1:16, 4, 4)
8+
Y_miss = Matrix{Union{Float64, Missing}}(missing, size(Y))
9+
copy!(Y_miss, Y)
10+
Y_miss[[1, 5, 6, 15, 16]] .= missing
11+
P, invP, n_miss, Y_imputed = permute(Y_miss)
12+
@test P == [2, 3, 4, 7, 8, 9, 10, 11, 12, 13, 14, 1, 5, 6, 15, 16]
13+
@test invP == [12, 1, 2, 3, 13, 14, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16]
14+
@test n_miss == 5
15+
@test Y_imputed == [3.0 7.5 9.0 13.0; 2.0 7.5 10.0 14.0; 3.0 7.0 11.0 13.5; 4.0 8.0 12.0 13.5]
16+
end
17+
18+
end
19+

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include("fit_test.jl")
22
include("eigen_test.jl")
3+
include("missing_test.jl")
34
# include("mvcalculus_test.jl")

0 commit comments

Comments
 (0)