Skip to content

Commit

Permalink
Merge branch 'main' into formatEverything
Browse files Browse the repository at this point in the history
  • Loading branch information
behinger authored Feb 2, 2024
2 parents fa48699 + dc0990d commit bbe51fa
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Unfold"
uuid = "181c99d8-e21b-4ff3-b70b-c233eddec679"
authors = ["Benedikt Ehinger <[email protected]>"]
version = "0.6.4"
version = "0.6.5"

[deps]
BSplineKit = "093aae92-e908-43d7-9660-e50ee39d5a0a"
Expand Down
61 changes: 53 additions & 8 deletions src/typedefinitions.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@

"""
The main abstract model-type of the toolbox. E.g. `UnfoldLinearModel` is a concrete type of this
"""
abstract type UnfoldModel end


"""
Abstract Type to report modelresults
"""
abstract type ModelFit end



"""
DesignMatrix
Type that keeps an Array of `formulas`, designmatrices `Xs` (Array or Array of Arrays in case of MixedModel) and `events`-dataframe
"""
struct DesignMatrix
"Array of formulas"
formulas::Any
Expand All @@ -12,10 +30,12 @@ function DesignMatrix()
end


abstract type UnfoldModel end

#function UnfoldModel()
# todo make generator function with empty DesignMatrix
"""
Concrete type to implement an Mass-Univariate LinearModel.
`.design` contains the formula + times dict
`.designmatrix` contains a `DesignMatrix`
`modelfit` is a `Any` container for the model results
"""
mutable struct UnfoldLinearModel <: UnfoldModel
design::Dict
designmatrix::DesignMatrix
Expand All @@ -25,6 +45,12 @@ end
UnfoldLinearModel(d::Dict) = UnfoldLinearModel(d, Unfold.DesignMatrix(), [])
UnfoldLinearModel(d::Dict, X::DesignMatrix) = UnfoldLinearModel(d, X, [])

"""
Concrete type to implement an Mass-Univariate LinearMixedModel.
`.design` contains the formula + times dict
`.designmatrix` contains a `DesignMatrix`
`modelfit` is a `Any` container for the model results
"""
mutable struct UnfoldLinearMixedModel <: UnfoldModel
design::Dict
designmatrix::DesignMatrix
Expand All @@ -33,7 +59,12 @@ end
UnfoldLinearMixedModel(d::Dict) = UnfoldLinearMixedModel(d, Unfold.DesignMatrix(), [])
UnfoldLinearMixedModel(d::Dict, X::DesignMatrix) = UnfoldLinearMixedModel(d, X, [])


"""
Concrete type to implement an deconvolution LinearModel.
`.design` contains the formula + times dict
`.designmatrix` contains a `DesignMatrix`
`modelfit` is a `Any` container for the model results
"""
mutable struct UnfoldLinearModelContinuousTime <: UnfoldModel
design::Dict
designmatrix::DesignMatrix
Expand All @@ -45,6 +76,15 @@ UnfoldLinearModelContinuousTime(d::Dict) =
UnfoldLinearModelContinuousTime(d::Dict, X::DesignMatrix) =
UnfoldLinearModelContinuousTime(d, X, [])

"""
Concrete type to implement an deconvolution LinearMixedModel.
**Warning** This is to be treated with care, not much testing went into it.
`.design` contains the formula + times dict
`.designmatrix` contains a `DesignMatrix`
`modelfit` is a `Any` container for the model results
"""
mutable struct UnfoldLinearMixedModelContinuousTime <: UnfoldModel
design::Dict
designmatrix::DesignMatrix
Expand All @@ -56,15 +96,16 @@ UnfoldLinearMixedModelContinuousTime(d::Dict) =
UnfoldLinearMixedModelContinuousTime(d::Dict, X::DesignMatrix) =
UnfoldLinearMixedModelContinuousTime(d, X, [])


abstract type ModelFit end

"""
Contains the results of linearmodels (continuous and not)
"""
struct LinearModelFit <: ModelFit
estimate::Any
info::Any
standarderror::Any
end

LinearModelFit() = LinearModelFit([], [], [])
LinearModelFit(estimate) = LinearModelFit(estimate, [], [])
LinearModelFit(estimate, info) = LinearModelFit(estimate, info, [])

Expand All @@ -81,5 +122,9 @@ function Base.show(io::IO, obj::UnfoldModel)
)
end

"""
Abstract non-linear spline term.
Implemented in `UnfoldBSplineKitExt`
"""

abstract type AbstractSplineTerm <: AbstractTerm end

0 comments on commit bbe51fa

Please sign in to comment.