API
ReplicateBE.RBE
Main.ReplicateBE.RBE — Type. struct RBE
model::ModelFrame #Model frame
rmodel::ModelFrame #Random effect model
design::Design #Design description
factors::Array{Symbol, 1} #Factor list
θ0::Array{Float64, 1} #Initial variance paramethers
θ::Tuple{Vararg{Float64}} #Final variance paramethers
reml::Float64 #-2REML
fixed::EffectTable #Fixed Effect table
typeiii::ContrastTable #Type III table
R::Array{Matrix{Float64},1} #R matrices for each subject
V::Array{Matrix{Float64},1} #V matrices for each subject
G::Matrix{Float64} #G matrix
C::Matrix{Float64} #C var(β) p×p variance-covariance matrix
A::Matrix{Float64} #asymptotic variance-covariance matrix of b θ
H::Matrix{Float64} #Hessian matrix
X::Matrix #Matrix for fixed effects
Z::Matrix #Matrix for random effects
Xv::Array{Matrix{Float64},1} #X matrices for each subject
Zv::Array{Matrix{Float64},1} #Z matrices for each subject
yv::Array{Array{Float64, 1},1} #responce vectors for each subject
detH::Float64 #Hessian determinant
preoptim::Union{Optim.MultivariateOptimizationResults, Nothing} #Pre-optimization result object
optim::Optim.MultivariateOptimizationResults #Optimization result object
endReplicate bioequivalence structure.
ReplicateBE.rbe
Main.ReplicateBE.rbe — Function.rbe(df; dvar::Symbol,
subject::Symbol,
formulation::Symbol,
period::Symbol,
sequence::Symbol,
g_tol::Float64 = 1e-8, x_tol::Float64 = 0.0, f_tol::Float64 = 0.0, iterations::Int = 100,
store_trace = false, extended_trace = false, show_trace = false,
memopt = true)Mixed model fitting function for replicate bioequivalence without data preparation (apply categorical! for each factor and sort! to dataframe).
Mixed model in matrix form:
math
with covariance matrix for each subject:
StatsBase.coef
StatsBase.coef — Function.coef(obj::StatisticalModel)Return the coefficients of the model.
coef(rbe::RBE)Return model coefficients.
$\beta = {(\sum_{i=1}^n X_{i}'V_i^{-1}X_{i})}^{-1}(\sum_{i=1}^n X_{i}'V_i^{-1}y_{i})$
coef(rbe::RBE)Return model coefficients.
$\beta = {(\sum_{i=1}^n X_{i}'V_i^{-1}X_{i})}^{-1}(\sum_{i=1}^n X_{i}'V_i^{-1}y_{i})$
coef(rbe::RBE)Return model coefficients.
$\beta = {(\sum_{i=1}^n X_{i}'V_i^{-1}X_{i})}^{-1}(\sum_{i=1}^n X_{i}'V_i^{-1}y_{i})$
coef(rbe::RBE)Return model coefficients.
$\beta = {(\sum_{i=1}^n X_{i}'V_i^{-1}X_{i})}^{-1}(\sum_{i=1}^n X_{i}'V_i^{-1}y_{i})$
coef(rbe::RBE)Return model coefficients.
$\beta = {(\sum_{i=1}^n X_{i}'V_i^{-1}X_{i})}^{-1}(\sum_{i=1}^n X_{i}'V_i^{-1}y_{i})$
coef(rbe::RBE)Return model coefficients.
StatsBase.confint
StatsBase.confint — Function.confint(obj::StatisticalModel; level::Real=0.95)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
confint(obj::RBE; level::Real=0.95, expci::Bool = false, inv::Bool = false, df = :sat)Compute confidence intervals for coefficients, with confidence level level (by default 95%).
Arguments
expci = true: return exponented CI.
inv = true: return -estimate ± t*se
df = :sat: use Satterthwaite DF approximation.
df = :df3 or df = :cont: DF (contain) = N - rank(ZX).
StatsBase.dof
StatsBase.dof — Function.dof(obj::StatisticalModel)Return the number of degrees of freedom consumed in the model, including when applicable the intercept and the distribution's dispersion parameter.
dof(d::UnivariateDistribution)Get the degrees of freedom.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
dof(rbe::RBE)Return the number of degrees of freedom for the coefficients of the model.
StatsBase.stderror
StatsBase.stderror — Function.stderror(obj::StatisticalModel)Return the standard errors for the coefficients of the model.
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
$se = \sqrt{LCL'}$
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
$se = \sqrt{LCL'}$
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
$se = \sqrt{LCL'}$
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
$se = \sqrt{LCL'}$
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
$se = \sqrt{LCL'}$
StatsBase.stderror(rbe::RBE)Return the standard errors for the coefficients of the model.
ReplicateBE.coefnum
Main.ReplicateBE.coefnum — Function.coefnum(rbe::RBE)Return number of coefficients (length β).
ReplicateBE.contrast
Main.ReplicateBE.contrast — Function.contrast(rbe::RBE, L::Matrix; numdf = 1, name = "Contrast", memopt = true)::ContrastTableReturn contrast table for L matrix.
DF for one-dimetion case:
where $A = 2H$
where $g = \triangledown _{\theta}(LC^{-1}L')$
DF for multi-dimention case:
ReplicateBE.design
Main.ReplicateBE.design — Function.design(rbe::RBE)::DesignReturn design information object, where:
struct Design
obs::Int # Number of observations
subj::Int # Number of statistica independent subjects
sqn::Int # Number of sequences
pn::Int # Number of periods
fn::Int # Number of formulations
sbf::Vector{Int} # Subjects in each formulation level
rankx::Int # Rank of fixed effect matrix
rankxz::Int # Rank of XZ (fixed+random) effect matrix
df2::Int # subj - sqn (Robust DF)
df3::Int # obs - rankxz (Contain DF for sequence and period)
df4::Int # obs - rankxz + p
endReplicateBE.estimate
Main.ReplicateBE.estimate — Function.estimate(rbe::RBE, L::Matrix; df = :sat, name = "Estimate", memopt = true, alpha = 0.05)Return estimate table for L 1xp matrix.
For df = :sat:
where $A = 2H$
where $g = \triangledown _{\theta}(LC^{-1}L')$
For df = :cont (contain):
CI estimate is:
ReplicateBE.fixed
Main.ReplicateBE.fixed — Function.fixed(rbe::RBE)Return fixed effect table (β).
ReplicateBE.randrbeds
Main.ReplicateBE.randrbeds — Function. 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 = 0, seqcoef = [0.0, 0.0], periodcoef = [0.0, 0.0, 0.0, 0.0], formcoef = [0.0, 0.0],
dropsubj = 0.0, dropobs::Int = 0, seed::Int = 0)Random dataset generation for bioequivalence.
Parameters
* n: number of subjects
* sequence: distribution in sequences [1,1] means 1:1, [1,3] - 1:4 etc.
* design: desin matrix, each line is a sequence, each column - periods, cell - formulation id
* inter: inter-subject variance vector for G matrix (length 3)
* intra: intra-subject variance vector for R matrix (length 2)
* intercept: intercept effect value
* seqcoef: coefficients of sequences (length(sequence) == length(seqcoef) == size(design, 1))
* periodcoef: coefficients of periods (length(periodcoef) == size(design, 2))
* formcoef: coeficients of formulations
* dropobs: number of randomly dropped subjects
* seed: seed for randomMultivariate normal disribution:
Where V:
randrbeds(n::Int, sequence::Vector,
design::Matrix,
θinter::Vector, θintra::Vector,
intercept::Real, seqcoef::Vector, periodcoef::Vector, formcoef::Vector,
dropsubj::Float64, dropobs::Int, seed::Int)Simple interface.
ReplicateBE.reml2
Main.ReplicateBE.reml2 — Function.reml2(rbe::RBE, θ::Array{Float64, 1})Returm -2REML for rbe model
reml2(rbe::RBE)Returm -2logREML for rbe model
ReplicateBE.typeiii
Main.ReplicateBE.typeiii — Function.typeiii(rbe::RBE)Return TYPE III table.
see contrast