Skip to content

Commit

Permalink
Correct the calculation of conditional std dev of r.e.
Browse files Browse the repository at this point in the history
* Initialize pars to optsum.initial, not optsum.final

* clean up logic in optimize for GLMM - still needs work

* Restore model at the end of the bootstrap

* Use Cholesky factor not product in `condVar`

* Need to square diagonals of Cholesky factor

Failures on v0.6.0-dev are new and likely not to be unique to this package.
  • Loading branch information
dmbates authored Dec 29, 2016
1 parent 41b79c5 commit d88408a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mixedmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ This function returns an array of `k` three dimensional arrays,
where the `i`th array is of size `vᵢ × vᵢ × ℓᵢ`. These are the
diagonal blocks from the conditional variance-covariance matrix,
s² Λ(Λ'Z'ZΛ + I)Λ'
s² Λ(Λ'Z'ZΛ + I)⁻¹Λ'
"""
function condVar(m::MixedModel)
lm = lmm(m)
Expand All @@ -238,13 +238,13 @@ function condVar(m::MixedModel)
throw(ArgumentError(
"code for more than one term not yet written"))
end
A = lm.A[1,1]
res = Array{eltype(A),3}[]
if isa(A, Diagonal)
push!(res, reshape(inv.(A.diag) .* abs2(Λ[1][1]), (1,1,size(A,1))))
R = lm.R[1,1]
res = Array{eltype(R),3}[]
if isa(R, Diagonal)
push!(res, reshape(abs2.(inv.(R.diag) .* (Λ[1][1])), (1,1,size(R,1))))
else
throw(ArgumentError(
"code for vector-value random-effects not yet written"))
end
res
varest(m) * res
end

0 comments on commit d88408a

Please sign in to comment.