Skip to content

Commit

Permalink
build based on 2133f61
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Oct 2, 2024
1 parent c909b65 commit 8bbbde9
Show file tree
Hide file tree
Showing 29 changed files with 105 additions and 68 deletions.
2 changes: 1 addition & 1 deletion previews/PR221/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-02T20:03:27","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-02T20:38:29","documenter_version":"1.7.0"}}
4 changes: 2 additions & 2 deletions previews/PR221/HowTo/custom_solvers/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions previews/PR221/HowTo/lmm_pvalues/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions previews/PR221/HowTo/multiple_events/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions previews/PR221/HowTo/pymne/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions previews/PR221/HowTo/standarderrors/index.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
6 changes: 3 additions & 3 deletions previews/PR221/explanations/basisfunctions/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions previews/PR221/explanations/development/index.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions previews/PR221/generated/HowTo/contrasts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Change contrasts / coding schema · Unfold.jl Timeseries Analysis &amp; Deconvolution</title><meta name="title" content="Change contrasts / coding schema · Unfold.jl Timeseries Analysis &amp; Deconvolution"/><meta property="og:title" content="Change contrasts / coding schema · Unfold.jl Timeseries Analysis &amp; Deconvolution"/><meta property="twitter:title" content="Change contrasts / coding schema · Unfold.jl Timeseries Analysis &amp; Deconvolution"/><meta name="description" content="Documentation for Unfold.jl Timeseries Analysis &amp; Deconvolution."/><meta property="og:description" content="Documentation for Unfold.jl Timeseries Analysis &amp; Deconvolution."/><meta property="twitter:description" content="Documentation for Unfold.jl Timeseries Analysis &amp; Deconvolution."/><script data-outdated-warner src="../../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../../assets/documenter.js"></script><script src="../../../search_index.js"></script><script src="../../../siteinfo.js"></script><script src="../../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../../../">Unfold.jl Timeseries Analysis &amp; Deconvolution</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../../">Unfold Documentation</a></li><li><a class="tocitem" href="../../../installation/">Installing Julia + Unfold.jl</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../../tutorials/lm_mu/">Mass univariate LM</a></li><li><a class="tocitem" href="../../../tutorials/lm_overlap/">LM overlap correction</a></li><li><a class="tocitem" href="../../../tutorials/lmm_mu/">Mass univariate Mixed Model</a></li><li><a class="tocitem" href="../../../tutorials/lmm_overlap/">LMM + overlap correction</a></li></ul></li><li><span class="tocitem">HowTo</span><ul><li><a class="tocitem" href="../../../HowTo/multiple_events/">Overlap: Multiple events</a></li><li><a class="tocitem" href="../../../HowTo/pymne/">Import EEG with 🐍 PyMNE.jl</a></li><li><a class="tocitem" href="../../../HowTo/standarderrors/">Standard errors</a></li><li><a class="tocitem" href="../../../HowTo/custom_solvers/">Alternative Solvers (Robust, GPU, B2B)</a></li><li><a class="tocitem" href="../juliacall_unfold/">🐍 Calling Unfold.jl directly from Python</a></li><li><a class="tocitem" href="../../../HowTo/lmm_pvalues/">P-values for mixedModels</a></li><li><a class="tocitem" href="../effects/">Marginal effects (focus on non-linear predictors)</a></li><li><a class="tocitem" href="../unfold_io/">Save and load Unfold models</a></li><li class="is-active"><a class="tocitem" href>Change contrasts / coding schema</a></li></ul></li><li><span class="tocitem">Explanations</span><ul><li><a class="tocitem" href="../../../explanations/basisfunctions/">About basisfunctions</a></li><li><a class="tocitem" href="../../explanations/nonlinear_effects/">Non-Linear effects</a></li><li><a class="tocitem" href="../../explanations/window_length/">Window Length Effect</a></li></ul></li><li><span class="tocitem">Reference</span><ul><li><a class="tocitem" href="../../../references/extensions/">Overview of package extensions</a></li><li><a class="tocitem" href="../../../explanations/development/">Development environment</a></li><li><a class="tocitem" href="../../../references/types/">API: Types</a></li><li><a class="tocitem" href="../../../references/functions/">API: Functions</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">HowTo</a></li><li class="is-active"><a href>Change contrasts / coding schema</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Change contrasts / coding schema</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/unfoldtoolbox/Unfold.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/unfoldtoolbox/Unfold.jl/blob/main/docs/literate/HowTo/contrasts.jl" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><pre><code class="language-julia hljs">using CairoMakie
using Unfold
using UnfoldMakie
using UnfoldSim


