Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Aug 23, 2019
1 parent 87b1600 commit 1b8e024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion chagelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Optimization
* Confidence intervals: confint(::RBE, ::Float64)
* Show result

* Bugfix



- v0.1.0
Expand Down
11 changes: 7 additions & 4 deletions src/ReplicateBE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ function checkdata(X, Z, Xv, Zv, y)
if length(Xv) != length(Zv) error("Length Xv != Zv !!!") end
for i = 1:length(Xv)
if size(Xv[i])[1] != size(Zv[i])[1] error("Row num of subject $i Xv != Zv !!!") end
if size(Xv[i])[1] != 4 error("Subject observation of subject $i != 4, other designs not implemented yet!!!") end
if sum(Zv[i][:,1]) != 2 error("Subject $i, formulation 1, not have 2 observation, other solutions not implemented yet!!!") end
if sum(Zv[i][:,2]) != 2 error("Subject $i, formulation 2, not have 2 observation, other solutions not implemented yet!!!") end
#if size(Xv[i])[1] != 4 error("Subject observation of subject $i != 4, other designs not implemented yet!!!") end
#if sum(Zv[i][:,1]) != 2 error("Subject $i, formulation 1, not have 2 observation, other solutions not implemented yet!!!") end
#if sum(Zv[i][:,2]) != 2 error("Subject $i, formulation 2, not have 2 observation, other solutions not implemented yet!!!") end
end
end

Expand All @@ -298,10 +298,13 @@ function reml2(yv, Zv, p, Xv, θvec)
iV = nothing
θ2m = zeros(p,p)
βm = zeros(p)
iVv = Array{Array{Float64,2}, 1}(undef, n)

for i = 1:n
R = rmat([θvec[1], θvec[2]], Zv[i])
V = cov(G, R, Zv[i])
iV = inv(V)
iVv[i] = iV
θ1 += logdet(V)
tm = Xv[i]'*iV #Temp matrix for Xv[i]'*iV*Xv[i] and Xv[i]'*iV*yv[i] calc
θ2m += tm*Xv[i]
Expand All @@ -311,7 +314,7 @@ function reml2(yv, Zv, p, Xv, θvec)

for i = 1:n
r = yv[i]-Xv[i]*β
θ3 += r'*iV*r
θ3 += r'*iVv[i]*r
end

#=
Expand Down

2 comments on commit 1b8e024

@PharmCat
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • v0.1.1
    • change keyword var -> dvar
    • Step 0 variance calculation
    • Split REML β dependent and REML2 β independent
    • Hessian matrix now come from ForwardDiff
    • g_tol, x_tol, f_tol keywords for Optim
    • Optimization
    • Confidence intervals: confint(::RBE, ::Float64)
    • Show result
    • Bugfix

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/2907

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 1b8e024f9a209f7ffe2a80616dd48407f8f038c2
git push origin v0.1.1

Please sign in to comment.