Today we will talk about how to confront models with experimental data. Does my model capture the behavior of my participant or its neural activity? Does the data support my model against alternatives? Which component in the model is needed? Do parameters in the model vary systematically between two subject populations? We will cover the basic concepts and tools to address these questions, starting with a general overview in the intro. You will learn how to estimate the parameters of simple regression models from the data in Tutorials 1 & 2 and then how to estimate the uncertainty about these values in Tutorial 3. Then you will learn how to select from models of different complexity the one that best accounts for your data (Tutorial 4-6). The outro illustrates some of these techniques in real research examples.
Fitting and comparing models to data is really the bread and butter of data analysis in neuroscience. During Model Types Day, you learned about a whole zoo of different types of models that we're interested in neuroscience. So here, you will learn about generic concepts and techniques that apply for fitting and comparing any type of model, which is arguably pretty useful! You will apply these tools again when dealing with GLMs, latent models, deep networks, dynamical models, decision models, reinforcement learning models... it's everywhere! On top of this, we will cover linear regression models, the typical regression model when the dependent variable is continuous (e.g., BOLD activity), and use it throughout the day to illustrate the concepts and methods we learn. On the GLM day, you will see how to generalize regression models when the dependent variable is binary (e.g., choices) or an integer (e.g., spike counts).
Almost all statistical and data analysis methods rely either explicitly or implicitly on fitting some model to the data. The concepts and tools you will learn today are crucial to be able to test your hypothesis about how behavior or neural activity is formed. A typical way this is done is that you formulate a computational (stochastic) model that embodies your hypothesis and then one or more control models. Then you fit each of your models to your experimental data, say the pattern of choices of one experimental subject or the spiking activity from one recorded neuron. Simulating your fitted models allows validating that your model indeed captures the effects of interest in your data. Then you use model comparison techniques to tell which one of your main or control model(s) provides a better description of the data. Also, you could assess whether some parameter in your model changes between experimental conditions or subject populations.
# @title Install and import feedback gadget
!pip3 install vibecheck datatops --quiet
from vibecheck import DatatopsContentReviewContainer
def content_review(notebook_section: str):
return DatatopsContentReviewContainer(
"", # No text prompt
notebook_section,
{
"url": "https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab",
"name": "neuromatch_cn",
"user_key": "y1x3mpx5",
},
).render()
feedback_prefix = "W1D2_Intro"
# @markdown
from ipywidgets import widgets
from IPython.display import YouTubeVideo
from IPython.display import IFrame
from IPython.display import display
class PlayVideo(IFrame):
def __init__(self, id, source, page=1, width=400, height=300, **kwargs):
self.id = id
if source == 'Bilibili':
src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'
elif source == 'Osf':
src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'
super(PlayVideo, self).__init__(src, width, height, **kwargs)
def display_videos(video_ids, W=400, H=300, fs=1):
tab_contents = []
for i, video_id in enumerate(video_ids):
out = widgets.Output()
with out:
if video_ids[i][0] == 'Youtube':
video = YouTubeVideo(id=video_ids[i][1], width=W,
height=H, fs=fs, rel=0)
print(f'Video available at https://youtube.com/watch?v={video.id}')
else:
video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,
height=H, fs=fs, autoplay=False)
if video_ids[i][0] == 'Bilibili':
print(f'Video available at https://www.bilibili.com/video/{video.id}')
elif video_ids[i][0] == 'Osf':
print(f'Video available at https://osf.io/{video.id}')
display(video)
tab_contents.append(out)
return tab_contents
video_ids = [('Youtube', '9JfXKmVB6qc'), ('Bilibili', 'BV1BX4y1w7oc')]
tab_contents = display_videos(video_ids, W=854, H=480)
tabs = widgets.Tab()
tabs.children = tab_contents
for i in range(len(tab_contents)):
tabs.set_title(i, video_ids[i][0])
display(tabs)
# @markdown
from IPython.display import IFrame
link_id = "sqcvz"
print(f"If you want to download the slides: https://osf.io/download/{link_id}/")
IFrame(src=f"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render", width=854, height=480)
# @title Submit your feedback
content_review(f"{feedback_prefix}_Intro_Video")