Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The effects function does not work for models of type UnfoldLinearMixedModel #113

Open
jschepers opened this issue May 22, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jschepers
Copy link
Collaborator

When one calls the effects function for models of type UnfoldLinearMixedModel, one gets a MethodError:

Example:

data2, evts2 = UnfoldSim.predef_2x2(; n_subjects=5, return_epoched=true);
f2 = @formula(0 ~ 1 + A * B + (1 | subject));
τ2 = [-0.1, 1];
sfreq2 = 100;
times2 = range(τ2[1], length=size(data2, 1), step=1 ./ sfreq2);
m2 = Unfold.fit(UnfoldModel, Dict(Any => (f2, times2)), evts2, reshape(data2, 1, size(data2)...));

# Trying to use the `effects` function
conditions = Dict(:A => levels(evts2.A), :B => levels(evts2.B))
eff2 = effects(conditions, m2)

The last line leads to the following error:

julia> eff2 = effects(conditions, m2)
ERROR: MethodError: no method matching modelmatrix(::UnfoldLinearMixedModel, ::Bool)
Closest candidates are:
  modelmatrix(::StatsModels.FormulaTerm, ::Any; kwargs...) at ~/.julia/packages/StatsModels/fK0P3/src/modelframe.jl:92
  modelmatrix(::Union{Tuple{Union{Tuple{StatsModels.AbstractTerm, Vararg{StatsModels.AbstractTerm}}, StatsModels.AbstractTerm}, Vararg{Union{Tuple{StatsModels.AbstractTerm, Vararg{StatsModels.AbstractTerm}}, StatsModels.AbstractTerm}}}, StatsModels.AbstractTerm}, ::Any; hints, mod) at ~/.julia/packages/StatsModels/fK0P3/src/modelframe.jl:116
  modelmatrix(::StatsModels.TableRegressionModel, ::Any...; kwargs...) at ~/.julia/packages/StatsModels/fK0P3/src/statsmodel.jl:28
@jschepers jschepers added the bug Something isn't working label May 22, 2023
@behinger
Copy link
Member

behinger commented Feb 2, 2024

partially implemented. Still missing is the UnfoldMixedModelContinuous case

@behinger behinger added enhancement New feature or request and removed bug Something isn't working labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants