-
Notifications
You must be signed in to change notification settings - Fork 1
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
Breaking: refactor #8
Open
behinger
wants to merge
36
commits into
main
Choose a base branch
from
unfold07
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d5f2636
inital lmm_perm
behinger 152b1f6
Moved UnfoldMixedModels also to new extension
behinger 638ba0b
well, it does something now
behinger 67fe653
added lmm clusterperm
behinger eaa207d
forgot to save this file
behinger 247623a
forgot to save
behinger 409f647
Update UnfoldStatsMixedModelsPermutationsExt.jl
behinger 767e5b1
added an 'abs'
behinger 482a8f7
Merge branch 'lmm_perm' of http://github.com/unfoldtoolbox/UnfoldStat…
behinger d747591
Update extract_coefs.jl
behinger 59f0762
upgrade to unfold07
behinger 275e4fb
remove compatability with unfold 0.6
behinger 3b4882c
removed revise requirement
behinger 1594e48
Update Project.toml
behinger 5d4bfbf
Update CI.yml
behinger 096d0fa
fix docs mistake
behinger cbf097b
Merge branch 'unfold07' of http://github.com/unfoldtoolbox/UnfoldStat…
behinger d0fb7cc
add statsmodels, update
behinger 2589578
Update CI.yml
behinger d85d35d
doc fixes
behinger 35b6e7d
major update, might work with unfold0.8?
behinger 6d1f672
compat
behinger 8592f2d
Merge branch 'unfold07' of http://github.com/unfoldtoolbox/UnfoldStat…
behinger b58a866
fix a lot of bugs for newer unfold versions
behinger d2670da
fix fix fix everyhtinggit add test
behinger 5c63b45
Merge pull request #7 from unfoldtoolbox/endless_loop
behinger 1bec33b
forgot to rename
behinger dd44fad
some conflicts with MixedModels.simulate and UnfoldSim.simulate
behinger 0e720cd
Merge branch 'unfold07' of http://github.com/unfoldtoolbox/UnfoldStat…
behinger 4e3331d
finally found the bug
behinger baf213b
maybe maybe maybe
behinger 0f23a85
mayyybe
behinger 56746f5
Update sim_and_fit.jl
behinger e7a0a13
Apply suggestions from code review
behinger 8ae7a93
Add docs preview for PRs
jschepers c12dd91
Fix parantheses and capitalization
jschepers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/docs/Manifest.toml | ||
/docs/build/ | ||
/docs/src/generated | ||
/docs/dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
[deps] | ||
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" | ||
Chain = "8be319e6-bccf-4806-a6f7-6fae938471bc" | ||
ClusterDepth = "c8d8bbfa-f476-4995-adff-2987f04015d1" | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" | ||
HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5" | ||
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" | ||
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" | ||
MixedModelsPermutations = "647c4018-d7ef-4d03-a0cc-8889a722319e" | ||
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d" | ||
Unfold = "181c99d8-e21b-4ff3-b70b-c233eddec679" | ||
UnfoldMakie = "69a5ce3b-64fb-4f22-ae69-36dd4416af2a" | ||
UnfoldMixedModels = "019ae9e0-8363-565c-86e5-97a5a2fe84f4" | ||
UnfoldSim = "ed8ae6d2-84d3-44c6-ab46-0baf21700804" | ||
UnfoldStats = "96fd419a-8306-4ce8-ba5b-cd907cb7647c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# !!! important | ||
# This functionality is not tested. While it returns reasonable results, we haven't written any unit-tests, nor tested the type-1 error probability yet | ||
# get some data | ||
using UnfoldSim | ||
using UnfoldMixedModels | ||
|
||
using MixedModelsPermutations, ClusterDepth # both necessary to activate correct extension! | ||
using UnfoldStats | ||
using StatsModels | ||
using Random | ||
|
||
srate = 25 | ||
design = MultiSubjectDesign(; | ||
n_subjects = 30, | ||
n_items = 40, | ||
items_between = Dict(:stimtype => ["car", "face"]), | ||
) | ||
#both_within = Dict(:condition=>["scrambled","intact"])) | ||
contrasts = Dict(:stimtype => DummyCoding()) | ||
p1 = MixedModelComponent(; | ||
basis = UnfoldSim.p100(; sfreq = srate), | ||
formula = @formula(dv ~ 1 + (1 | subject) + (1 | item)), | ||
β = [5.0], | ||
σs = Dict(:subject => [0.0], :item => [0.0]), | ||
contrasts = contrasts, | ||
); | ||
|
||
n1 = MixedModelComponent(; | ||
basis = UnfoldSim.n170(; sfreq = srate), | ||
formula = @formula(dv ~ 1 + stimtype + (1 + stimtype | subject) + (1 | item)), | ||
β = [1.0, 4], # n170-basis is negative | ||
σs = Dict(:subject => [2.0, 0.25], :item => [0.25]), | ||
contrasts = contrasts, | ||
); | ||
|
||
p3 = MixedModelComponent(; | ||
basis = UnfoldSim.p300(; sfreq = srate), | ||
formula = @formula(dv ~ 1 + (1 | subject) + (1 + stimtype | item)), | ||
β = [4.0], | ||
σs = Dict(:subject => [1.0], :item => [0.5, 2]), | ||
contrasts = contrasts, | ||
); | ||
|
||
|
||
|
||
data_e, events = UnfoldSim.simulate( | ||
design, | ||
[p1, n1, p3], | ||
UniformOnset(srate * 2, 10), | ||
PinkNoise(; noiselevel = 1); | ||
return_epoched = true, | ||
) # 18 | ||
times = range(-0.1, 0.5, length = size(data_e, 1)) | ||
data_e = reshape(data_e, 1, size(data_e, 1), :) | ||
#events.latency .+= repeat(range(0,length=size(data,2),step=size(data,1)),inner=size(events[events.subject.=="S01",:],1)) | ||
|
||
|
||
|
||
# # Fit LMM | ||
m = fit( | ||
UnfoldModel, | ||
[ | ||
Any => ( | ||
@formula(0 ~ 1 + stimtype + (1 + stimtype | item) + (1 + stimtype | subject)), | ||
times, | ||
), | ||
], | ||
events, | ||
data_e, | ||
); | ||
|
||
|
||
# # Cluster Permute :) | ||
coefficient = 2 | ||
pvalue( | ||
MersenneTwister(1), | ||
m, | ||
data_e, | ||
coefficient; | ||
n_permutations = 10, | ||
clusterforming_threshold = 1.8, | ||
) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