{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/35095174","id":35095174,"diff_hunk":"@@ -134,3 +135,197 @@ def _fit_lm(data, design_matrix, names):\n         mlog10_p_val[predictor] = -np.log10(p_val[predictor])\n \n     return beta, stderr, t_val, p_val, mlog10_p_val\n+\n+\n+def linear_regression_raw(raw, events, event_id=None,\n+                          tmin=-.1, tmax=1,\n+                          covariates=None,\n+                          reject=None, tstep=1.,\n+                          decim=1, picks=None,\n+                          solver='pinv'):\n+    \"\"\"Estimate regression-based evoked potentials/fields by linear modelling\n+    of the full M/EEG time course, including correction for overlapping\n+    potentials and allowing for continuous/scalar predictors. Internally, this\n+    constructs a predictor matrix X of size n_samples * (n_conds * window\n+    length), solving the linear system Y = bX and returning b as evoked-like\n+    time series split by condition.\n+\n+    See Smith, N. J., & Kutas, M. (2015). Regression-based estimation of ERP\n+    waveforms: II. Non-linear effects, overlap correction, and practical\n+    considerations. Psychophysiology, 52(2), 169-189.\n+\n+    Parameters\n+    ----------\n+    raw : instance of Raw\n+        A raw object. Warning: be very careful about data that is not\n+        downsampled, as the resulting matrices can be enormous and easily\n+        overload your computer. Typically, 100 hz sampling rate is\n+        appropriate - or using the decim keyword (see below).\n+    events : array\n+        An n x 3 array, where the first column corresponds to samples in raw\n+        and the last to integer codes in event_id.\n+    event_id : dict\n+        As in Epochs; a dictionary where the values may be integers or\n+        list-like collections of integers, corresponding to the 3rd column of\n+        events, and the keys are condition names.\n+    tmin : float | dict\n+        If float, gives the lower limit (in seconds) for the time window for\n+        which all event types' effects are estimated. If a dict, can be used to\n+        specify time windows for specific event types: keys correspond to keys\n+        in event_id and/or covariates; for missing values, the default (-.1) is\n+        used.\n+    tmax : float | dict\n+        If float, gives the upper limit (in seconds) for the time window for\n+        which all event types' effects are estimated. If a dict, can be used to\n+        specify time windows for specific event types: keys correspond to keys\n+        in event_id and/or covariates; for missing values, the default (1.) is\n+        used.\n+    covariates : dict-like | None\n+        If dict-like, values have to be array-like and of the same length as\n+        the columns in ```events```. Keys correspond to additional event\n+        types/conditions to be estimated and are matched with the time points\n+        given by the first column of ```events```. If None, only binary events\n+        (from event_id) are used.\n+    reject : None | dict\n+        Activate rejection parameters based on peak-to-peak amplitude in\n+        continuously selected subwindows. If reject is None, no rejection is\n+        done. If dict, keys are types ('grad' | 'mag' | 'eeg' | 'eog' | 'ecg')\n+        and values are the maximal peak-to-peak values to select rejected\n+        epochs. E.g. reject = dict(grad=4000e-12, # T / m (gradiometers)\n+                                   mag=4e-11, # T (magnetometers)\n+                                   eeg=40e-5, # uV (EEG channels)\n+                                   eog=250e-5 # uV (EOG channels))\n+    tstep : float\n+        Length of windows for peak-to-peak detection.\n+    decim : int\n+        Decimate by choosing only a subsample of data points. Highly\n+        recommended for data recorded at high sampling frequencies, as\n+        otherwise huge intermediate matrices have to be created and inverted.\n+    picks : None | list\n+        List of indices of channels to be included. If None, defaults to all\n+        MEG and EEG channels.\n+    solver : str | function\n+        Either a function which takes as its inputs the predictor matrix X\n+        and the observation matrix Y, and returns the coefficient matrix b;\n+        or a string (for now, only 'pinv'), in which case the solver used\n+        is dot(scipy.linalg.pinv(dot(X.T, X)), dot(X.T, Y.T)).T.\n+\n+    Returns\n+    -------\n+    ev_dict : dictionary\n+        A dictionary where the keys correspond to conditions and the values are\n+        Evoked objects with the rE[R/F]Ps. These can be used exactly like any\n+        other Evoked object, including e.g. plotting or statistics.\n+    \"\"\"\n+\n+    if isinstance(solver, str):\n+        if solver == 'pinv':\n+            fast_dot = _get_fast_dot()\n+\n+            # inv is slightly (~10%) faster, but pinv seemingly more stable\n+            def solver(X, Y):\n+                return fast_dot(linalg.pinv(fast_dot(X.T, X)),\n+                                fast_dot(X.T, Y.T)).T\n+        else:\n+            raise ValueError(\"No such solver: {}\".format(solver))\n+\n+    # prepare raw and events\n+    if picks is None:\n+        picks = pick_types(raw.info, meg=True, eeg=True, ref_meg=True)\n+    info = pick_info(raw.info, picks)","path":"mne/stats/regression.py","position":122,"original_position":122,"commit_id":"33ee7b30b75c8dab493a013dc0f5518266dda95c","original_commit_id":"33ee7b30b75c8dab493a013dc0f5518266dda95c","user":{"login":"dengemann","id":1908618,"avatar_url":"https://avatars.githubusercontent.com/u/1908618?v=3","gravatar_id":"","url":"https://api.github.com/users/dengemann","html_url":"https://github.com/dengemann","followers_url":"https://api.github.com/users/dengemann/followers","following_url":"https://api.github.com/users/dengemann/following{/other_user}","gists_url":"https://api.github.com/users/dengemann/gists{/gist_id}","starred_url":"https://api.github.com/users/dengemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengemann/subscriptions","organizations_url":"https://api.github.com/users/dengemann/orgs","repos_url":"https://api.github.com/users/dengemann/repos","events_url":"https://api.github.com/users/dengemann/events{/privacy}","received_events_url":"https://api.github.com/users/dengemann/received_events","type":"User","site_admin":false},"body":"be explciti here, copy=True","created_at":"2015-07-21T12:15:32Z","updated_at":"2015-07-21T12:15:32Z","html_url":"https://github.com/mne-tools/mne-python/pull/2304#discussion_r35095174","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/35095174"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/2304#discussion_r35095174"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304","id":40028022,"html_url":"https://github.com/mne-tools/mne-python/pull/2304","diff_url":"https://github.com/mne-tools/mne-python/pull/2304.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/2304.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2304","number":2304,"state":"open","locked":false,"title":"MRG: add rERP/rERF","user":{"login":"jona-sassenhagen","id":4321826,"avatar_url":"https://avatars.githubusercontent.com/u/4321826?v=3","gravatar_id":"","url":"https://api.github.com/users/jona-sassenhagen","html_url":"https://github.com/jona-sassenhagen","followers_url":"https://api.github.com/users/jona-sassenhagen/followers","following_url":"https://api.github.com/users/jona-sassenhagen/following{/other_user}","gists_url":"https://api.github.com/users/jona-sassenhagen/gists{/gist_id}","starred_url":"https://api.github.com/users/jona-sassenhagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jona-sassenhagen/subscriptions","organizations_url":"https://api.github.com/users/jona-sassenhagen/orgs","repos_url":"https://api.github.com/users/jona-sassenhagen/repos","events_url":"https://api.github.com/users/jona-sassenhagen/events{/privacy}","received_events_url":"https://api.github.com/users/jona-sassenhagen/received_events","type":"User","site_admin":false},"body":"rERP function.\r\n~~Missing tests.~~\r\n\r\nName not optimal; the original routine is of course called rERP, but @agramfort wants a name that includes MEG\r\n\r\nSee http://vorpus.org/papers/smith-kutas-2015-rerps-2-with-si.pdf\r\n\r\nAddresses #1808\r\n\r\n@choldgraf @wmvanvliet @teonlamont ","created_at":"2015-07-15T14:24:09Z","updated_at":"2015-07-21T12:15:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21eb388f9b0703c72844fc64291a833c76a0fa50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304/comments","review_comment_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2304/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/33ee7b30b75c8dab493a013dc0f5518266dda95c","head":{"label":"jona-sassenhagen:patch-10","ref":"patch-10","sha":"33ee7b30b75c8dab493a013dc0f5518266dda95c","user":{"login":"jona-sassenhagen","id":4321826,"avatar_url":"https://avatars.githubusercontent.com/u/4321826?v=3","gravatar_id":"","url":"https://api.github.com/users/jona-sassenhagen","html_url":"https://github.com/jona-sassenhagen","followers_url":"https://api.github.com/users/jona-sassenhagen/followers","following_url":"https://api.github.com/users/jona-sassenhagen/following{/other_user}","gists_url":"https://api.github.com/users/jona-sassenhagen/gists{/gist_id}","starred_url":"https://api.github.com/users/jona-sassenhagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jona-sassenhagen/subscriptions","organizations_url":"https://api.github.com/users/jona-sassenhagen/orgs","repos_url":"https://api.github.com/users/jona-sassenhagen/repos","events_url":"https://api.github.com/users/jona-sassenhagen/events{/privacy}","received_events_url":"https://api.github.com/users/jona-sassenhagen/received_events","type":"User","site_admin":false},"repo":{"id":26366770,"name":"mne-python","full_name":"jona-sassenhagen/mne-python","owner":{"login":"jona-sassenhagen","id":4321826,"avatar_url":"https://avatars.githubusercontent.com/u/4321826?v=3","gravatar_id":"","url":"https://api.github.com/users/jona-sassenhagen","html_url":"https://github.com/jona-sassenhagen","followers_url":"https://api.github.com/users/jona-sassenhagen/followers","following_url":"https://api.github.com/users/jona-sassenhagen/following{/other_user}","gists_url":"https://api.github.com/users/jona-sassenhagen/gists{/gist_id}","starred_url":"https://api.github.com/users/jona-sassenhagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jona-sassenhagen/subscriptions","organizations_url":"https://api.github.com/users/jona-sassenhagen/orgs","repos_url":"https://api.github.com/users/jona-sassenhagen/repos","events_url":"https://api.github.com/users/jona-sassenhagen/events{/privacy}","received_events_url":"https://api.github.com/users/jona-sassenhagen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jona-sassenhagen/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/jona-sassenhagen/mne-python","forks_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/forks","keys_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/teams","hooks_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/hooks","issue_events_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/events","assignees_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/tags","blobs_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/languages","stargazers_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/stargazers","contributors_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/contributors","subscribers_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/subscribers","subscription_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/subscription","commits_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/merges","archive_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/downloads","issues_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/jona-sassenhagen/mne-python/releases{/id}","created_at":"2014-11-08T16:37:16Z","updated_at":"2015-03-21T16:54:38Z","pushed_at":"2015-07-21T11:01:05Z","git_url":"git://github.com/jona-sassenhagen/mne-python.git","ssh_url":"git@github.com:jona-sassenhagen/mne-python.git","clone_url":"https://github.com/jona-sassenhagen/mne-python.git","svn_url":"https://github.com/jona-sassenhagen/mne-python","homepage":"http://martinos.org/mne/","size":81324,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mne-tools:master","ref":"master","sha":"e08fc83b268f6a501998f26a7d641d18745bec73","user":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"repo":{"id":1301584,"name":"mne-python","full_name":"mne-tools/mne-python","owner":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mne-tools/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":false,"url":"https://api.github.com/repos/mne-tools/mne-python","forks_url":"https://api.github.com/repos/mne-tools/mne-python/forks","keys_url":"https://api.github.com/repos/mne-tools/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mne-tools/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mne-tools/mne-python/teams","hooks_url":"https://api.github.com/repos/mne-tools/mne-python/hooks","issue_events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/mne-tools/mne-python/events","assignees_url":"https://api.github.com/repos/mne-tools/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/mne-tools/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/mne-tools/mne-python/tags","blobs_url":"https://api.github.com/repos/mne-tools/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mne-tools/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mne-tools/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mne-tools/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mne-tools/mne-python/languages","stargazers_url":"https://api.github.com/repos/mne-tools/mne-python/stargazers","contributors_url":"https://api.github.com/repos/mne-tools/mne-python/contributors","subscribers_url":"https://api.github.com/repos/mne-tools/mne-python/subscribers","subscription_url":"https://api.github.com/repos/mne-tools/mne-python/subscription","commits_url":"https://api.github.com/repos/mne-tools/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mne-tools/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mne-tools/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/mne-tools/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mne-tools/mne-python/merges","archive_url":"https://api.github.com/repos/mne-tools/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mne-tools/mne-python/downloads","issues_url":"https://api.github.com/repos/mne-tools/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/mne-tools/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mne-tools/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mne-tools/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mne-tools/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/mne-tools/mne-python/releases{/id}","created_at":"2011-01-28T03:31:13Z","updated_at":"2015-07-10T19:14:50Z","pushed_at":"2015-07-21T11:54:08Z","git_url":"git://github.com/mne-tools/mne-python.git","ssh_url":"git@github.com:mne-tools/mne-python.git","clone_url":"https://github.com/mne-tools/mne-python.git","svn_url":"https://github.com/mne-tools/mne-python","homepage":"http://martinos.org/mne/","size":181297,"stargazers_count":138,"watchers_count":138,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":133,"mirror_url":null,"open_issues_count":187,"forks":133,"open_issues":187,"watchers":138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/2304"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/2304"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/2304/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304/comments"},"review_comment":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2304/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/33ee7b30b75c8dab493a013dc0f5518266dda95c"}}}}