Skip to content

Commit

Permalink
Update to BlockArrays v0.3.0, ambiguous stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbates committed Mar 2, 2018
1 parent 56dd4af commit 7c593a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
julia 0.6.1
ArgCheck
BlockArrays
BlockArrays 0.3.0
CategoricalArrays
DataFrames 0.11.0
Distributions 0.11
Expand Down
4 changes: 2 additions & 2 deletions src/pls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function LinearMixedModel(f, trms, wts)
reweight!.(trms, Vector[sqrtwts])
end
nt = length(trms)
A = BlockArray(AbstractMatrix{T}, sz, sz)
L = BlockArray(AbstractMatrix{T}, sz, sz)
A = BlockArrays._BlockArray(AbstractMatrix{T}, sz, sz)
L = BlockArrays._BlockArray(AbstractMatrix{T}, sz, sz)
for j in 1:nt, i in j:nt
Lij = L[Block(i,j)] = densify(trms[i]'trms[j])
A[Block(i,j)] = deepcopy(isa(Lij, BlockedSparse) ? Lij.cscmat : Lij)
Expand Down
14 changes: 7 additions & 7 deletions test/pls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end
@test isapprox(logdet(fm1), 8.06014522999825, atol=0.001)
@test isapprox(varest(fm1), 2451.2501089607676, atol=0.001)
@test isapprox(pwrss(fm1), 73537.49947885796, atol=0.001)
@test isapprox(stderr(fm1), [17.69455188898009], atol=0.0001)
@test isapprox(StatsBase.stderr(fm1), [17.69455188898009], atol=0.0001)

vc = VarCorr(fm1)
show(IOBuffer(), vc)
Expand All @@ -62,7 +62,7 @@ end
@test objective(fm) 162.87303665382575
@test abs(std(fm)[1][1]) < 1.0e-9
@test std(fm)[2] [3.653231351374652]
@test stderr(fm) [0.6669857396443261]
@test StatsBase.stderr(fm) [0.6669857396443261]
@test coef(fm) [5.6656]
@test logdet(fm) 0.0
refit!(fm, dat[:Dyestuff][:Y])
Expand All @@ -81,7 +81,7 @@ end
@test isapprox(coef(fm), [22.97222222222222], atol=0.001)
@test isapprox(fixef(fm), [22.97222222222222], atol=0.001)
@test coef(fm)[1] mean(dat[:Penicillin][:Y])
@test isapprox(stderr(fm), [0.7445960346851368], atol=0.0001)
@test isapprox(StatsBase.stderr(fm), [0.7445960346851368], atol=0.0001)
@test isapprox(getθ(fm), [1.5375772376554968, 3.219751321180035], atol=0.001)
@test isapprox(std(fm)[1], [0.8455645948223015], atol=0.0001)
@test isapprox(std(fm)[2], [1.770647779277388], atol=0.0001)
Expand All @@ -103,7 +103,7 @@ end
@test isapprox(objective(fm), 247.99446586289676, atol=0.001)
@test isapprox(coef(fm), [60.05333333333329], atol=0.001)
@test isapprox(fixef(fm), [60.05333333333329], atol=0.001)
@test isapprox(stderr(fm), [0.6421359883527029] , atol=0.0001)
@test isapprox(StatsBase.stderr(fm), [0.6421359883527029] , atol=0.0001)
@test isapprox(getθ(fm), [3.5268858714382905, 1.3299230213750168], atol=0.001)
@test isapprox(std(fm)[1], [2.904069002535747], atol=0.001)
@test isapprox(std(fm)[2], [1.095070371687089], atol=0.0001)
Expand Down Expand Up @@ -155,10 +155,10 @@ end
@test isapprox(getθ(fm), [0.929221307, 0.01816838, 0.22264487096], atol=1.e-6)
@test isapprox(pwrss(fm), 117889.46144025437)
@test isapprox(logdet(fm), 73.90322021999222, atol=0.001)
@test isapprox(stderr(fm), [6.632257721914501, 1.5022354739749826], atol=0.0001)
@test isapprox(StatsBase.stderr(fm), [6.632257721914501, 1.5022354739749826], atol=0.0001)
@test coef(fm) [251.40510484848477,10.4672859595959]
@test fixef(fm) [10.4672859595959, 251.40510484848477]
@test isapprox(stderr(fm), [6.632246393963571, 1.502190605041084], atol=0.01)
@test isapprox(StatsBase.stderr(fm), [6.632246393963571, 1.502190605041084], atol=0.01)
@test isapprox(std(fm)[1], [23.780468100188497, 5.716827903196682], atol=0.01)
@test isapprox(logdet(fm), 73.90337187545992, atol=0.001)
@test diag(cor(fm)[1]) ones(2)
Expand Down Expand Up @@ -190,7 +190,7 @@ end
@test isapprox(objective(fmnc), 1752.0032551398835, atol=0.001)
@test coef(fmnc) [251.40510484848585, 10.467285959595715]
@test fixef(fmnc) [10.467285959595715, 251.40510484848477]
@test isapprox(stderr(fmnc), [6.707710260366577, 1.5193083237479683], atol=0.001)
@test isapprox(StatsBase.stderr(fmnc), [6.707710260366577, 1.5193083237479683], atol=0.001)
@test isapprox(getθ(fmnc), [0.9458106880922268, 0.22692826607677266], atol=0.0001)
@test std(fmnc)[1] [24.171449463289047, 5.799379721123582]
@test std(fmnc)[2] [25.556130034081047]
Expand Down

0 comments on commit 7c593a1

Please sign in to comment.