Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
behinger and github-actions[bot] authored Mar 20, 2024
1 parent 7c72e37 commit 5e16915
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions ext/UnfoldMixedModelsExt/statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ Returns a partial LMM model (non-functional due to lacking data) to be used in l
"""
function fake_lmm(m::UnfoldLinearMixedModel, k::Int)
mm = modelmatrix(m)
@assert length(mm) == 1 "LRT currently not implemented for fitting multiple events at the same time"
@assert length(mm) == 1 "LRT is currently not implemented for fitting multiple events at the same time"
feterm = mm[1][1]
#reterm = mm[2:end]
fakeY = zeros(size(feterm, 1))
lmm = LinearMixedModel_wrapper(Unfold.formulas(m), fakeY, mm[1])

fcoll = Unfold.modelfit(m)
#lmm.objective .= fcoll.fits[1].objective
#lmm.optsum.feval .= 1
#lmm.optsum.fmin .= 1
lmm.optsum.sigma = fcoll.fits[k].σ
Expand Down
2 changes: 1 addition & 1 deletion ext/UnfoldMixedModelsExt/typedefinitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Concrete type to implement an deconvolution LinearMixedModel.
`.design` contains the formula + times dict
`.designmatrix` contains a `DesignMatrix`
`modelfit` is a `Any` container for the model results
`.modelfit` is a `Any` container for the model results
"""
mutable struct UnfoldLinearMixedModelContinuousTime{T} <: UnfoldModel{T}
design::Vector{<:Pair}
Expand Down
2 changes: 1 addition & 1 deletion src/basisfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ See FIRBasis for an examples
a BasisFunction should implement:
- kernel() # kernel(b::BasisFunction,sample) => returns the designmatrix for that event
- height() # number of samples in continuous time
- width() # number of predictor-columns (e.g. HRF 1 to 3, FIR height()-1 )
- width() # number of coefficient columns (e.g. HRF 1 to 3, FIR height()-1 )
- colnames() # unique names of expanded columns
- times() # vector of times along expanded columns, length = height()
Expand Down
6 changes: 2 additions & 4 deletions src/fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function StatsModels.fit!(


if isa(uf, UnfoldLinearModel)
@assert length(times(uf)) == size(data, length(size(data)) - 1) "Times Vector does not match second last dimension of input data - forgot to epoch?"
@assert length(times(uf)) == size(data, length(size(data)) - 1) "Times Vector does not match second last dimension of input data - forgot to cut into epochs?"
end

X = modelmatrix(uf)
Expand Down Expand Up @@ -230,7 +230,7 @@ function design_to_modeltype(design)
ext = Base.get_extension(@__MODULE__, :UnfoldMixedModelsExt)
if isnothing(ext)
throw(
"MixedModels not loaded. Please use `]add MixedModels` and `using MixedModels` to install it prior to using",
"MixedModels is not loaded. Please use `]add MixedModels` and `using MixedModels` to install it prior to using",
)
end
end
Expand All @@ -250,5 +250,3 @@ function design_to_modeltype(design)
end
return UnfoldModelType
end


0 comments on commit 5e16915

Please sign in to comment.