From 7f089339db59d4c2b9e6e61d67397716f6c57bda Mon Sep 17 00:00:00 2001 From: PharmCat Date: Fri, 11 Sep 2020 22:28:42 +0300 Subject: [PATCH 01/10] update - 1 --- .gitignore | 1 - Project.toml | 8 +- chagelog.md | 7 ++ examples/benchmark.jl | 122 +++++++++++++++++++++++++++++++ src/ReplicateBE.jl | 2 +- src/algebra.jl | 79 +++++++++++++------- src/design.jl | 4 - src/generalfunc.jl | 165 ++++++++++++++++++++++-------------------- src/memalloc.jl | 24 +++++- src/randrbeds.jl | 55 ++++++++++---- src/rbe.jl | 8 +- test/test.jl | 83 ++++++++++++++------- 12 files changed, 395 insertions(+), 163 deletions(-) create mode 100644 examples/benchmark.jl diff --git a/.gitignore b/.gitignore index 2c5a32f..f98edde 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Validation validation/ -examples/ docs/build/ docs/img/ diff --git a/Project.toml b/Project.toml index 2297e87..c5b16b3 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ name = "ReplicateBE" uuid = "671d9d50-c343-11e9-1a9c-fdd992682823" keywords = ["bioequivalence", "mixedmodel"] desc = "Mixed model solution for replicate designed bioequivalence study." -version = "1.0.10" +version = "1.0.11" [deps] @@ -19,7 +19,6 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Optim = "429524aa-4258-5aef-a3af-852621145aeb" LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255" -PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [extras] @@ -31,14 +30,13 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" test = ["CSV", "Test", "StatsBase"] [compat] -CategoricalArrays = "0.7" +CategoricalArrays = "0.7, 0.8" julia = "1.0, 1.1, 1.2, 1.3, 1.4, 1.5" StatsBase = "0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33" DataFrames = "0.19, 0.20" StatsModels = "0.6" Distributions = "0.20, 0.21, 0.22, 0.23" -PDMats = "0.9, 0.10" ForwardDiff = "0.10" -Optim = "0.19, 0.20, 0.21" +Optim = "0.19, 0.20, 0.21, 0.22" LineSearches = "7.0" StaticArrays = "0.11, 0.12" diff --git a/chagelog.md b/chagelog.md index 1d3614b..8cdff59 100644 --- a/chagelog.md +++ b/chagelog.md @@ -1,3 +1,10 @@ +- v1.0.11 + * Optimizations + * Cosmetics + * PDMats exclude + * Fix experimental sigmoid function + * Changes in initial variance estimate (OLS via QR decomposition) + - v1.0.10 * Cosmetics * StatsBase.coeftable diff --git a/examples/benchmark.jl b/examples/benchmark.jl new file mode 100644 index 0000000..44b0a33 --- /dev/null +++ b/examples/benchmark.jl @@ -0,0 +1,122 @@ +using BenchmarkTools, CSV, DataFrames +using ReplicateBE + +datapath = joinpath(dirname(pathof(ReplicateBE)))*"/../test/csv/df6.csv" + +df6 = CSV.File(datapath) |> DataFrame + +#@benchmark be = ReplicateBE.rbe!(df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) +@benchmark be = ReplicateBE.rbe!($df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) seconds = 25 samples = 200 evals = 5 + +#= +julia> @benchmark be = ReplicateBE.rbe!(datadf, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) +BenchmarkTools.Trial: + memory estimate: 6.15 MiB + allocs estimate: 66530 + -------------- + minimum time: 24.307 ms (0.00% GC) + median time: 27.732 ms (0.00% GC) + mean time: 29.258 ms (3.78% GC) + maximum time: 47.647 ms (0.00% GC) + -------------- + samples: 172 + evals/sample: 1 + +julia> +=# + +#v1.5 +#= +julia> @benchmark be = ReplicateBE.rbe!(df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) +BenchmarkTools.Trial: + memory estimate: 5.40 MiB + allocs estimate: 48564 + -------------- + minimum time: 16.528 ms (0.00% GC) + median time: 18.803 ms (0.00% GC) + mean time: 20.431 ms (4.65% GC) + maximum time: 53.102 ms (50.43% GC) + -------------- + samples: 245 + evals/sample: 1 +=# + +#v1.0.11 Julia 1.4 +#= +julia> @benchmark be = ReplicateBE.rbe!(df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol += 1e-10) +BenchmarkTools.Trial: + memory estimate: 4.34 MiB + allocs estimate: 46670 + -------------- + minimum time: 10.112 ms (0.00% GC) + median time: 18.371 ms (0.00% GC) + mean time: 19.176 ms (2.40% GC) + maximum time: 83.157 ms (74.30% GC) + -------------- + samples: 261 + evals/sample: 1 +=# + +#v1.0.11d Julia 1.5.1 +#= +julia> @benchmark be = ReplicateBE.rbe!(df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol += 1e-10) +BenchmarkTools.Trial: + memory estimate: 4.48 MiB + allocs estimate: 43228 + -------------- + minimum time: 17.604 ms (0.00% GC) + median time: 19.636 ms (0.00% GC) + mean time: 20.833 ms (2.70% GC) + maximum time: 47.499 ms (0.00% GC) + -------------- + samples: 240 + evals/sample: 1 +=# + +#= +julia> @benchmark be = ReplicateBE.rbe!($df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) seconds = 25 samples = 200 evals = 5 +BenchmarkTools.Trial: + memory estimate: 4.47 MiB + allocs estimate: 43136 + -------------- + minimum time: 17.257 ms (0.00% GC) + median time: 19.049 ms (0.00% GC) + mean time: 19.897 ms (3.34% GC) + maximum time: 29.502 ms (32.83% GC) + -------------- + samples: 200 + evals/sample: 5 +=# + +#= +julia> @benchmark be = ReplicateBE.rbe!($df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) seconds = 25 samples = 200 evals = 5 +BenchmarkTools.Trial: + memory estimate: 4.44 MiB + allocs estimate: 43179 + -------------- + minimum time: 16.638 ms (0.00% GC) + median time: 19.191 ms (0.00% GC) + mean time: 20.705 ms (2.86% GC) + maximum time: 48.517 ms (14.31% GC) + -------------- + samples: 200 + evals/sample: 5 +=# + +#initvar2 +#= +julia> @benchmark be = ReplicateBE.rbe!($df6, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10) seconds = 25 samples = 200 evals = 5 +BenchmarkTools.Trial: + memory estimate: 4.97 MiB + allocs estimate: 48656 + -------------- + minimum time: 18.353 ms (0.00% GC) + median time: 21.240 ms (0.00% GC) + mean time: 22.810 ms (2.87% GC) + maximum time: 43.109 ms (10.80% GC) + -------------- + samples: 200 + evals/sample: 5 +=# diff --git a/src/ReplicateBE.jl b/src/ReplicateBE.jl index 8955758..7dd37c3 100644 --- a/src/ReplicateBE.jl +++ b/src/ReplicateBE.jl @@ -5,7 +5,7 @@ module ReplicateBE -using DataFrames, Distributions, StatsModels, StatsBase, ForwardDiff, LinearAlgebra, Random, PDMats, Optim, LineSearches, CategoricalArrays, Printf, StaticArrays +using DataFrames, Distributions, StatsModels, StatsBase, ForwardDiff, LinearAlgebra, Random, Optim, LineSearches, CategoricalArrays, Printf, StaticArrays export rbe, rbe!, reml2, nobs, coef, stderror, dof, coefnum, fixed, theta, typeiii, design, show, confint, contrast, estimate, optstat, randrbeds, randrbetask import Base.show diff --git a/src/algebra.jl b/src/algebra.jl index 22d9933..d4efe0a 100644 --- a/src/algebra.jl +++ b/src/algebra.jl @@ -1,11 +1,11 @@ """ A' * B * A -> + θ (cache) """ -function mulαtβαinc!(θ, A::AbstractMatrix, B::Matrix, c) +function mulαtβαinc!(θ, A::AbstractMatrix, B, c) q = size(B, 1) p = size(A, 2) for i = 1:p - c .= 0 + fill!(c, zero(eltype(θ))) for n = 1:q for m = 1:q @inbounds c[n] += B[m, n] * A[m, i] @@ -25,9 +25,9 @@ A' * B * A -> + θ function mulαtβαinc!(θ, A::AbstractMatrix, B::AbstractMatrix) q = size(B, 1) p = size(A, 2) - c = zeros(eltype(B), q) + c = zeros(eltype(θ), q) for i = 1:p - c .= 0 + fill!(c, zero(eltype(θ))) for n = 1:q for m = 1:q @inbounds c[n] += B[m, n] * A[m, i] @@ -50,7 +50,7 @@ function mulθβinc!(θ, β, A::AbstractMatrix, B::AbstractMatrix, C::AbstractVe q = size(B, 1) p = size(A, 2) for i = 1:p - c .= 0 + fill!(c, zero(eltype(θ))) for n = 1:q for m = 1:q @inbounds c[n] += B[m, n] * A[m, i] @@ -69,11 +69,12 @@ end """ (y - X * β)' * V * (y - X * β) (cache) """ -function mulθ₃(y::Vector, X::AbstractMatrix, β::Vector, V::AbstractMatrix, c) +function mulθ₃(y, X, β, V, c) q = size(V, 1) p = size(X, 2) - θ = 0 - c .= 0 + θ = zero(eltype(β)) + #c .= 0 + fill!(c, zero(eltype(β))) for n = 1:q for m = 1:p @inbounds c[n] += X[n, m] * β[m] @@ -90,27 +91,27 @@ end """ A * B * A' + C """ -function mulαβαtc(A::AbstractMatrix, B::AbstractMatrix, C::AbstractMatrix) +function mulαβαtc(A, B, C)::Symmetric q = size(B, 1) p = size(A, 1) c = zeros(eltype(B), q) mx = zeros(eltype(B), p, p) for i = 1:p - c .= 0 - for n = 1:q - for m = 1:q + fill!(c, zero(eltype(c))) + @simd for n = 1:q + @simd for m = 1:q @inbounds c[n] += A[i, m] * B[n, m] end end - for n = 1:p - for m = 1:q + @simd for n = i:p + @simd for m = 1:q @inbounds mx[i, n] += A[n, m] * c[m] end + @inbounds mx[i, n] += C[i, n] end end - mx .+= C - #Symmetric(mx) - #SMatrix{p,p}(mx) + #mx .+= C + Symmetric(mx) end """ A * B * A' + C (cache) @@ -118,26 +119,50 @@ A * B * A' + C (cache) function mulαβαtc(A::AbstractMatrix, B::AbstractMatrix, C::AbstractMatrix, c::AbstractVector) q = size(B, 1) p = size(A, 1) - #c = mem.svec[p] mx = zeros(eltype(B), p, p) for i = 1:p - c .= 0 - for n = 1:q - for m = 1:q + fill!(c, zero(eltype(c))) + @simd for n = 1:q + @simd for m = 1:q @inbounds c[n] += A[i, m] * B[n, m] end end - for n = 1:p - for m = 1:q + @simd for n = i:p + @simd for m = 1:q @inbounds mx[i, n] += A[n, m] * c[m] end + @inbounds mx[i, n] += C[i, n] end end - mx .+= C - #SMatrix{p,p,eltype(mx)}(mx) - + #mx .+= C + Symmetric(mx) +end +""" +A * B * A' + Diagonal(A*C) (cache) +""" +function mulαβαtc(A::AbstractMatrix, B::AbstractMatrix, C::AbstractVector, c::AbstractVector)::Symmetric + q = size(B, 1) + p = size(A, 1) + mx = zeros(eltype(B), p, p) + for i = 1:p + fill!(c, zero(eltype(c))) + @simd for n = 1:q + @simd for m = 1:q + @inbounds c[n] += A[i, m] * B[n, m] + end + end + @simd for n = i:p + @simd for m = 1:q + @inbounds mx[i, n] += A[n, m] * c[m] + end + end + @simd for m = 1:length(C) + @inbounds mx[i, i] += A[i, m] * C[m] + end + end + #mx + Symmetric(mx) end - function invchol(M) q = size(M, 1) v = zeros(eltype(M), q, q) diff --git a/src/design.jl b/src/design.jl index d146165..691c012 100644 --- a/src/design.jl +++ b/src/design.jl @@ -11,10 +11,6 @@ struct RBEDataStructure mem::MemCache end -function rebuildcache(data, type) - data.mem.svec[1] = zeros(type, data.maxobs) -end - struct RBEResults{T <: AbstractFloat} reml::T # logREML β::Vector{T} # β Vector diff --git a/src/generalfunc.jl b/src/generalfunc.jl index ed1d6a4..468a66b 100644 --- a/src/generalfunc.jl +++ b/src/generalfunc.jl @@ -5,11 +5,11 @@ """ Make X, Z matrices and vector y for each subject; """ -function sortsubjects(df::DataFrame, sbj::Symbol, X::Matrix, Z::Matrix, y::Vector) +function sortsubjects(df::DataFrame, sbj::Symbol, X::Matrix{T}, Z::Matrix{T}, y::Vector{T}) where T u = unique(df[!, sbj]) - Xa = Vector{Matrix{eltype(y)}}(undef, length(u)) - Za = Vector{Matrix{eltype(y)}}(undef, length(u)) - ya = Vector{Vector{eltype(y)}}(undef, length(u)) + Xa = Vector{SubArray{T}}(undef, length(u)) + Za = Vector{SubArray{T}}(undef, length(u)) + ya = Vector{SubArray{T}}(undef, length(u)) @simd for i = 1:length(u) @inbounds v = findall(x->x==u[i], df[!, sbj]) @inbounds Xa[i] = view(X, v, :) @@ -86,34 +86,31 @@ function mvmat(G::AbstractMatrix, σ::Vector, Z::AbstractMatrix, mem, cache)::Ma end end -function mvmatall(G::AbstractMatrix, σ::AbstractVector, Z::AbstractMatrix, mem, cache) - #h = hash(Z) - #if h in keys(cache) +function mvmatall(G::AbstractMatrix, σ::AbstractVector{T}, Z::AbstractMatrix, mem, cache) where T if Z in keys(cache) - #return cache[h] return cache[Z] else - V = mulαβαtc(Z, G, Diagonal(Z*σ), mem) + local V::Symmetric{T,Array{T,2}} + local V⁻¹::Symmetric{T,Array{T,2}} + local log│V│::T + #V = mulαβαtcupd!(mem.mvec, Z, G, σ, mem.svec) + V = mulαβαtc(Z, G, σ, mem) #V = Z * G * Z' + Diagonal(Z*σ) - V⁻¹ = nothing - try - V⁻¹ = invchol(V) - catch e - if typeof(e) <: PosDefException - V⁻¹ = inv(V) - else - throw(e) - end + + if size(V, 1) <= 14 + sV = SHermitianCompact(SMatrix{size(V, 1),size(V, 1)}(V)) + V⁻¹ = Symmetric(inv(sV)) + log│V│ = logdet(sV) + else + V⁻¹ = Symmetric(inv(V)) + log│V│ = logdet(V) end - #V⁻¹ = inv(V) - log│V│ = logdet(V) - cache[Z] = (V, V⁻¹, log│V│) - return V, V⁻¹, log│V│ + cache[Z] = (V⁻¹, log│V│) + return cache[Z] end end -#println("θ₁: ", θ1, " θ₂: ", θ2, " θ₃: ", θ3) -function minv(G::AbstractMatrix, σ::Vector, Z::AbstractMatrix, cache::Dict)::Matrix +function minv(G::AbstractMatrix, σ::Vector, Z::AbstractMatrix, cache::Dict) #h = hash(M) if Z in keys(cache) #return cache[h] @@ -121,7 +118,8 @@ function minv(G::AbstractMatrix, σ::Vector, Z::AbstractMatrix, cache::Dict)::Ma else V = mulαβαtc(Z, G, Diagonal(Z*σ)) #V = Z * G * Z' + Diagonal(Z*σ) - V⁻¹ = invchol(V) + #V⁻¹ = inv(SHermitianCompact(SMatrix{size(V, 1),size(V, 1)}(V))) + V⁻¹ = inv(V) #V⁻¹ = inv(V) #ldV = logdet(V) cache[Z] = V⁻¹ @@ -145,23 +143,23 @@ end """ -2 REML function for ForwardDiff """ -function reml2(data::RBEDataStructure, θ, β::Vector; memopt::Bool = true) +function reml2(data::RBEDataStructure, θ::Vector{T}, β::Vector; memopt::Bool = true) where T #memory optimizations to reduse allocations (cache rebuild) #empty!(data.mem.dict) - rebuildcache(data, promote_type(eltype(data.yv[1]), eltype(θ))) - cache = Dict{Matrix, Tuple{Matrix, Matrix, eltype(θ)}}() + rebuildcache(data, promote_type(eltype(data.yv[1]), T)) + cache = Dict{Matrix, Tuple{Matrix{T}, T}}() #cache = data.mem.dict #--------------------------------------------------------------------------- G = gmat(view(θ, 3:5)) - θ₁ = 0 + θ₁ = zero(T) θ₂ = zeros(promote_type(eltype(data.yv[1]), eltype(θ)), data.p, data.p) - θ₃ = 0 + θ₃ = zero(T) V⁻¹ = nothing #mVec = pmap(x -> mvmatall(G, view(θ,1:2), x, first(data.mem.svec), cache), data.Zv) @simd for i = 1:data.n if MEMOPT && memopt - V, V⁻¹, log│V│ = mvmatall(G, view(θ,1:2), data.Zv[i], first(data.mem.svec), cache) + V⁻¹, log│V│ = mvmatall(G, view(θ,1:2), data.Zv[i], first(data.mem.svec), cache) #V, V⁻¹, log│V│ =mVec[i] θ₁ += log│V│ else @@ -186,24 +184,24 @@ end function reml2bfd(data::RBEDataStructure, θ; memopt::Bool = true) return reml2b(data, θ; memopt = memopt)[1] end -function reml2b(data::RBEDataStructure, θ; memopt::Bool = true) +function reml2b(data::RBEDataStructure, θ::Vector{T}; memopt::Bool = true) where T - rebuildcache(data, promote_type(eltype(data.yv[1]), eltype(θ))) - cache = Dict() + rebuildcache(data, promote_type(eltype(data.yv[1]), T)) + cache = Dict{Matrix, Tuple{Matrix{T}, T}}() #--------------------------------------------------------------------------- G = gmat(view(θ,3:5)) - V⁻¹ = Vector{Matrix{eltype(θ)}}(undef, data.n) # Vector of V⁻¹ matrices - V = nothing - log│V│ = nothing # Vector log determinant of V matrix - θ₁ = 0 - θ₂ = zeros(promote_type(eltype(first(data.yv)), eltype(θ)), data.p, data.p) - θ₃ = 0 - βm = zeros(promote_type(eltype(first(data.yv)), eltype(θ)), data.p) - β = zeros(promote_type(eltype(first(data.yv)), eltype(θ)), data.p) + V⁻¹ = Vector{Matrix{T}}(undef, data.n) # Vector of V⁻¹ matrices + #V = nothing + local log│V│::T # Vector log determinant of V matrix + θ₁ = zero(T) + θ₂ = zeros(promote_type(eltype(first(data.yv)), T), data.p, data.p) + θ₃ = zero(T) + βm = zeros(promote_type(eltype(first(data.yv)), T), data.p) + β = zeros(promote_type(eltype(first(data.yv)), T), data.p) #mVec = map(x -> mvmatall(G, θ[1:2], x, first(data.mem.svec), cache), data.Zv) @simd for i = 1:data.n if MEMOPT && memopt - @inbounds V, V⁻¹[i], log│V│ = mvmatall(G, view(θ,1:2), data.Zv[i], first(data.mem.svec), cache) + @inbounds V⁻¹[i], log│V│ = mvmatall(G, view(θ,1:2), data.Zv[i], first(data.mem.svec), cache) #V, V⁻¹[i], log│V│ = mVec[i] θ₁ += log│V│ else @@ -235,42 +233,45 @@ end """ non inverted C matrix gradient function """ -function cmatgf(Xv::Vector, Zv::Vector, θ::Vector; memopt::Bool = true) - p = size(Xv[1], 2) - jC = ForwardDiff.jacobian(x -> cmatvec(Xv, Zv, x; memopt = memopt), SVector{length(θ), eltype(θ)}(θ)) - result = Vector{Matrix}(undef, 0) +function cmatgf(data, θ::Vector{T}; memopt::Bool = true) where T + p = size(data.Xv[1], 2) + jC = ForwardDiff.jacobian(x -> cmatvec(data, x; memopt = memopt), θ) + result = Vector{Matrix{T}}(undef, length(θ)) for i in 1:length(θ) - push!(result, reshape(jC[:,i], p, p)) + result[i] = reshape(view(jC, :, i), p, p) # 0 && dropobs < size(subjds, 1) - dellist = sample(rng, 1:size(subjds, 1), dropobs, replace = false) - deleterows!(subjds, sort!(dellist)) + #subjds = DataFrame(subject = Int.(subjdsm[:,1]), + #formulation = string.(subjdsm[:,2]), + #period = Int.(subjdsm[:,3]), + #sequence = string.(subjdsm[:,4]), + #var = Float64.(subjdsm[:,5])) + + if dropobs > 0 && dropobs < subj + dellist = sort!(sample(rng, 1:subj, dropobs, replace = false)) + deleteat!(subjmx1, dellist) + deleteat!(subjmx2, dellist) + deleteat!(subjmx3, dellist) + deleteat!(subjmx4, dellist) + deleteat!(subjmx5, dellist) + #deleterows!(subjds, sort!(dellist)) end + subjds = DataFrame(subject = subjmx1, + formulation = subjmx2, + period = subjmx3, + sequence = subjmx4, + var = subjmx5) categorical!(subjds, :subject); categorical!(subjds, :formulation); categorical!(subjds, :period); diff --git a/src/rbe.jl b/src/rbe.jl index 6311c8d..2783fce 100644 --- a/src/rbe.jl +++ b/src/rbe.jl @@ -190,10 +190,10 @@ function rbe(df; dvar::Symbol, optnum = 0 rng = MersenneTwister(hash(θvec0)) while opttry - try + #try O = optimize(td, θvec0, method=Newton(), g_tol=g_tol, x_tol=x_tol, f_tol=f_tol, allow_f_increases = true, store_trace = store_trace, extended_trace = extended_trace, show_trace = show_trace, callback = optimcallback) opttry = false - #try + try catch θvec0 = rvarlink(abs.(varlink(θvec0, vlm) .+ (rand(rng)-0.5)/20 .* varlink(θvec0, vlm) .+ eps()), vlm)[1:4] push!(θvec0, rand(rng)) @@ -225,7 +225,7 @@ function rbe(df; dvar::Symbol, #H = Calculus.hessian(x -> reml2(data, x, β), θ) # If no varlink using can be obtained from optim results #H = O.trace[end].metadata["h(x)"] - + #print(H) A = nothing #If rho is near to 1.0 it leads to singular hessian matrix, and rho should be removed from variance-covariance matrix #It can be done another way: using varlink everywhere, but it leads to problems of calling varlink after RBE object creation with other methods @@ -249,7 +249,7 @@ function rbe(df; dvar::Symbol, df = Vector{eltype(C)}(undef, p) t = Vector{eltype(C)}(undef, p) pval = Vector{eltype(C)}(undef, p) - gradc = cmatg(Xv, Zv, θ, C; memopt = memopt) + gradc = cmatg(data, θ, C; memopt = memopt) for i = 1:p diff --git a/test/test.jl b/test/test.jl index ce903d8..9a1bceb 100644 --- a/test/test.jl +++ b/test/test.jl @@ -66,8 +66,6 @@ include("testdata.jl") be = ReplicateBE.rbe!(df0, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, rholink = :arctgsigmoid, singlim = 1e-4) ci2 = confint(be)[end] - - end @testset " #1 Patterson and Jones 2017 E 4.3 " begin @@ -209,6 +207,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.800182 atol=1E-5 @test ci[end][2] ≈ 1.208955 atol=1E-5 + print("[.") #DF contain 46 #DF contain form 44 #2 @@ -220,7 +219,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.877858 atol=1E-5 @test ci[end][2] ≈ 1.266491 atol=1E-5 - + print(".") #3 #TTRR/RRTT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10003) @@ -230,6 +229,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.838738 atol=1E-5 @test ci[end][2] ≈ 1.132936 atol=1E-5 + print(".") #4 #TRTR/RTRT/TRRT/RTTR rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1,1,1], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "R" "R" "T"; "R" "T" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10004) @@ -237,10 +237,9 @@ end @test ReplicateBE.reml2(be) ≈ 178.85707596709256 atol=1E-5 @test ReplicateBE.stderror(be)[end] ≈ 0.1126566088472447 atol=1E-5 ci = confint(be, 0.1, expci = true) - @test ci[end][1] ≈ 0.901150701434849 atol=1E-5 #SPSS 0.900982 @test ci[end][2] ≈ 1.3260902090001896 atol=1E-5 # 1.326338 - + print(".") #5 #TRRT/RTTR/TTRR/RRTT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1,1,1], design = ["T" "R" "R" "T"; "R" "T" "T" "R" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10005) @@ -250,6 +249,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.8697647630450958 atol=1E-4 @test ci[end][2] ≈ 1.3438521036812334 atol=1E-4 + print(".") #6 #TRTR/RTRT/TTRR/RRTT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1,1,1], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10006) @@ -259,6 +259,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.7280915876704905 atol=1E-5 @test ci[end][2] ≈ 1.0609077632653205 atol=1E-5 + print(".") #7 #TRT/RTR rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10007) @@ -270,6 +271,7 @@ end @test ci[end][2] ≈ 1.269283 atol=1E-5 #DF contain 23 #DF contain form 44 + print(".") #8 #TRR/RTT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "R"; "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10008) @@ -279,6 +281,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.8957103074455708 atol=1E-5 @test ci[end][2] ≈ 1.2534507598650542 atol=1E-5 + print(".") #9 #TR/RT/TT/RR rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1,1,1], design = ["T" "R"; "R" "T"; "T" "T"; "R" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0], formcoef = [0.0, 0.0], seed = 10009) @@ -288,6 +291,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.5581809471131624 atol=1E-5 @test ci[end][2] ≈ 1.1201862625078982 atol=1E-5 + print(".") #10 #TRR/RTR/RRT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1,1], design = ["T" "R" "R"; "R" "T" "R"; "R" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10010) @@ -297,6 +301,7 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.8192235933294734 atol=1E-5 @test ci[end][2] ≈ 1.1698775266746582 atol=1E-5 + print(".") #11 #TRR/RTR #SPSS REML 129.655513635398 @@ -305,22 +310,28 @@ end @test ReplicateBE.reml2(be) ≈ 129.06198795781413 atol=1E-5 @test ReplicateBE.stderror(be)[end] ≈ 0.1096846988112254 atol=1E-5 ci = confint(be, 0.1, expci = true) + #1.0.4 - @test ci[end][1] ≈ 0.8719537380504332 atol=1E-5 - @test ci[end][2] ≈ 1.2621358539962937 atol=1E-5 + #@test ci[end][1] ≈ 0.8719537380504332 atol=1E-5 + #@test ci[end][2] ≈ 1.2621358539962937 atol=1E-5 #1.0.5 #@test ci[end][1] ≈ 0.8719023753585434 atol=1E-3 #@test ci[end][2] ≈ 1.2622102048603623 atol=1E-3 - + #1.0.11 + #@test ci[end][1] ≈ 0.8719313261195931 atol=1E-5 + #@test ci[end][2] ≈ 1.2621682956584102 atol=1E-5 + #J1.4.0 + @test ci[end][1] ≈ 0.8719537380504332 atol=1E-4 + @test ci[end][2] ≈ 1.2621358539962937 atol=1E-4 #DF contain 74 #DF contain form 92 - + print(".") #Unbalanced + dropouts #12 #TRTR/RTRT #SPSS DF 42.3382785451983 - rds = CSV.File(path*"/csv/rds12.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds12.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10012) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 329.76454300481595 atol=1E-5 @@ -328,9 +339,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.9223372675334348 atol=1E-5 @test ci[end][2] ≈ 1.183433775497828 atol=1E-5 + print(".") #13 #TRRT/RTTR - rds = CSV.File(path*"/csv/rds13.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds13.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R" "T"; "R" "T" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 100013) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 305.21958862123165 atol=1E-5 @@ -338,9 +350,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.9109673193677009 atol=1E-5 @test ci[end][2] ≈ 1.1871890135539473 atol=1E-5 + print(".") #14 #TTRR/RRTT - rds = CSV.File(path*"/csv/rds14.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds14.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 100014) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 277.976236251267 atol=1E-5 @@ -348,9 +361,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.9372828683843416 atol=1E-5 @test ci[end][2] ≈ 1.2057922163897947 atol=1E-5 + print(".") #15 #TRTR/RTRT/TRRT/RTTR - rds = CSV.File(path*"/csv/rds15.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds15.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "R" "R" "T"; "R" "T" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10015) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 331.77741574 atol=1E-5 @@ -358,9 +372,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.9431875747076479 atol=1E-5 @test ci[end][2] ≈ 1.2478691227393788 atol=1E-5 + print(".") #16 #TRRT/RTTR/TTRR/RRTT - rds = CSV.File(path*"/csv/rds16.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds16.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "R" "T"; "R" "T" "T" "R" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10016) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 285.69277340 atol=1E-5 @@ -368,9 +383,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.9088567332123243 atol=1E-5 @test ci[end][2] ≈ 1.1476219506765315 atol=1E-5 + print(".") #17 #TRTR/RTRT/TTRR/RRTT - rds = CSV.File(path*"/csv/rds17.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds17.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10017) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 292.49505051 atol=1E-5 @@ -379,9 +395,10 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.92723952053598 atol=1E-5 @test ci[end][2] ≈ 1.1951418270978003 atol=1E-5 + print(".") #18 #TRT/RTR - rds = CSV.File(path*"/csv/rds18.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds18.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10018) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 237.09185442 atol=1E-5 @@ -390,9 +407,10 @@ end @test ci[end][1] ≈ 0.878355738329916 atol=1E-5 @test ci[end][2] ≈ 1.1975977027952331 atol=1E-5 #DF contain 34 + print(".") #19 #TRR/RTT - rds = CSV.File(path*"/csv/rds19.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds19.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R"; "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10019) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 255.99536281 atol=1E-5 @@ -400,12 +418,13 @@ end ci = confint(be, 0.1, expci = true) @test ci[end][1] ≈ 0.7755005422832147 atol=1E-5 @test ci[end][2] ≈ 1.0916738532751222 atol=1E-5 + print(".") #20 #TR/RT/TT/RR #SPSS REML 151.783195849874 #SPSS SE 0.214518365508227 #SPSS DF 10.0167597858775 - rds = CSV.File(path*"/csv/rds20.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds20.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R"; "R" "T"; "T" "T"; "R" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10020) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 151.78319585 atol=1E-5 @@ -414,9 +433,10 @@ end @test ci[end][1] ≈ 0.7865283528654503 atol=1E-5 @test ci[end][2] ≈ 1.6924035882963178 atol=1E-5 #DF contain 20 + print(".") #21 #TRR/RTR/RRT - rds = CSV.File(path*"/csv/rds21.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds21.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3], design = ["T" "R" "R"; "R" "T" "R"; "R" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10021) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) #SPSS REML 237.076723026247 @@ -429,12 +449,13 @@ end #v1.0.5 #@test ci[end][1] ≈ 0.8293880338983111 atol=1E-3 #@test ci[end][2] ≈ 1.1480342197874598 atol=1E-3 - + #1.4.0 #DF contain 35 + print(".") #22 #TRR/RTR - rds = CSV.File(path*"/csv/rds22.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds22.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R"; "R" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10022) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) #SPSS REML 234.103074 @@ -447,19 +468,21 @@ end #v1.0.5 #@test ci[end][1] ≈ 0.9064394831113237 atol=1E-3 #@test ci[end][2] ≈ 1.3055658048846954 atol=1E-3 + #1.4.0 #DF contain 32 - + print(".") # Unbalanced by sequences #23 #TRTR/RTRT - rds = CSV.File(path*"/csv/rds23.csv") |> DataFrame + rds = CSV.file(path*"/csv/rds23.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=36, sequence=[1,2], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.1], intra=[0.1, 0.15], intercept = 1.0, seqcoef = [1.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10023) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) ci = confint(be, 0.1, expci = true) @test ReplicateBE.reml2(be) ≈ 252.0449059441563 atol=1E-5 @test ci[end][1] ≈ 0.638039 atol=1E-5 @test ci[end][2] ≈ 1.135006 atol=1E-5 + print(".") #24 #TRT/RTR rds = ReplicateBE.randrbeds(;n=36, sequence=[1,2], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.4, 0.3, 0.2], intra=[0.05, 0.02], intercept = 1.0, seqcoef = [0.1, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.1, 0.0], seed = 10024) @@ -468,7 +491,7 @@ end @test ReplicateBE.reml2(be) ≈ 140.10714908682417 atol=1E-5 @test ci[end][1] ≈ 0.854985 atol=1E-5 @test ci[end][2] ≈ 1.293459 atol=1E-5 - + print(".") #25 #TRR/RTT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "R"; "R" "T" "T"], inter=[0.5, 0.4, 0.5], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10008) @@ -477,7 +500,7 @@ end @test ReplicateBE.reml2(be) ≈ 140.37671499958694 atol=1E-5 @test ci[end][1] ≈ 0.8208303872086634 atol=1E-5 @test ci[end][2] ≈ 1.3228068920153602 atol=1E-5 - + print(".") # Unbalanced by sequences #26 #TRTR/RTRT @@ -487,6 +510,7 @@ end @test ReplicateBE.reml2(be) ≈ 899.044671814185 atol=1E-5 @test ci[end][1] ≈ 0.6189149073430663 atol=1E-5 @test ci[end][2] ≈ 0.7726263704382558 atol=1E-5 + print(".") #27 #TRT/RTR rds = ReplicateBE.randrbeds(;n=128, sequence=[1,2], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.4, 0.3, 0.7], intra=[0.05, 0.2], intercept = 1.0, seqcoef = [1.1, 0.0], periodcoef = [0.0, 1.0, 0.0], formcoef = [0.2, 0.0], seed = 10027) @@ -495,8 +519,9 @@ end @test ReplicateBE.reml2(be) ≈ 614.3407387528628 atol=1E-5 @test ci[end][1] ≈ 1.18696161597237 atol=1E-5 @test ci[end][2] ≈ 1.43349025480276 atol=1E-5 - + print(".") # Unbalanced by sequences + #28 #TRTR/RTRT rds = ReplicateBE.randrbeds(;n=512, sequence=[1,2], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.7], intra=[0.1, 0.15], intercept = 1.0, seqcoef = [1.0, 0.0], periodcoef = [0.0, 1.0, 0.0, 0.0], formcoef = [0.0, 0.3], seed = 10028) @@ -505,6 +530,7 @@ end @test ReplicateBE.reml2(be) ≈ 3495.580039200916 atol=1E-5 @test ci[end][1] ≈ 0.6975351860484861 atol=1E-5 @test ci[end][2] ≈ 0.7698493312540238 atol=1E-5 + print(".") #29 #TRT/RTR rds = ReplicateBE.randrbeds(;n=512, sequence=[1,2], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.4, 0.3, 0.7], intra=[0.05, 0.2], intercept = 1.0, seqcoef = [1.1, 0.0], periodcoef = [0.0, 0.0, 1.0], formcoef = [0.4, 0.0], seed = 10029) @@ -514,7 +540,7 @@ end @test ci[end][1] ≈ 1.361487533935354 atol=1E-5 @test ci[end][2] ≈ 1.498934137926506 atol=1E-5 - + println(".]") end @testset " # Simulation " begin @@ -537,6 +563,9 @@ end pow = ReplicateBE.simulation(task; io = io, num = 1007, seed = 1234, verbose = true) @test pow.result ≈ 0.06 atol=1E-2 + pow = ReplicateBE.simulation(task; io = io, num = 100, seed = 1234, verbose = true, rsabe = true) + #@test pow.result ≈ 0.06 atol=1E-2 + #Custom simulation task = ReplicateBE.randrbetask(;n=24, From cb2685ad84b2ee75ef310e72775eae8ea6c38303 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Mon, 14 Sep 2020 22:09:59 +0300 Subject: [PATCH 02/10] update - 2 --- Project.toml | 4 ++-- chagelog.md | 2 +- src/generalfunc.jl | 28 ++++++++++++++++++++++++++++ src/rbe.jl | 26 ++++++++++++++++++++------ 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index c5b16b3..e4835a7 100644 --- a/Project.toml +++ b/Project.toml @@ -33,10 +33,10 @@ test = ["CSV", "Test", "StatsBase"] CategoricalArrays = "0.7, 0.8" julia = "1.0, 1.1, 1.2, 1.3, 1.4, 1.5" StatsBase = "0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33" -DataFrames = "0.19, 0.20" +DataFrames = "0.19, 0.20, 0.21" StatsModels = "0.6" Distributions = "0.20, 0.21, 0.22, 0.23" ForwardDiff = "0.10" -Optim = "0.19, 0.20, 0.21, 0.22" +Optim = "0.19, 0.20, 0.21, 0.22, 1.0, 1.1, 1.2" LineSearches = "7.0" StaticArrays = "0.11, 0.12" diff --git a/chagelog.md b/chagelog.md index 8cdff59..1d852d8 100644 --- a/chagelog.md +++ b/chagelog.md @@ -3,7 +3,7 @@ * Cosmetics * PDMats exclude * Fix experimental sigmoid function - * Changes in initial variance estimate (OLS via QR decomposition) + * Add in initial variance estimate (OLS via QR decomposition) function - v1.0.10 * Cosmetics diff --git a/src/generalfunc.jl b/src/generalfunc.jl index 468a66b..c64bb54 100644 --- a/src/generalfunc.jl +++ b/src/generalfunc.jl @@ -354,6 +354,34 @@ function initvar(df::DataFrame, dv::Symbol, fac::Symbol)::Vector end return fv end +#= +function sumsq(v) + c = zero(eltype(v)) + for i in v + c += v*v + end +end +=# +function initvar2(df::DataFrame, X::Matrix, yv::Vector, dv::Symbol, fac::Symbol) + qrx = qr(X) + b = inv(qrx.R) * qrx.Q' * df[!, dv] + r = df[!, dv] - X * b + res = sum(x -> x*x, r)/(length(r) - size(X, 2)) + var1 = zero(eltype(first(yv))) + for i = 1:length(yv) + if length(yv[i]) > 1 + var1 += var(yv[i]) + end + end + var2 = var1/length(yv) + if res - var2 > 0.0 && var2 > 0.0 + return res-var2, var2, b + elseif var2 < 1.0e-6 + return res/2.0, res/2.0, b + else + return (res+var2)/2.0, (res+var2)/2.0, b + end +end #------------------------------------------------------------------------------- function optimcallback(x) false diff --git a/src/rbe.jl b/src/rbe.jl index 2783fce..9aa8f6c 100644 --- a/src/rbe.jl +++ b/src/rbe.jl @@ -110,7 +110,12 @@ function rbe(df; dvar::Symbol, singlim = 1e-10) #Check - if any(x -> x ∉ names(df), [subject, formulation, period, sequence]) throw(ArgumentError("Names not found in DataFrame!")) end + dfn = names(df) + if eltype(dfn) <: String dfn = Symbol.(dfn) end + if any(x -> x ∉ dfn, [subject, formulation, period, sequence]) + throw(ArgumentError("Names not found in DataFrame! \n Names: $([subject, formulation, period, sequence]) \n DF names: $(names(df))")) + end + if !(eltype(df[!,dvar]) <: AbstractFloat) @warn "Responce variable ∉ AbstractFloat!" end @@ -159,13 +164,17 @@ function rbe(df; dvar::Symbol, data = RBEDataStructure([sequence, period, formulation], Xv, Zv, yv, p, N, n, (N - p) * LOG2PI, maxobs, MemCache(maxobs)) #Calculate initial variance + #iv = initvar2(df, X, yv, dvar, subject) if length(init) == 5 θvec0 = init else + intra = sum(replace!(var.(yv) .* (length.(yv) .- 1), NaN => 0))/(sum(length.(yv))-1) iv = initvar(df, dvar, formulation) iv = iv .+ eps() θvec0 = [intra, intra, iv[1], iv[2], 0.5] + + #θvec0 = [iv[2], iv[2], iv[1], iv[1], 0.5] end #Variance link function @@ -190,10 +199,10 @@ function rbe(df; dvar::Symbol, optnum = 0 rng = MersenneTwister(hash(θvec0)) while opttry - #try + try O = optimize(td, θvec0, method=Newton(), g_tol=g_tol, x_tol=x_tol, f_tol=f_tol, allow_f_increases = true, store_trace = store_trace, extended_trace = extended_trace, show_trace = show_trace, callback = optimcallback) opttry = false - try + #try catch θvec0 = rvarlink(abs.(varlink(θvec0, vlm) .+ (rand(rng)-0.5)/20 .* varlink(θvec0, vlm) .+ eps()), vlm)[1:4] push!(θvec0, rand(rng)) @@ -239,9 +248,9 @@ function rbe(df; dvar::Symbol, #Secondary parameters calculation # if inv(H) incorrect pinv(H) used if abs(minimum(svdvals(H))) > singlim - A = 2 * inv(H) + A = 2.0 * inv(H) else - A = 2 * pinv(H) + A = 2.0 * pinv(H) end C = pinv(iC) se = Vector{eltype(C)}(undef, p) @@ -300,7 +309,12 @@ function rbe!(df; dvar::Symbol, singlim = 1e-6) - if any(x -> x ∉ names(df), [subject, formulation, period, sequence]) throw(ArgumentError("Names not found in DataFrame!")) end + dfn = names(df) + if eltype(dfn) <: String dfn = Symbol.(dfn) end + if any(x -> x ∉ dfn, [subject, formulation, period, sequence]) + throw(ArgumentError("Names not found in DataFrame! \n Names: $([subject, formulation, period, sequence]) \n DF names: $(names(df))")) + end + if !(eltype(df[!,dvar]) <: AbstractFloat) @warn "Responce variable ∉ AbstractFloat!" df[!,dvar] = float.(df[!,dvar]) From e1103ac7437346d339b56f086a746b78e41a06c9 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Mon, 14 Sep 2020 23:31:01 +0300 Subject: [PATCH 03/10] update --- test/test.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test.jl b/test/test.jl index 9a1bceb..cb1c6b3 100644 --- a/test/test.jl +++ b/test/test.jl @@ -5,10 +5,10 @@ using Test, CSV, DataFrames, StatsBase -path = dirname(@__FILE__) - +global path = dirname(@__FILE__) +println(Load data...) include("testdata.jl") - +println(Start test...) @testset " Basic mixed model test " begin be = ReplicateBE.rbe!(df0, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10); e1 = ReplicateBE.fixed(be).est[6] From ddedd78bc760026fd37c3c3b13413db5ea3dcda4 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Mon, 14 Sep 2020 23:38:32 +0300 Subject: [PATCH 04/10] update --- test/test.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.jl b/test/test.jl index cb1c6b3..21fee16 100644 --- a/test/test.jl +++ b/test/test.jl @@ -6,9 +6,9 @@ using Test, CSV, DataFrames, StatsBase global path = dirname(@__FILE__) -println(Load data...) +println("Load data...") include("testdata.jl") -println(Start test...) +println("Start test...") @testset " Basic mixed model test " begin be = ReplicateBE.rbe!(df0, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence, g_tol = 1e-10); e1 = ReplicateBE.fixed(be).est[6] From b74fe935c9f54f2d53ca8ae4e07b30d85cdecb99 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Mon, 14 Sep 2020 23:49:56 +0300 Subject: [PATCH 05/10] update --- test/test.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test.jl b/test/test.jl index 21fee16..5ff061b 100644 --- a/test/test.jl +++ b/test/test.jl @@ -5,7 +5,7 @@ using Test, CSV, DataFrames, StatsBase -global path = dirname(@__FILE__) +path = dirname(@__FILE__) println("Load data...") include("testdata.jl") println("Start test...") @@ -198,6 +198,8 @@ end end @testset " # Validation with generated datasets " begin + path = dirname(@__FILE__) + println("File path: ", path) #1 #TRTR/RTRT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10001) From b48b60e8efc68eb6c23bf5c22b0f547f7504c978 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Tue, 15 Sep 2020 00:08:00 +0300 Subject: [PATCH 06/10] update --- test/test.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test.jl b/test/test.jl index 5ff061b..27d1e1c 100644 --- a/test/test.jl +++ b/test/test.jl @@ -199,7 +199,8 @@ end @testset " # Validation with generated datasets " begin path = dirname(@__FILE__) - println("File path: ", path) + println("File path: " , path) + println("File rds12.csv ($(path*"/csv/rds12.csv")) exist: ", isfile(path*"/csv/rds12.csv")) #1 #TRTR/RTRT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10001) From 158487747470f26e80c06d10876a081b998363ea Mon Sep 17 00:00:00 2001 From: PharmCat Date: Tue, 15 Sep 2020 00:18:08 +0300 Subject: [PATCH 07/10] update --- test/test.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test.jl b/test/test.jl index 27d1e1c..7c9d099 100644 --- a/test/test.jl +++ b/test/test.jl @@ -198,6 +198,7 @@ end end @testset " # Validation with generated datasets " begin + using CSV path = dirname(@__FILE__) println("File path: " , path) println("File rds12.csv ($(path*"/csv/rds12.csv")) exist: ", isfile(path*"/csv/rds12.csv")) From d1515347b3ff4a5bc0ef557e7cbd6ee5e0812243 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Tue, 15 Sep 2020 00:21:56 +0300 Subject: [PATCH 08/10] update --- test/test.jl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/test.jl b/test/test.jl index 7c9d099..beca84d 100644 --- a/test/test.jl +++ b/test/test.jl @@ -200,8 +200,8 @@ end @testset " # Validation with generated datasets " begin using CSV path = dirname(@__FILE__) - println("File path: " , path) - println("File rds12.csv ($(path*"/csv/rds12.csv")) exist: ", isfile(path*"/csv/rds12.csv")) + #println("File path: " , path) + #println("File rds12.csv ($(path*"/csv/rds12.csv")) exist: ", isfile(path*"/csv/rds12.csv")) #1 #TRTR/RTRT rds = ReplicateBE.randrbeds(;n=24, sequence=[1,1], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10001) @@ -335,7 +335,7 @@ end #12 #TRTR/RTRT #SPSS DF 42.3382785451983 - rds = CSV.file(path*"/csv/rds12.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds12.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10012) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 329.76454300481595 atol=1E-5 @@ -346,7 +346,7 @@ end print(".") #13 #TRRT/RTTR - rds = CSV.file(path*"/csv/rds13.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds13.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R" "T"; "R" "T" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 100013) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 305.21958862123165 atol=1E-5 @@ -357,7 +357,7 @@ end print(".") #14 #TTRR/RRTT - rds = CSV.file(path*"/csv/rds14.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds14.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 100014) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 277.976236251267 atol=1E-5 @@ -368,7 +368,7 @@ end print(".") #15 #TRTR/RTRT/TRRT/RTTR - rds = CSV.file(path*"/csv/rds15.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds15.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "R" "R" "T"; "R" "T" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10015) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 331.77741574 atol=1E-5 @@ -379,7 +379,7 @@ end print(".") #16 #TRRT/RTTR/TTRR/RRTT - rds = CSV.file(path*"/csv/rds16.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds16.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "R" "T"; "R" "T" "T" "R" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10016) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 285.69277340 atol=1E-5 @@ -390,7 +390,7 @@ end print(".") #17 #TRTR/RTRT/TTRR/RRTT - rds = CSV.file(path*"/csv/rds17.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds17.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R" "T" "R"; "R" "T" "R" "T" ; "T" "T" "R" "R"; "R" "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10017) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 292.49505051 atol=1E-5 @@ -402,7 +402,7 @@ end print(".") #18 #TRT/RTR - rds = CSV.file(path*"/csv/rds18.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds18.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "T"; "R" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10018) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 237.09185442 atol=1E-5 @@ -414,7 +414,7 @@ end print(".") #19 #TRR/RTT - rds = CSV.file(path*"/csv/rds19.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds19.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R"; "R" "T" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10019) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 255.99536281 atol=1E-5 @@ -428,7 +428,7 @@ end #SPSS REML 151.783195849874 #SPSS SE 0.214518365508227 #SPSS DF 10.0167597858775 - rds = CSV.file(path*"/csv/rds20.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds20.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3,4], design = ["T" "R"; "R" "T"; "T" "T"; "R" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0, 0.0], periodcoef = [0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10020) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) @test ReplicateBE.reml2(be) ≈ 151.78319585 atol=1E-5 @@ -440,7 +440,7 @@ end print(".") #21 #TRR/RTR/RRT - rds = CSV.file(path*"/csv/rds21.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds21.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2,3], design = ["T" "R" "R"; "R" "T" "R"; "R" "R" "T"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10021) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) #SPSS REML 237.076723026247 @@ -459,7 +459,7 @@ end print(".") #22 #TRR/RTR - rds = CSV.file(path*"/csv/rds22.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds22.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=48, sequence=[1,2], design = ["T" "R" "R"; "R" "T" "R"], inter=[0.5, 0.4, 0.9], intra=[0.1, 0.2], intercept = 1.0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0], formcoef = [0.0, 0.0], dropobs = 20, seed = 10022) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) #SPSS REML 234.103074 @@ -479,7 +479,7 @@ end # Unbalanced by sequences #23 #TRTR/RTRT - rds = CSV.file(path*"/csv/rds23.csv") |> DataFrame + rds = CSV.File(path*"/csv/rds23.csv") |> DataFrame #rds = ReplicateBE.randrbeds(;n=36, sequence=[1,2], design = ["T" "R" "T" "R"; "R" "T" "R" "T"], inter=[0.5, 0.4, 0.1], intra=[0.1, 0.15], intercept = 1.0, seqcoef = [1.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0], seed = 10023) be = ReplicateBE.rbe!(rds, dvar = :var, subject = :subject, formulation = :formulation, period = :period, sequence = :sequence) ci = confint(be, 0.1, expci = true) From cb543bcaff88f0b21dc9218f716ea219086636df Mon Sep 17 00:00:00 2001 From: PharmCat Date: Tue, 15 Sep 2020 00:58:50 +0300 Subject: [PATCH 09/10] update --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8f2a372..3a07d94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,9 @@ after_success: jobs: allow_failures: - - julia: 1.4 + - julia: + - 1.4 + - 1.5 include: - stage: "Documentation" julia: 1.0 @@ -35,3 +37,7 @@ jobs: Pkg.instantiate()' - julia --project=docs/ docs/make.jl after_success: skip + +script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - travis_wait 20 julia --project -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)' From dfbb9e7ae7c060c5b3b0f2095c49d6286eb9f7d6 Mon Sep 17 00:00:00 2001 From: PharmCat Date: Tue, 15 Sep 2020 01:32:03 +0300 Subject: [PATCH 10/10] update --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3a07d94..0ac17c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,4 +40,4 @@ jobs: script: - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - travis_wait 20 julia --project -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)' + - travis_wait 30 julia --project -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)'