# Contrast coding</code></pre><p>Unfold.jl uses the <code>StatsModels</code> package for the formula interface. This allows for a wide range of contrast coding schemes. For a full tutorial, please see <a href="https://juliastats.org/StatsModels.jl/stable/contrasts/">the StatsModels docs</a>. Please read their tutorial, as a motivation of why one would change the contrast coding scheme is outside of the realms of this package and more a basic linear regression question.</p><div class="admonition is-category-hint"><header class="admonition-header">Hint</header><div class="admonition-body"><p>Given we have a nice <code>effects</code> implementation (mimicking <code>emmeans</code> and similar packages), coding schema is typically less important.</p></div></div><p>Here we will show a simple example of how to change the contrast coding scheme. We will use the <code>condition</code> variable, which has two levels, <code>A</code> and <code>B</code>. We will change the contrast coding from <code>Dummy</code> aka <code>Reference</code> aka 0/1 coding to <code>Sum</code> coding, which is the default in R.</p><pre><code class="language-julia hljs">eeg, evts = UnfoldSim.predef_eeg(noiselevel = 0)
f = @formula 0 ~ 1 + condition
basis = firbasis((-0.1, 0.6), 100)
m_dummy = fit(UnfoldModel, f, evts, eeg, basis)
m_effec =
fit(UnfoldModel, f, evts, eeg, basis; contrasts = Dict(:condition =&gt; EffectsCoding()))</code></pre>Unfold-Type: ::UnfoldLinearModelContinuousTime{{Float64}}
 Any => Any: timeexpand(1 + condition) for times [-0.1, -0.09 ... 0.6]

✔ model is fit. size(coefs) (1, 142)

Useful functions: `design(uf)`, `designmatrix(uf)`, `coef(uf)`, `coeftable(uf)`<p>we could directly inspect the designmatrix</p><pre><code class="language-julia hljs">modelmatrix(m_dummy, false)[1][1:5, :]</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">5×2 Matrix{Float64}:
1.0 0.0
1.0 0.0
1.0 0.0
1.0 1.0
1.0 0.0</code></pre><p>and the effects coding</p><pre><code class="language-julia hljs">modelmatrix(m_effec, false)[1][1:5, :]</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">5×2 Matrix{Float64}:
1.0 -1.0
1.0 -1.0
1.0 -1.0
1.0 1.0
1.0 -1.0</code></pre><p>To confirm the difference in the actual fit, let&#39;s visualize them</p><pre><code class="language-julia hljs">c_d = coeftable(m_dummy)
c_e = coeftable(m_effec)
c_d.group .= &quot;Dummy Coding&quot;
c_e.group .= &quot;Effects Coding&quot;
c = vcat(c_d, c_e)

plot_erp(c; mapping = (; color = :coefname, col = :group))</code></pre><img src="e824237d.png" alt="Example block output"/><p>As expected, the effects-coding slope of <code>condition: face</code> is half the size of the dummy-coding one (because -1/1 coding was used).</p><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../unfold_io/">« Save and load Unfold models</a><a class="docs-footer-nextpage" href="../../../explanations/basisfunctions/">About basisfunctions »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Wednesday 2 October 2024 20:38">Wednesday 2 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 8bbbde9

Please sign in to comment.