<<

TOWARDS CLINICALLY VIABLE NEURAL PROSTHESES THROUGH INNOVATIONS IN NEUROSCIENCE, DECODERS, AND INTERFACES

A DISSERTATION SUBMITTED TO THE DEPARTMENT OF ELECTRICAL ENGINEERING AND THE COMMITTEE ON GRADUATE STUDIES OF STANFORD UNIVERSITY IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY

Nir Even-Chen December 2018

© 2018 by Nir Even Chen. All Rights Reserved. Re-distributed by Stanford University under license with the author.

This work is licensed under a Creative Commons Attribution- Noncommercial 3.0 United States License. http://creativecommons.org/licenses/by-nc/3.0/us/

This dissertation is online at: http://purl.stanford.edu/dh898gt9036

ii I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy.

Krishna Shenoy, Primary Adviser

I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy.

Andrea Goldsmith

I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy.

Allison Okamura

Approved for the Stanford University Committee on Graduate Studies. Patricia . Gumport, Vice Provost for Graduate Education

This signature page was generated electronically upon submission of this dissertation in electronic format. An original signed hard copy of the signature page is on file in University Archives.

iii Preface

Millions of people in the United States live with paralysis due to spinal cord injury or neurological diseases [7]. The motor impairment limits the patients’ independence and in some cases the ability to communicate. Brain-computer interfaces (BCIs) translate signals from the brain into useful control signals, manipulating end-effectors such as computer cursors or robotic arms. BCIs can help restore lost motor capabilities and improve the quality of life for people with paralysis. Intracortical BCIs (iBCIs) have shown promising results in clinical trials, making them the prime candidate as an assistive device for people with severe paralysis, such as tetraplegia [179]. However, for most applications iBCIs need further improvements to be suitable for clinical use. In this dissertation, I aimed to advance the main three components of the iBCI system: the neural interface, the user estimation decoding algorithm, and the user interface. I advanced the three components using multidisciplinary tools from neuroscience, statistics, and engineering. I believe that the studies which comprise this dissertation are a step forward towards the goal of clinical viability of iBCIs.

iv Acknowledgments

There are many people who assisted, supported, and guided me during my PhD and helped this dissertation become a reality. I am extremely grateful to my advisor, Prof. Krishna Shenoy for his support, mentorship, and most importantly, friendship. His commitment to his students is unparalleled in the time, thoughts, and energy he devotes to them. Krishna created the best research family one could ask for and made my last four years a professional and a personal journey limited only by my imagination. I am incredibly fortunate to be part of his research family. Many thanks to my lab mates for the friendship and insightful discussion. I especially want to thank Dr. Sergey Stavisky who mentored me when I joined the lab and was always happy to assist along the way. Thanks should also go to Saurabh Vays, Dr. Jonathan Kao, Dr. Dante Muratore, and Blue Sheffer, with whom I had a great pleasure to brainstorm ideas and collaborate on various projects. I am also very thankful to Dr. Chand Chandrasekaran for their wise advice and friendship. A special thanks is owed to Mackenzie Risch, Michelle Wechsler, and Robyn Reeder for their support and help with Jenkins, Reggie, and Larry, and most importantly for their humor, smiles, and friendship. Many thanks also to Prof. Jaimie Henderson for his close collaboration and for serving on my thesis committee. I would also like to thank my reading committee: Professors Andrea Goldsmith and Allison Okamura, as well as, Prof. Paul Nuyujukian for chairing my thesis defense and for contributing in stimulating ideas. Finally, I would like to thank my family for their unlimited support and belief in me. I thank my Granny, for her care and for being a source of inspiration. Special thanks to my parents, Danny and Devora Even-Chen for encouraging and strengthening at any challenge I took. I am deeply indebted to my wife, Lior Noyovitch, for her sacrifices so I could pursue my dreams. She has been an amazing supporter and an advocate for me. She celebrated my successes and cheered me at difficult times.

Contents

Preface iv

Acknowledgments v

1 Introduction 1

2 Neurally driven iBCI error detection in non-human primates 6 2.1 Summary ...... 6 2.2 Introduction ...... 7 2.3 Methods ...... 9 2.3.1 Behavioral tasks ...... 9 2.3.2 Neural recording and signal processing ...... 9 2.3.3 BMI cursor control ...... 10 2.3.4 Offline analysis ...... 11 2.3.5 PSTHs ...... 11 2.3.6 Percentage of significant electrodes ...... 11 2.3.7 Dimensionality reduction via principal component analysis (PCA) ...... 12 2.3.8 Classification via support vector machine ...... 13 2.3.9 Online error detector ...... 13 2.3.10 Control for kinematic differences ...... 14 2.3.11 Control for external cue differences ...... 14 2.3.12 Directional error detection ...... 15 2.4 Results ...... 15 2.4.1 Behavioral task ...... 15 2.4.2 Task outcome-related neural differences ...... 15 2.4.3 Outcome decoding on a single-trial basis ...... 17 2.4.4 Design for real-time error detection ...... 17 2.4.5 Closed-loop, real-time error detect-and-act ...... 20 2.4.6 Controls for indirect task-outcome correlates ...... 23

vi 2.4.7 Dissecting the putative outcome error signal ...... 24 2.4.8 Directional error detection ...... 25 2.5 Discussion ...... 26 2.5.1 Error detect-and-act improves BMI performance ...... 26 2.5.2 A putative outcome error signal in the premotor and primary motor cortices 28 2.6 Conclusion ...... 29 2.7 Supplementary ...... 30 2.7.1 Supplementary Information ...... 30 2.7.2 Supplementary figures ...... 33

3 Feasibility neurally driven iBCI error detection in humans 41 3.1 Summary ...... 41 3.2 Introduction ...... 42 3.3 Methods ...... 43 3.3.1 Participants ...... 43 3.3.2 BCI ...... 44 3.3.3 Tasks ...... 45 3.3.4 Offline data preprocessing ...... 46 3.3.5 Dimensionality reduction ...... 46 3.3.6 Error detection ...... 48 3.3.7 Statistical testing ...... 48 3.4 Results ...... 49 3.4.1 Task Outcome Related Neural Modulation ...... 49 3.4.2 Single-trial outcome decoding ...... 49 3.4.3 Generalization between tasks ...... 52 3.4.4 Closed-loop detect-and-undo design and simulations ...... 54 3.5 Discussion ...... 56 3.5.1 Putative outcome error signal in the human motor cortex ...... 56 3.5.2 Error detection: detect-and-undo ...... 59 3.5.3 Online detect-and-undo design ...... 60 3.6 Conclusion ...... 62 3.7 Supplementary figures ...... 63

4 Intracortical neural interface design opportunities for power saving 66 4.1 Summary ...... 66 4.2 Introduction ...... 67 4.3 Neural signal requirements for iBCI decoders ...... 68 4.3.1 Binary threshold-crossing signals sampled at low rates ...... 68

vii 4.3.2 Tolerance to high recording and transmission error rates ...... 70 4.4 Custom neural interfaces for iBCIs ...... 71 4.4.1 Neural interface circuit design parameters ...... 73 4.4.2 Custom circuit parameters for a movement iBCI ...... 73 4.5 Neural interface power consumption ...... 76 4.5.1 Analog front-end ...... 76 4.5.2 Analog-to-digital converter ...... 76 4.5.3 Wireless transmitter ...... 77 4.5.4 Low total power consumption for an iBCI ...... 78 4.6 Outlook ...... 78 4.6.1 Circuit-level opportunities ...... 79 4.6.2 System-level opportunities ...... 80 4.6.3 Implications beyond movement iBCIs ...... 81 4.7 Conclusion ...... 82 4.8 Supplementary ...... 82 4.8.1 Methods ...... 82 4.8.2 Supplementary figures ...... 87

5 Structure and variability of delay activity in premotor cortex 91 5.1 Summary ...... 91 5.2 Introduction ...... 92 5.3 Materials and methods ...... 93 5.3.1 Experimental design ...... 93 5.3.2 Dimensionality reduction ...... 95 5.4 Results ...... 95 5.4.1 Structure of neural activity during delay period ...... 95 5.4.2 Neural state variability during delay ...... 98 5.4.3 Accuracy of endpoint prediction from delay activity ...... 100 5.5 Discussion ...... 102 5.5.1 Does delay activity represent kinematic variables? ...... 102 5.5.2 Independence of direction and distance ...... 103 5.5.3 Organization of initial conditions ...... 105 5.5.4 How does the neural space scale with task complexity? ...... 105 5.5.5 Delay activity and motor preparation ...... 105 5.5.6 Applications to brain-machine interfaces ...... 106 5.6 Conclusion ...... 106

viii 6 Efficient virtual keyboards for high-dimensional BCIs 107 6.1 Summary ...... 107 6.2 Introduction ...... 107 6.3 Methods ...... 108 6.3.1 Information throughput - Bitrate ...... 108 6.3.2 Face-Centered Cubic ...... 109 6.4 Results ...... 110 6.4.1 Keyboard design for 3D cursor control ...... 110 6.4.2 Keyboard design for 4D cursor control ...... 111 6.5 Discussion ...... 111 6.5.1 Online validation ...... 113 6.5.2 Additional variations ...... 116

7 Conclusions 118

A Publications 122 A.1 Journal publications ...... 122 A.2 Refereed conference publications ...... 123 A.3 Patents ...... 123

Bibliography 124

ix List of Tables

3.1 Trials statistics ...... 45

4.1 Neural interface specifications comparison...... 76

List of Figures

1.1 Schematic of an iBCI system and chapters contained in this dissertation...... 2

2.1 Error detection experiment layout and task timeline...... 16 2.2 Decoding trial outcome-dependent neural differences...... 18 2.3 BMI error detector design and online improvement demonstration...... 22 2.4 Error direction information can be decoded from motor cortical activity...... 26 2.5 Trial averaged firing rates of spike sorted single units...... 33 2.6 Distribution of latency of PMd and M1 electrodes...... 34 2.7 Sensitivity and specificity of offline trial outcome decoding...... 35 2.8 Neural push speed profile...... 36 2.9 Control experiments examining the influence of hand and BMI kinematics on trial outcome decoding...... 37 2.10 Control experiments examining experimental cues’ influence on trial outcome decoding. 38 2.11 Low-dimensional representation of the putative outcome error signal...... 39 2.12 Direction invariance of putative outcome error signal...... 40 2.13 Monkey directional error signal...... 40

3.1 Experiment layout and conceptual example of error detect-and-undo...... 44 3.2 Task outcome modulates neural activity in the motor cortex...... 50 3.3 Single-trial task outcome decoding using motor cortical neural activity...... 53 3.4 Task outcome error signals generalize from the Grid Task to the Typing Task. . . . . 54 3.5 Estimated success rate and bitrate as a function of added delay and task difficulty. . 57 3.6 Task outcome modulates neural activity in the motor cortex...... 63 3.7 Optimal number of PCs for maximum classification accuracy...... 64 3.8 Task outcome classification accuracy using cursor kinematics rather than the full neural activity...... 64 3.9 Task outcome classification based on different LFP-derived neural features...... 65

4.1 iBCI schematic signal flow...... 69

xi 4.2 iBCI robustness to spike error rate (SER)...... 72 4.3 Study of iBCI performance as a function of the neural interface parameters...... 75 4.4 Power consumption as a function of input-referred noise for a neural amplifier. . . . 77 4.5 Neural interfaces power consumption comparison...... 79 4.6 Illustration of experiment setup and task...... 83 4.7 Neural interface parameter simulation signal processing pipeline...... 86 4.8 SAR ADC model and conversion energy as a function of signal-to-noise ratio (SNR). 88 4.9 Electrode mean firing rate distributions...... 88 4.10 Study of iBCI performance as a function of the neural interface parameters...... 89 4.11 Optimal threshold RMS-multiplier distribution ...... 90

5.1 Task timeline and target layouts...... 94 5.2 Structure of delay activity and relation to behavior...... 96 5.3 Variance of neural state in spatial dimensions...... 99 5.4 Quantifying endpoint information content in motor preparatory activity...... 102

6.1 Face-centered cubic (FCC) structure...... 110 6.2 2D and 3D keyboards comparison...... 112 6.3 FCC keys’ average distance...... 113 6.4 ’4D keyboards’ comparison...... 114

xii Chapter 1

Introduction

Brain-computer interfaces (BCIs), also referred to as brain-machine interfaces (BMIs) or neural pros- thetics, provide a direct communication path between the brain and an external device. One of the applications is to help restore lost motor capabilities to people with motor impairments (.., due to neurological disease, or spinal cord injury). The BCI estimates the user’s intention from brain activity and uses this intention to guide the person’s own limb [21, 4] or an assistive device, such as a prosthetic arm [99, 43, 57] or a computer cursor [100, 179, 110] (Fig. 1.1). Different neural sen- sors (e.g., Electroencephalogram (EEG), Electrocorticography (ECoG), and intracortical electrode arrays) can be used for measuring neural signals for BCIs for investigational clinical applications. Recent intracortical electrode-array based BCI (iBCI) studies, which recorded neural activity from the motor cortex, have shown promising results in pilot clinical trials by enabling a high-performing level of computer cursor control, making them prime candidates for assistive technology for people with paralysis [4, 17, 43, 91, 179]. An iBCI system is composed of three main subsystems: a recording system (e.g., electrodes and transmission system), a decoding algorithm that translates the neural activity to a control signal, and a prosthesis (e.g., a computer cursor or a robotic arm) (Fig. 1.1). There is considerable industrial and academic interest in advancing all aspects of iBCI to increase its performance, to extend its capabilities, and to improve its clinical viability. Current neural recording systems approved for clinical use are wired and have a few hundred recording electrodes. Wireless transcutaneous neural interfaces with a high number of sensing electrodes will increase the clinical viability by reducing infection risk and will improve user’s intention estimation by extracting more information from the brain. State-of-the-art decoding algorithms for iBCIs enable high-performance 2D (e.g., on a two- dimensional computer screen) computer cursor control. Advancing user’s intention estimation can be improved by utilizing neuroscience insights and implementation of advance engineering techniques - two approaches that synergistically work together. First, by investigating how the brain controls movement and revealing new informative neural signals, one can develop models and algorithms

1 CHAPTER 1. INTRODUCTION 2

Figure 1.1: Schematic of an iBCI system and chapters contained in this dissertation. The iBCI system (motor neuroprosthetic) is composed of three main subsystems: a neural interface, a neural decoder, and a prosthesis. The neural interface measures the electrical neural activity in the vicinity of an electrode (e.g., in a multi-electrode array). The neural signal is recorded and transmitted to a decoder which estimates the user’s intention (e.g., robotic arm velocity) and sends control signals to the prosthetic controller. CHAPTER 1. INTRODUCTION 3

that will utilize new information (e.g., [225, 118]). Second, algorithm development can help in estimating user intention more accurately and robustly [179, 231, 230, 92, 208, 117]. Last, most prosthetic devices used in iBCI clinical trials today were not optimized to be controlled by an iBCI. Developing new prostheses (e.g., robotic arms) or designing novel user interfaces customized for iBCIs can enhance the user experience, improve learning, and increase performance [169, 51]. To investigate these three domains, we worked with both pre-clinical model animals (rhesus macaques) and clinical trial participants (as part of BrainGate2) performing a variety of reaching tasks with their native arm, or with the iBCI system. During experimental sessions, we recorded neural activity from multielectrode arrays implanted in motor cortical regions of the brain. It is necessary to advance the development in all three domains to improve iBCI clinical application and viability. By focusing on decoding algorithm development and investigating how the brain controls movement, we aim to advance all three domains.

Dissertation overview

This dissertation presents five projects, each aims to improve one of the three subsystems. Much of the work presented in these chapters has been published in peer-reviewed journals, or is in the process of peer review. Thus the contents here contain (my) previously published work.

Chapter 2 - Neurally driven iBCI error detection in non-human primates

This chapter presents the development and testing of real-time error detection and undoing (or prevention) for iBCI. The purpose of the neural decoder is to translate the user’s intention to control signal of a prosthesis. Thus, the majority of algorithm development focuses on improving user kinematic intention estimation. Here, we explore a new complementary approach to improve performance - detecting task-outcome error through neural signals. However, the existence of such signals in the motor cortex, an area traditionally used for iBCI recording, was not certain. Thus, in this project, we had two questions, a basic-neuroscience question, and an engineering question: (1) Is the neural activity in motor cortex modulated by errors?, and (2) if modulation exists, how can we use it to improve iBCI performance? We tested those question in non-human primates (NHPs), as a preclinical iBCI model. Although this brain area is considered to be more related to movement planning and execution, we were surprised to find a neural modulation of tasks errors. In addition, we designed and implemented a real-time neurally driven error detector that could prevent or undo mistakes and improve performance by 20%. This work has been published as [68] and submitted as a patent [66]. CHAPTER 1. INTRODUCTION 4

Chapter 3 - Feasibility of error detection in people

In this chapter, we investigated the translation of our previous finding to human clinical-trial par- ticipants. The fact that we found an error related modulation in the motor cortex in non-human primates (NHPs) does not guarantee the existence of such a signal in the human motor cortex. Here, we investigated the feasibility of translating the previous work using an offline neural recording of two human participants in the BrainGate2 clinical trial. We found motor cortex modulation that enabled us to detect 70-85% of the error trials with minimal miss-classification (0-3%) of successful trials. We further developed a model to predict the implication of implementing an error detection system in people and found that with a difficult task (with 60% success rate) the error detector can improve performance more than two fold. This work has been published as [69].

Chapter 4 - Intracortical neural interface design opportunities for power savings

In this chapter, we characterized the engineering specifications of a neural interface designed for BCI application. Two major requirements for improving iBCIs performance and extending its clinical viability are increasing the number of recording electrodes, and implementing wireless transcutaneous implants. The two requirements compete for the same resources – area and power – which are limited when considering a device implanted beneath the skull. Existing laboratory-oriented chronic systems for NHPs that record from hundreds of electrodes are power and area hungry and cannot scale up and translate readily for use with people. Those systems were designed for basic neuroscience research to record and transmit wide-bandwidth signals with high resolution to enable the extraction of a variety of signals, and thus requiring a relatively large device area and high power consumption. Here, we investigated the current neural interface specification and proposed a more relaxed specifications that could reduce power consumption by an order magnitude without compromising BCI performance. This work is under review as [64].

Chapter 5 - Structure and variability of delay activity in premotor cortex

In this chapter, we investigated neural activity properties in order to guide future BCI user interfaces (e.g., keyboards). ’Discrete’ BCIs enable the user to select a target among a set of targets by planning to go to a target without the need to continuously control the cursor movement to the target. The ’Discrete’ BCIs can be used to select a key in a menu presented on a screen or for typing. For many years, it was assumed that the direction of the upcoming movement is more represented in premotor cortex (PMd) compared to the distance of the movement. Therefore, tasks and keyboard layout for discrete iBCIs were mainly designed in a circular form. We revisited that assumption and investigated the upcoming movement features representation in the motor cortex. To do so, we recorded neural activity while a monkey performed tasks with high-density target layouts. Using the rich data set, we were able to reveal a clear low-dimension representation for the main movement CHAPTER 1. INTRODUCTION 5

features (reach endpoint coordinates and maximum speed). This allowed us to better understand the features representation relationship and found that their ability to be decoded is comparable to iBCI use. Understanding the decoding accuracy of the features will guide future design of efficient target layouts for discrete BMIs which could increase typing rate. This work is under revision as [65].

Chapter 6 - A high-dimensional virtual keyboard for BCIs

In this study, we designed a 3D and a 4D virtual keyboard to improve iBCI typing rates. When designing a communication device for typing (e.g., computer keyboards, smart phone touchscreens, etc.), it is necessary to design a user interface that will fit the device and enable efficient and fast typing (e.g., minimal average selection time). Current iBCI keyboards are virtual keyboards that are presented in a 2D computer screen similar to virtual keyboards designed for standard computer cursor typing. However, those keyboards do not take advantage of the entire high-dimensional control capabilities of iBCIs. Recent work in our lab showed the ability to control a computer cursor with three and four degrees of freedom in a virtual reality (i.e., 3D visualization). In addition to moving the cursor in a two-dimensional plane (2D, e.g., XY plane), the user was able to control the cursor also in depth (-direction) and rotate it (around the z-axis). Here, we designed novel 3D and 4D keyboards that utilize the high dimensional control and reduce the average key distance by two fold. Chapter 2

Neurally driven iBCI error detection in non-human primates

2.1 Summary

In this chapter, we explore and implement a new approach to improve iBCI performance - we lever- aged a user’s own perception of error to detect and undo those errors. Making mistakes is inevitable, but identifying them allows us to correct or adapt our behavior to improve future performance. Cur- rent brain-machine interfaces (BMIs) make errors that need to be explicitly corrected by the user, thereby consuming time and thus hindering performance. We hypothesized that neural correlates of the user perceiving the mistake could be used by the BMI to automatically correct errors. How- ever, it was unknown whether intracortical outcome error signals were present in the premotor and primary motor cortices, brain regions successfully used for intracortical BMIs. We report here for the first time a putative outcome error signal in spiking activity within these cortices when rhesus macaques performed an intracortical BMI computer cursor task. We decoded BMI trial outcomes shortly after and even before a trial ended with 96% and 84% accuracy, respectively. This led us to develop and implement in real-time a first-of-its-kind intracortical BMI error ’detect-and-act’ sys- tem that attempts to automatically ’undo’ or ’prevent’ mistakes. The detect-and-act system works independently and in parallel to a kinematic BMI decoder. In a challenging task that resulted in substantial errors, this approach improved the performance of a BMI employing two variants of the ubiquitous Kalman velocity filter, including a state-of-the-art decoder (ReFIT-KF). Detecting errors in real-time from the same brain regions that are commonly used to control BMIs should improve the clinical viability of BMIs aimed at restoring motor function to people with paralysis.

6 CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 7

2.2 Introduction

The nervous system makes widespread use of feedback to correct errors shortly after they occur and to adapt in order to minimize future errors [102, 127, 241, 157]. During the control of movement, error signals are used to correct perturbations and update the brain’s internal model [249, 205, 203, 124]. The same principle is also of clear utility to engineered systems and underlies control systems [8, 244]. In this work, we tested whether an engineered system that directly interfaces with the neural system – a brain-machine interface – can exploit the fact that it shares common error detection goals with the biological system that it is connected to. A variety of neural error signals, which provide feedback on our actions and the environment, have been investigated in the last few decades [153, 102, 128, 125, 130, 70, 154, 85, 151, 73, 19, 234] and potentially can be used to improve BMI performance [30, 153, 67, 151, 73], or even able-bodied performance [255]. Here, we focused on the task-outcome error signal, which arises when the goal of the movement was not achieved [153, 151, 130, 128, 19]. It was previously unknown whether this signal is present in primary motor (M1) and dorsal premotor (PMd) cortices typically targeted for intracortical BMIs. Therefore, in this chapter, we asked two primary questions: (1) does an outcome error signal exist in the PMd and M1 cortices?, and (2) can decoding this signal benefit BMI performance? Current intracortical BMIs decode only neural correlates of movement intention from the cortex, either in pre-clinical animal model experiments [233, 204, 25, 163, 194, 159, 238, 80, 61, 88, 115, 116, 172] or clinical trial evaluations in people with paralysis [100, 99, 44, 2, 247, 91, 110, 21, 179]. The performance of BMI systems has markedly improved in the last two decades; however, they have not reached natural arm reaching performance, and errors, such as selecting the wrong key during typing, still occur. At the heart of the limitations in BMI movement intention decoding is a tradeoff between speed and accuracy: increasing the complexity or precision required by the task leads to slower performance and/or more mistakes. Since errors usually require the BMI user to make a timely corrective action, such as selecting a delete key on a keyboard, BMI applications are designed to strike a balance between higher task efficiency (e.g., keyboard density) and minimizing error rate [173]. However, we envision BMI users using standard interfaces that will accelerate their independence, e.g., using a cursor to control a tablet [173]. Thus, in real-world use, optimal interfaces (and optimal target sizes) will not always be present, and errors occur more often than when working with an optimally-designed lab system. To date, most efforts at increasing the performance of intracortical BMIs have focused on improving movement intention decoding [233, 204, 25, 163, 194, 159, 238, 80, 61, 88, 115, 116, 172, 179]. Here we provide a proof-of-principle of a complementary approach: a parallel error detector that executes corrective interventions, thereby preventing or undoing mistakes. We note that the error detection approach is largely independent of the implemented kinematic decoder; thus, our work aims to present a widely-applicable proof-of-concept rather than improve specific state-of-the-art decoders. This approach potentially enables the BMI system to be used for harder and more accurate tasks (e.g., denser grid, smaller key sizes or higher-dimensional prosthetic CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 8

control) even with the same quality of movement intention decoding. This approach can also be used to rescue BMI performance when sensors degrade, in a fundamentally different and complementary way to existing approaches of rescuing kinematics decoding [75, 225, 217, 231]. While there has been substantial work in developing adaptive BMI decoders that update their kinematic decoding parameters in response to externally specified errors [233, 98, 250, 214, 110, 178] or inferred errors from the statistics of the system’s output [223, 137], intracortical BMI designs have not explored the utility of a biological task outcome error signal. A BMI user is typically provided constant visual feedback of the BMI-controlled effector (e.g., computer cursor) and the BMI behavioral goal (such as the target on the screen), and is therefore aware of their BMI perfor- mance. It is therefore reasonable to postulate that neural correlates of BMI-based behavioral errors exist somewhere in the brain and might be utilized by BMIs as feedback to correct errors. Indeed, error-related potentials have been employed successfully in EEG-based BMIs with discrete decoding for trial-based typing [199, 221, 30], trial-based movements [73], and prosthetic device manipulation [109, 29]. Encouragingly, outcome errors during a hand control task, recorded through electrocor- ticographic (ECoG) from the motor cortex, were decoded during a post-hoc analysis [153]. However, a similar approach has not been implemented in real-time continuous control BMIs recording neural activity from motor areas (premotor and motor cortex), nor from intracortical recordings of spiking activity. It is important to determine if and how error decoding can increase the performance of such intracortical BMIs, which are to date the highest-performing BMI systems [44, 91, 21, 179]. If such task-outcome error signals exist in PMd and M1, then BMIs could incorporate error de- tection without the need for implanting sensors in additional brain areas. Importantly, the existence of error signals in other brain areas and their influence on motor behavior do not guarantee that they can be identified in motor cortical areas, let alone decoded accurately for BMI purposes. Much of the research on error signals relies on EEG and fMRI measurement techniques; these studies have not reported clear evidence of error signals, and especially outcome error signal, in motor cortex. Encouraging evidence comes from a recent ECoG study, which found that responses that appear to come from motor cortex are modulated by execution error and task-outcome error [153, 151]. Additional motivating evidence comes from an intracerebral study which found that supplementary motor area (SMA) is modulated by a response task outcome [19] making it a prime candidate for electrode targeting in the future. Other intracortical recording studies found evidence for execution error modulation in M1 and premotor cortex [106, 227]. Nonetheless, it is not yet clear whether outcome error signals are present in M1 and PMd, which motivates an intracortical investigation. Intracortical recording can also enable a more extended analysis of the related neural modulation, such as accurate latency measurement, high spatial resolution, and single unit and population-level analyses. Accurate mapping of error signals across the brain will shed light on the brain’s motor control mechanisms. Evaluating whether task-outcome error signals can be detected in the M1 and PMd is therefore of scientific value in addition to its translational utility for BMI. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 9

In this study, we used intracortical recordings from two monkeys to search for the existence of an outcome error in neuronal spike activity in PMd and M1. Specifically, we assessed the ability to detect wrong selections during a BMI ‘typing task’. We report three key findings: first, we found, for the first time, that putative task-outcome error signals are present in PMd and M1. Second, we present methods to design a BMI error decoder and predict its effect on performance. Third, we demonstrate for the first time a performance improvement of a closed-loop intracortical BMI augmented with a real-time error decoder.

2.3 Methods

2.3.1 Behavioral tasks

All procedures and experiments were approved by the Stanford University Institutional Animal Care and Use Committee. Two male rhesus macaques (monkeys J and L) were trained to perform point- to-point movements of a 6 mm radius virtual cursor in a 2D plane using either hand movements or BMI control. They were free to move their arm even during BMI control [167, 173, 88]. A keyboard-like task was modeled after the task described in [173, 67]. The goal of the task and the experiment timeline is depicted in the Behavioral Task section of the Results and figure 2.1. The workspace was 4032 cm and had in its center a 2424 cm grid uniformly divided into nn (=6 to 8, depending on the dataset) contiguous, non-overlapping square target acquisition regions (whose height and width was 24/n cm). Each square target acquisition area contained, at its center, a circular visual representation of a target (8 mm radius, yellow discs in figure 2.1a). For BMI data collected for offline error decoding analysis (figure 2.2), we calibrated the task difficulty each day by changing grid size and required target hold time to keep the monkey’s success rate at approximately 80% (actual experimental session success rates ranged from 76% to 82%). This difficulty was chosen to balance having a sufficient number of failed trials with which to study neural activity following a failure versus frustrating the monkey or having failure be the expectation rather than the exception. For online comparison of the ReFIT-KF decoder, we used the optimal hold time of 450 ms as found in [173] with a 6x6 and 7x7 grids. The task had a 5 second time limit; only 3% (J) and 9% (L) of the trials were exceeding the time limit; these were omitted from the offline analyses.

2.3.2 Neural recording and signal processing

Monkeys were implanted with two (monkey J) or one (monkey L) 96-electrode Utah arrays (Black- rock Microsystems, Inc.), using standard neurosurgical techniques [71] 63-90 (J) and 83-91 (L) months prior to this study. J’s arrays were implanted into the left cortical hemisphere; one array went into the primary motor cortex (M1) and the other into the dorsal premotor cortex (PMd), as estimated visually from local anatomical landmarks (figure 2.1b). L’s array was implanted into CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 10

the right hemisphere boundary between motor cortex and premotor cortex, as estimated visually from local anatomical landmarks (figure 2.1b). Since L had only one array, anterior electrodes were labeled as ‘PMd’ and posterior electrode labeled as ‘M1’ in our analysis (gray areas in figure 2.1b). Voltage signals from each of the electrodes were bandpass filtered from 250 to 7500 Hz. A spike was then detected whenever the voltage crossed below a threshold set at the beginning of each day (at -4.5 rms voltage). Contralateral hand position (for decoder training and hand kinematics analyses) was measured with an infrared reflective bead tracking system (Polaris, Northern Digital) polling at 60 Hz. Most of the analyses presented accepted all voltage threshold crossing spike events on a given elec- trode, which may include more than one individual neuron’s activities. These ’threshold crossings’ have become the standard for BMI applications [88, 71, 44, 110, 179]. However, for supplemen- tary analyses we sorted spikes to identify single unit activity using Blackrock Offline Spike Sorter (BOSS, Blackrock Microsystems, Inc.). This sorting was done manually, assisted by BOSS’ -means algorithm.

2.3.3 BMI cursor control

At the start of each experiment, we collected a training dataset of approximately 500 arm-controlled trials of a planar Random Target Task according to the protocol described by Fan and colleagues [71]. These data were used to train a Feedback Intention-Trained Kalman filter (FIT-KF) decoder

[71], which operates on the observed firing rate vector at time ,yt ∈ (N=192 electrodes for J and 96 for L). For the ReFIT-KF decoder variant, we retrained the decoder from closed-loop BMI control data according to the protocol described in Gilja and colleagues [88]. Both FIT-KF and ReFIT-KF output a velocity command every 25 ms from input consisting of binned spike counts from the preceding 25 ms, and have comparable performance [71]. Briefly, FIT-KF is a streamlined version of the ReFIT-KF decoder [88] because it omits closed-loop recalibration, and it improves upon a standard KF by adjusting kinematics of the training data to better match the subject’s presumed movement intention. Note that for several of the days of the FIT-KF experiment days, we deliberately increased the difficulty of the task by not zeroing out training set velocities during the hold epoch (this calibration step is described by Fan and colleagues [71]. The velocity Kalman filter (VKF) converges quickly to a steady state:

vt = M1vt−1 + M2yt (2.1)

where vt ∈ R is the velocity of the cursor at time t [141]. We call the first term (M1vt-1) the momentum (a state dynamics matrix that smooths the velocity) and the second term (M2vt) the

‘neural push’ (a mapping from neural activity to velocity). The linear mapping M2 defines a decoder- potent space: neural activity in this subspace will affect the kinematics. However, neural activity CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 11

outside this subspace, i.e. in the decoder-null space, will have no direct effect on kinematics [227]. The steady state equation can also be written as:

t−τ vt = M1 · M2yt (2.2) which shows that the current velocity is a causal smoothing of the neural push. M2 defines two complementary and orthogonal neural subspaces: one where neural activity affects cursor movement (decoder-potent space) and another where the neural activity does not affect cursor movement (decoder-null space). These subspaces are similar to the task-relevant and task-irrelevant spaces in the study by Flint and colleagues [76], and are closely related to output-potent and output-null subspaces in the study by Kaufman and colleagues [121].

2.3.4 Offline analysis

For all offline analyses, multiunit threshold crossing spike counts recorded on each of the N electrodes N N×K were binned every 25 ms (vt ∈ R ) and each trial (Yi ∈ R , where K is the number of time bins in the trial) was aligned to target selection time (t=0, figure 2.1A). We did not use formal effect size calculations to make data sample size decisions, but from the central limit theorem and the high trial number (see Results) we were able to assume normal distributions. All fully completed experimental blocks were included in the analysis, unless stated otherwise. For statistical significance, we assumed unequal variances (Behrens-Fisher problem) and used a two-sided two-sampled t-test with a confidence level of p=0.05 with Bonferroni correction (to account for the family-wise error rate), unless stated otherwise.

2.3.5 PSTHs

Peristimulus time histograms presented in figure 2.2a, and Supplementary figure 2.5 were computed using data from example days: J: 2015-04-22 (3508 trials, 76% success rate) and L: 2015-08-04 (1611 trials, 80% success rate). From the central limit theorem and the high trial number we were able to assume normal distribution of the PSTHs and use a two-sided two-sample t-test as a statistical test to compare the two conditions. We assumed unequal variances (Behrens-Fisher problem) and used a Bonferroni correction (for the number of channels and time bins) to account for the family-wise error rate. When testing whether population firing rates during failed trials are higher than during successful trials (figure 2.2b), we used a one-sided two-sample t-test.

2.3.6 Percentage of significant electrodes

We evaluated the extent to which task outcome differences were observed across the entire recorded population by computing the percentage of electrodes that showed significant firing rate differences CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 12

between successful and failed trials. As was the case for comparing PSTHs, we used a two-sided two- sample t-test as a statistical test to compare the two conditions, and performed Bonferroni correction to account for both the number of electrodes and the number of samples. This test was used to determine if an electrode’s activity during a certain time window is significantly different between the two conditions. To smooth the results, an electrode was considered as significant for the population analysis if it crossed the confidence level on two consecutive time samples. Lastly, we averaged across days the percentage of significant channels at every time bin (θbk, where k is the bin number). To estimate this measurement’s standard error which we abbreviate as s.e.( θbk), and conduct statistical tests, we used a bootstrap procedure with B=500 repetitions. In the bootstrap, we drew trials with repetitions and repeated the procedure to find the percentage of significant channels for the sampled ∗b ∗b trials (θbk , where b is the repetition number). From the set of bootstrap repetitions of θbk , we estimated the measurement’s s.e.( θbk), conducted statistical tests, and computed response latencies. When comparing PMd and M1 (e.g., figure 2.1B), we used the same technique while restricting the analysis to only the PMd or M1 electrodes.

2.3.7 Dimensionality reduction via principal component analysis (PCA)

In many of the analyses we were interested in isolating the neural signal component specific to the difference between failed and successful trials, i.e., the putative task outcome error signal. The firing rate time series during any two conditions (e.g., success and failure) can be represented with their average Ycm=(Ysuc+Yfail)/2 and difference Ycm=Ysuc-Yfail i.e., common and differential modes. Here, the common mode contains activity presumably related to performing the task but unrelated to the specific outcome. To focus on the difference between outcomes and filter out common processes, we performed principal component analysis (PCA) on the differential mode; i.e., the difference in the neural activity between the outcome-averaged successful and failed trials at bin k:

1 i 1 i N ∆yk = yk − yk, ∆yk ∈ R (2.3) Nf

This ‘outcome-targeting’ PCA is filtering out these ‘irrelevant’ (for our purposes) signals and re- ducing the data’s dimensionality (and thus the number of classifier parameters) increased decoding accuracy (see next section). Based on similar reasoning, we used an analogous technique (‘direction-targeting’ PCA) to find the subspace that captures neural variance likely to relate to a directional error signal (figure 2.4). Specifically, we conducted PCA on the trial-averaged differences between success trials and fail trials grouped by which of the four targets directly adjacent to the cued target was selected. PCA was run on a data matrix in which these four subtracted conditions’ data series were concatenated in time (4K x N). CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 13

2.3.8 Classification via support vector machine

For all binary classifications in this study, we used a linear support vector machine (SVM) to predict whether each trial was a success or failure. The data were composed of labeled (success or fail) L×K trials (indexed by i), each with an associated data matrix Zi ∈ R , where L is the number of electrodes or principal components or kinematic components (depending on the specific analysis), and K is the number of time bins in the chosen time window. Given a set of training trials, the SVM fitting algorithm builds a model that can then be used to assign new examples into one of these two categories. In pilot studies, we found that the decoding performance was maximized when using five leading principal components (PCs). We note that different target selection-aligned time windows (figure 2.2d and figure 2.3) had different numbers of time bins, and so we needed to build a separate classifier for each window. Since the online error detector had knowledge of when a target selection occurred (but not whether the correct target was selected, of course), this approach is fully compatible with online BMI use. For offline classification, we used a 10-fold cross-validation to estimate the classification accuracy and its standard error. To compute naive classifier performance (as a control), we repeated the 10-fold cross validation after the labels of the trials (success or fail) were randomly shuffled across the trials. Moreover, to assess whether the classifier was biased towards one category (e.g., decoding ‘successful trial’ all the time), we computed the detection rate of successful and failed trials separately (i.e., true positive and true negative). When the input features to the classifier were PC activations rather than high-dimensional electrode firing rates, we were careful to not have the test dataset affect identification of the PC subspace: we first conducted PCA on each training set of the cross- validation to find a PC basis set, and then used this basis for subsequently classifying test data. When comparing two methods of classification statistically, we used a two-sided two-sampled t-test on the 10-fold classification accuracy of each classifier.

2.3.9 Online error detector

When comparing BMI error detection online using the FIT-KF decoder, we modified the monkeys’ typing task in two ways to make it more analogous to human typing [172, 67]. First, to simulate how users must press the ‘delete’ key after an incorrect selection and then correctly select the missed key, we cued a predefined delete key after every incorrect selection. Once this delete key was selected, we then re-cued the target that was initially missed. Second, we removed the unusually long post-selection feedback delays that we had previously added as a scientific control. Specifically, we shortened the time between selection and the next trial initiation to 20 ms for error prevention experiments and to 420 ms for error deletion experiments. When comparing BMI error detection online using the ReFIT decoder, the ‘delete’ key’ was not in use. Rather, the next target came up regardless of whether the previous selection was correct, but erroneous selections still penalized bit-rate and could be avoided by the error detect-and-prevent system. To compute the standard CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 14

error and conduct statistical tests on measured bitrates, we used a Bootstrap procedure of swapping success and fail trial labels as explained earlier in Section 2.3.6 (Methods: Percentage of significant electrodes). The online error detector used the same two phase signal processing that was used for the offline classification: first, dimensionality reduction (projection of electrodes’ firing rates to a smaller num- ber of PCs’ subspace), and then classification using SVM. In pilot studies, we found that decoding performance converged after a large quantity of approximately 2000 training trials, and that these decoders worked well across days. Therefore, to improve performance and maximize the amount of time available for performance testing during a given experiment session, we pre-trained the error detector on multiday datasets from previous days. We could take this approach because we expected recordings to be quite stable from day to day [171, 33]. ReFIT experiments were performed only with monkey J since monkey L died before those experi- ments could be performed. We note that the average ReFIT decoder bit-rate of monkey J performing the 6x6 grid typing task presented in this study is lower than his performance on a comparable task previously reported in [116]. This is due to neural signal degradation and monkey behavior changes occurring in the two years between the experiments.

2.3.10 Control for kinematic differences

To regress out neural correlates of kinematics, we first found the least squares linear regression be- tween cursor velocity and the neural activity (yk=Axk+b). Next, we computed the neural activity res residual without the contribution to kinematics (yk =yk-Axk-b). We compared the classification res accuracy of the task outcome based on the neural activity (yk) and the residual (yk ) in Supple- mentary figure 2.9 to assess the effect of kinematics on the classification performance. The data used for these analyses were the six (J: 12,648 trials) and four (L: 5,528 trials) days reported in the

Behavioral task section of the Results. When detecting errors using either neural activity (yk) or its res residual (yk ), we used dimensionality reduction as explained in the Dimensionality reduction via principal component analysis (PCA) Methods (section 2.3.7). We performed two-sided two-sample t-tests on the a 10-fold cross validated results.

2.3.11 Control for external cue differences

For the external cue controls, we conducted a guaranteed liquid reward experiment (8,400 trials over three experiment sessions), a no cued target color change experiment (3,104 trials over two days), and a no auditory feedback experiment (3,912 trials over two days), all with monkey J. We measured offline error detection accuracy as explained in the Classification via support vector machine section under these different task modifications. The details of these modifications are described in Supplementary Text 1. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 15

2.3.12 Directional error detection

To estimate the classification accuracy when decoding error direction (figure 2.4), we used 10-fold cross-validation nearest neighbor classifier (assigning a predicted point the identity of the K=1 nearest neighbor point) operating on the 5-dimensional neural data obtained by projecting firing rates onto the five leading direction-targeting PCs (see Results and Dimensionality reduction via PCs section). We tested the classifier on data from the six (J: 12,648 trials) and four (L: 5,528 trials) days reported in the Behavioral task results section. We computed two-sample two-sided t-test statistics between the 10-fold cross-validated results using true or shuffled data.

2.4 Results

2.4.1 Behavioral task

Two rhesus macaques (J and L) were trained to control a BMI cursor using intracortical spikes recorded from multi-electrode arrays in M1 and PMd (figure 2.1b). Neural signals were processed in real-time with a mathematical decoding algorithm based on a modified Feedback Intention Trained Kalman Filter [71, 231, 225] (FIT-KF, which has comparable performance to ReFIT, a state-of-the- art decoder [71], see Method). The decoder output a two-dimensional BMI cursor velocity control signal. Our experiment was designed to resemble a ‘typing task’: the monkeys had to acquire a specific target cued in green amongst a keyboard-like grid of selectable yellow targets using the BMI-controlled cursor [67, 173, 172] (figure 2.1a). We delayed reward and auditory feedback for 600 ms following target selection (figure 2.1a-iv) to temporally separate neural activity reflecting the monkey’s (presumed) recognition of the task’s outcome from neural activity related to explicitly receiving the liquid reward on successful trials. Since our initial goal was to compare neural responses during successful and failed trials, we calibrated the task difficulty daily to make it hard enough that there was a sufficient number of failed trials (76%-82% success rate) for statistical power.

2.4.2 Task outcome-related neural differences

To investigate whether motor cortical activity reflects task outcome, we first compared the trial- averaged activity from successful and failed trials; selected electrodes’ PSTHs are presented in figure 2.2a, aligned to target selection time. In both monkeys, we found that there were periods before and after target selection when neural activity was significantly different depending on trial out- come in both threshold crossing spikes activity (figure 2.2a) and spike-sorted single unit activity (Supplementary figure 2.5). In all subsequent analyses we used ‘threshold crossings’ containing both single- and multi-unit activity to improve statistical power. We found that the neural activity, on average across all electrodes, tends to have higher firing rates during failed trials when compared to successful trials (figure 2.2b gray bars, t-test with Bonferroni correction, p<0.05). CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 16

Figure 2.1: Experiment layout and task timeline. (a) A monkey performs a BMI grid task by con- trolling the cursor using a kinematic decoder (black pathway). We built an error detector (red path) that was integrated into the BMI to perform closed-loop error prevention before (‘Error prevention’, green timeline dot) or auto-deletion during (‘Error auto-deletion’, purple timeline dot) the waiting period. (i) His goal was to move the cursor (white disk) to the cued green target amongst the poten- tial yellow targets. The target selection areas were non-overlapping and collectively spanned a 2424 cm2 workspace. Therefore, the cursor was always in the acquisition window of a possible target when it was in the grid workspace. The monkey can nominally identify task errors through continuous visual feedback. (ii) When the correct target (green) was being held, the target’s color changed to blue. It reverted to green if the cursor left the target before selection. Holding the cursor over any target (start time indicated by the orange timeline dot) for 300 - 400 ms selected that target. (iii) After selection (green timeline dot), the cued target disappeared (iv) and the monkey waited 600 ms for an auditory feedback tone that matched the outcome and, in successful trials, a liquid reward. A new trial started after an additional 400 ms. (b) Microelectrode array location(s) in motor cortex, as estimated visually during surgery from local anatomical landmarks (A = anterior, P = posterior, L = lateral, = medial). CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 17

To evaluate the extent to which this task outcome difference was observed across the entire recorded population, we computed the percentage of units that showed significant firing rate differ- ences between successful and failed trials as a function of time (figure 2.2c; bootstrap test, p<0.05 with Bonferroni correction). We found that the activity of 181% (monkey J) and 251% (monkey L) of units was modulated by task outcome around target selection time. A substantial fraction of the ensemble was modulated even earlier: we found that at least 10% of units’ activity differed based on upcoming task outcome 155 10 ms (J) and 161 13 ms (L) (mean s.e.) after the target hold period started. Units in PMd tended to reflect task outcome earlier than those in M1 (Supplementary figure 2.6). Specifically, the threshold of least 10% of the population was modulated by task outcome 117 10 ms (J) and 80 20 ms (L) earlier in PMd than in M1 (t-test, p<0.01). From these results, we can infer that the activities of many neurons in M1 and PMd are correlated with task outcome. In subsequent sections we will describe various controls showing that this putative outcome error signal is not merely a result of indirect outcome correlates such as kinematics and reward. First, however, we answer whether this putative outcome error signal can be beneficially incorporated into an intracortical BMI.

2.4.3 Outcome decoding on a single-trial basis

To evaluate the potential for online error detection, we first analyzed trial-outcome decoding accuracy as a function of time relative to selection time. We decoded trial outcome based solely on neural activity in growing time windows using principal components analysis (PCA) for dimensionality reduction and a linear support vector machine (SVM) for classification (Methods Section 2.3.8). Trial outcome decoding accuracy increased as the trial progressed and converged to 970.5% (J) and 941% (L) around 400 ms after target selection (figure 2.2D). In addition, we found that decoding accuracy at selection time was already substantially above chance: 831% (J) and 852% (L). To verify that our decoder is not biased towards one outcome (e.g., always guessing success), we separately computed the accuracy of detecting successful trials (TP, true positive rate) and failed trials (TN, true negative rate) as a function of time (Supplementary figure 2.7), and found the decoder performed well in both cases. These high decoding accuracy results encouraged us to implement a real-time error detector; however, the offline decoding time course raises important decoder design questions that are critical to address.

2.4.4 Design for real-time error detection

Two main design properties are central to the error detector: 1) decoder latency, i.e., when the classification occurs relatively to the BMI action (e.g., before selection or some time later?), and 2) the corrective intervention performed upon error detection (e.g., does the system prevent an action before it occurs or undoes it afterward?). The choice of corrective intervention depends on the application and when accurate classification can be made. If the error can only be detected once CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 18

Figure 2.2: Decoding trial outcome-dependent neural differences. Green dot corresponds to t=0 target selection time, as in figure 2.1. Orange dot shows target hold start. (a) Trial-averaged firing rates (means.e.) of example electrodes during failed (red) and successful (blue) trials. Gray bars indicate times with significance differences (t-test with Bonferroni correction, p<0.05, Method Section 2.3.4). (b) Population trial-averaged firing rates. () Percentage of electrodes that show significant differences as a function of time (means.e.). () Offline single-trial outcome decoding accuracy as a function of the end of a growing decoded time window, which starts at 300 ms before selection and ended between 200 ms before until 600 ms after target selection. The dataset in panels c and d combine six (J: 12,648 trials) and four (L: 5,528 trials) days of closed-loop BMI experiments. already made, then the BMI system could only intervene with a corrective ’undo’ action to minimize the error’s consequences. However, if the error can be detected before the presumed erroneous action is made, then the BMI system can attempt to prevent the error. While it would in principle be better to prevent an erroneous action, or, failing that, to undo it as early as possible, figure 2.2d reveals that there is a clear tradeoff between the error detector’s latency and its classification accuracy. On the one hand, increasing the detector latency increases its accuracy. But on the other hand, this prolongs the trial, which decreases overall utility. An error detect-and-act system can be incorporated in parallel to BMI kinematic decoders in many applications. Here, to provide a numerical treatment of this tradeoff, we applied it to the BMI communication application (using a virtual keyboard for ‘typing’) as a proof of concept to investigate the potential benefit of error detection. In a typing task, users typically correct mistakes by selecting the ‘delete’ key. This manual corrective action is highly time-consuming since the user needs to perform two additional selections for each mistake (first delete the wrong character, and then select the correct key). Thus, a helpful corrective intervention is to automatically ’detect-and-undo’ the previous target selection by deleting the previous character when an error signal is detected. To estimate the effect error auto-deletion would have on a BMI, we considered the bit-rate metric [173, 171, 117, 179, 115], which quantifies BMI communication performance. Bit-rate is defined as CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 19

the rate of correct key selections (weighted by how many bits of information each selection conveys) minus a penalty for incorrect key selections based on the conservative assumption that each incorrect selection must be compensated for with a correct selection (e.g., selecting ‘delete’). The expression for this bit-rate is as follows: s − bps = log (N − 1) (2.4) 2 T where T is the total length of the trials, N is the number of potential targets, and s and f are the numbers of success and fail trials, respectively. When error auto-deletion is incorporated into a BMI, the overall system’s bit-rate will depend on the effective success (s’=sTP) and fail (f’=f(1-TN)) trial count as well as the task delay imposed by having the error detector decide after target selection (dt). The bit-rate can therefore be estimated as:

s0 − f 0 bps = log (N − 1) (2.5) 2 T + dt · (s + f)

This conservative estimate assumes that every trial will be delayed (dt) by the detector latency (by a few hundred millisecond). However, in a real world applications this penalty might be sub- stantially reduced when considering user strategy (e.g., if the user trusts the error auto-delete, they could continue towards the next key without waiting for the intervention) or if the detector latency overlaps with a cognitive load-imposed natural delay between movements (e.g., thinking about what the next letter should be). We do not suggest that continuous BMI decoders inherently require a post-selection delay to operate, but rather that the user may introduce such a delay when using the BMI for a cognitive task, such as typing. We estimated the bit-rate as a function of when the error detection was attempted. For the key parameter of the error detector’s success rate as a function of time, we used the empirically observed accuracies from monkey J’s offline error detection data. In figure 2.3a, the estimated bit- rate (calculated using equation 2) increases until selection time because the classification accuracy increases without any added task delay. We considered two possible scenarios for what would happen if the error detection occurs after selection time: (1) a worst-case scenario in which the detector latency delays the next movement (dark purple lower lines), and (2) a best case scenario (light purple upper lines) in which error detection does not cause any added delay (e.g., if the user is pausing to prepare the next cursor movement anyway). The resulting detect-and-undo performance should therefore be somewhere between these two extrema lines, depending on the user and the task. Our analysis suggests that the performance change due to adding error detection, compared to standard BMI (Eq. 2.4, gray lines), can range from a more than two-fold communication rate improvement under low task success rate conditions (e.g., 65%), to decreasing performance when success rates are already high (e.g., 95%). Encouragingly, we also found that in a challenging enough task (with relatively low success rate), error auto-deletion can improve performance over a non-augmented decoder that does not have a delay, even when considering the worst-case scenario CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 20

when a delay is needed for the auto-deleting system. This makes sense intuitively: automatically undoing most errors at a slight cost of time on every trial will be worth it if errors are frequent, but less so (or not at all) if errors are rare. Since we observed high error detection accuracy even before target selection, we propose an additional mode for a detect-and-act system: ’detect-and-prevent’ action when an error is predicted right before when the selection would normally occur. In a dwell-typing application, a key is selected by holding the cursor over it (e.g., for 500 ms). We therefore propose to prolong the required hold time (e.g., waiting an additional d=50 ms) when an error is predicted. This intervention will give the user the opportunity to move the cursor out of the presumably incorrect target if it was indeed incorrect, or to keep the cursor over the target if it was in fact their intended key (i.e., after a false positive error detection). One of the benefits of this approach is that the cost of false positive detection will be small compared to erroneous detect-and-undo: rather than forcing the BMI user to re-acquire the target key, the trial length will only be slightly extended. Similar to before, we estimated the effect of error detect-and-prevent on overall performance by:

s − f 0 bps = (N − 1) (2.6) T + dt · (s − s0) Since there is no benefit from predicting the outcome earlier than the selection time, we only considered detection immediately preceding selection time (figure 2.3a).

2.4.5 Closed-loop, real-time error detect-and-act

Our goal is to demonstrate a proof-of-concept of a complementary approach that can presumably improve any decoder (be it the ReFIT-KF, FIT-KF, OLE, etc.) when BMI control becomes more challenging and errors occur. In real-world use, errors may result from a range of causes such as user mistakes (e.g., typos), a suboptimal interface that increases task difficulty (e.g., selectable keys that are very close together), a sub-optimal decoder, or a challenging task that is at the limits of the BMI’s performance (e.g., threading a needle). Thus, to test our hypothesis that a BMI can benefit from error detection in the face of errors, we chose to elicit errors by using a sub-optimal decoder (FIT-KF). To demonstrate the utility of this system in a closed-loop BMI system, we implemented and tested these two proposed corrective interventions online as a proof-of-concept of a BMI with error detect- and-act capabilities. Across 10 (J) and 9 (L) experiment sessions (days), we used a real-time error detector in parallel to a kinematic decoder (FIT-KF, figure 2.1ai), and tested both the error auto- deletion (with dt=400 ms decoder latency) and error prevention (with d=50 ms delay) operation modes in a typing task where the difficulty was adjusted to yield an uncorrected success rate of around 80%. The error decoder used PCA-based feature reduction (keeping five leading principal components, Method Section 2.3.8) and a linear SVM classifier (Methods Section 2.3.8). Both error CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 21

prevention and error auto-deletion modes were compared separately to a standard kinematic decoder without error detection in an A-B-A block format, where A was a standard kinematic decoder (FIT- KF) and B was the same kinematic decoder with a detect-and-act system. We found that both error detect-and-prevent and detect-and-undo modes improved the monkeys’ bit-rates each day (bootstrap-test, p<0.001). Error prevention increased the average bit-rate by 24% (J) and 23% (L). When evaluating error auto-deletion, we delayed the next trial by 400 ms for both the standard and error detection-augmented BMI, which mimics the aforementioned scenario where there is a cognitive need for the BMI user to briefly pause before starting to move the cursor towards the next key (figure 3c). Error auto-deletion increased the average bit-rate by 20% (J) and 32% (L) (see Supplementary Movie 1). Additionally, we also estimated what the bit-rates would have been if the system were being used in a scenario without a pause between trials. To do so, we re-calculated the bit-rates after removing the added delay (400 ms) from the trial length (figure 2.3c, top purple and gray semi-transparent bars). This offline re-analysis corresponds to the best-case scenarios both for the standard BMI system (the user doesn’t need to briefly pause between selections) and for the error detect-and-undo system (the user starts towards the next key without waiting to see whether the error detect-and-undo system executes or not). Detect-and-undo performance should be between the two scenarios (in the range of the transparent bars) depending on the task and the user strategy. We found that some overlap between the two performance ranges (with and without a delay) exist, in particular for monkey J. An overlap means that error auto-deletion is beneficial in some scenarios and not in other. Thus, the benefit of this detect-and-undo system depends on the task and the user strategy. Based on the figure 2.3a bit-rate estimates and the figure 2.3c closed-loop results, we conclude that for these monkeys performing this particular task, error-prevention outperformed error auto- deletion. Thus, we also tested error prevention when using ReFIT-KF, a state-of-the-art decoder [88, 173, 179]. We evaluated the system in two task difficulties (6x6 and 7x7 grids, figure 2.3d). The detect-and-prevent system improved the standard ReFIT-KF performance during each day and for each task by 8% and 18% on the 6x6 and 7x7 grid tasks, respectively (figure 2.3d, bootstrap-test, p<0.001). This performance improvement was due to a reduction in the number of selection errors. As expected, the improvement was greater when performing the harder task (7x7, which is closer to the actual number of keys on a standard English keyboard) with a BMI augmented with detect-and- prevent capability. These online results corroborate our estimated predictions that error detection can provide even greater performance improvement during even more challenging tasks (e.g., when high accuracy is required). Our results show that error detection can improve BMI performance when the targets are optimally placed for bit-rate (6x6 [173]), but the technique becomes even more impactful during a more challenging task (7x7) when high accuracy is required. More demanding task requirements are germane to real-world applications (e.g., when more than 36 keys are needed, or when the key size is smaller than 4 cm, or when browsing a website with dense and non-optimally CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 22

Figure 2.3: BMI error detector design and online improvement demonstration. (a) Estimated bit- rate when augmenting the BMI with an error detector as a function of when detection happened and task difficulty (success rate) using Eq. 2.4-2.6. The parameters for bit-rate estimation were based on the empirical monkey J data (T=1.3s, N=64) (Supplementary figure 2.7 and figure 2.2). The three line types (dashed, solid and dotted) correspond to different base success rates with a standard BMI (gray, i.e. without parallel error decoding). Lower dark and upper light purple lines are worst- and best-case scenarios, respectively, based on whether the next movement is delayed or not as a result of the error classifier latency. (b) Time windows used for online error prevention and error auto-deletion, relative to (a) timeline. (c) Bit-rate comparisons (median, 1st and 3rd quartile, and extreme values of a bootstrap with 500 repetitions) between a standard BMI (FIT-KF, gray) and a BMI augmented with online error detection. Two modes of operation were evaluated online: error auto-deletion (purple) and error prevention (green). The top of the semi-transparent auto-deletion bars show post-hoc re-calculated bit-rate after removing the added delay (400 ms) following each selection. The vertical span of this bar represents a range of scenarios between the best and the worst case of whether the user naturally pauses between key selections (see main text for more details). Auto-deletion helps substantially in the best-case scenario, but does not out-perform a standard BMI in the worse-case scenario. Black dots are the bit-rate estimates (Eq. 2.5 and 2.6) of detect-and-act performance, based solely on the empirical data of the corresponding standard BMI (gray bars); note that these predictions fall within the measured closed-loop augmented performance ranges. The error auto-deletion dataset combines five (J: 9611 trials) and five (L: 6676 trials) days of closed-loop BMI experiments. The online error prevention dataset combines five (J: 7555 trials) and four (L: 6002 trials) days of closed-loop BMI experiments. (d) Bit-rate and error-rate comparison when using a state-of-the-art decoder (ReFIT) with and without error prevention. This dataset aggregates monkey J performing a closed-loop BMI experiment using three days each of two grid sizes (6x6: 4926 trials, and 7x7: 2480 trails). CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 23

placed clickable hyperlinks).

2.4.6 Controls for indirect task-outcome correlates

Neural activity in the motor cortex is related to many processes including, but not limited to, kinematics, kinetics, sensory feedback, trial outcome (as reported here), and noise. We therefore wondered whether the neural activity differences we observed between successful and failed trials resulted from other variables that indirectly correlate with trial outcome but are not directly related to the monkey’s internal recognition/prediction of the trial’s outcome. Specifically, we tested whether kinematic differences (in both BMI cursor movement and residual arm movements), reward, and other experimental elements (auditory and color feedback) were major contributors to our outcome decoding. We briefly describe the results here, and report more details and further discussion in Section 2.7.1: Supplementary Information. We conducted two controls related to kinematics. First, we found that regressing out the BMI’s velocity-related component from the neural activity did not affect outcome classification accuracy. Second, we found that outcome detection using BMI cursor and hand kinematics were significantly worse (<80% accuracy, Supplementary figure 2.9) than decoding using neural activity. Thus, al- though small kinematic differences did exist between successful and failed trials, this information alone does not account for our ability to decode trial outcomes accurately. This is consistent with our finding that less than 1% of the outcome error signal variance could be explained by movement- related neural activity. However, we note that this control should be interpreted while considering its limitations: although the causal mapping between neural activity and kinematics in a BMI frame- work is completely known, there might be additional kinematic-intention neural activity that is not linearly mapped to kinematics. Thus, these controls do not completely rule out whether differences in movement intentions could affect task-outcome decoding. In two additional control experiments, we 1) provided rewards on all trials and 2) withheld au- ditory feedback (Supplementary figure 2.10). These experiments showed that reward and auditory feedback did not affect error detection performance (t-test, p>0.3), and suggest that the signal being decoded does not contain reward expectation components. This contrasts with recent work [186] that found a reward signal in the motor cortex but did not find outcome-related neural modulation. However, in that work, the monkeys performed reaches guided by uncertain visual cues, without see- ing the target itself. Thus, the monkeys could not know the outcome until the reward was provided. As such, the [186] task design precludes dissociating the neural activity resulting from external cues (i.e., a reward signal) versus the monkey’s internal understanding of whether he performed the trail correctly (i.e., an outcome signal). Section 2.7.1: Supplementary Information further discusses these differences. In our task, the color change from green to blue when the correct target was being held was the only external cue about the trial’s upcoming outcome. A further control experiment CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 24

in which this cue was removed (Supplementary figure 2.10) showed it had a minor effect (5% detec- tion accuracy difference, t-test p<0.01). This is consistent with the monkey being more uncertain of the trial outcome without the color information. Nevertheless, we observed that outcome error classification accuracy was still high (92%) when target color remained unchanged, indicating that most of the signal we decoded was not due to color change. Together, these controls are consistent with the hypothesis that the neural modulation we have described and decoded primarily reflects a putative task outcome error signal that cannot be at- tributed to differing kinematics, reward expectation or experimental cues.

2.4.7 Dissecting the putative outcome error signal

Thus far we have presented evidence that neural activity differs between successful and failed trials. However, it is difficult to understand the latent population-level patterns underlying these differ- ences from examining single unit PSTHs. Dimensionality reduction techniques are often used to summarize properties of high-dimensional data (e.g., neural population activity) for visualization and interpretation [212, 49]. Here, we used principal components analysis (PCA, Methods Section 2.3.7). This enabled us to summarize the population-level activity of the outcome-related neural signal and explore whether this signal differs depending on the relative direction of the correct and (mis)selected target. First, to determine the putative outcome error signal’s dimensionality and to visualize its dy- namics, we examined the outcome-targeting PCs (i.e., PCA on the difference between success and fail trials), which are shown in Supplementary figure 2.11. The three leading outcome-targeting PCs (which we will call the ‘outcome-error subspace’) capture 881% (J) and 821% (L) of the variance of the trial-averaged, outcome-related neural activity difference. Encouragingly, both monkeys’ neural activities showed similar dynamics in this subspace. This suggests that a major contributor to the putative outcome error signal is not related to monkey-specific stereotypical movements or monkey- specific neural response patterns following successful versus failed trials. Rather, these dynamics may instead reflect a general pattern of outcome error-related neural dynamics in these cortical areas. Next, we explored whether the putative outcome error signal reflected the relative direction between the incorrectly selected target and the cued target. We would expect an outcome error signal to be direction-invariant, in contrast to an execution error signal, which should provide directional information about the error. To verify that the proposed signal is largely direction independent, we projected the direction-averaged neural activity into the outcome-error subspace and verified that most (90% (J) and 91% (L)) of the putative outcome error signal variance is common across errors in the different directions (Supplementary figure 2.12). The high degree of direction invariance in the outcome-targeting neural subspace suggests that this proposed outcome signal component mostly reflects neural activity related to outcome error. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 25

2.4.8 Directional error detection

Despite finding that most of the putative outcome error signal was directionally invariant, we inves- tigated whether we could additionally decode a different motor cortical signal that correlates with the direction of the error. The existence of such a directionally tuned post-execution error signal was recently reported [106]. To construct a different neural subspace that tries to capture variance related to the direction between the cued and incorrectly selected target, we performed a different analysis where we calculated the PCs of the neural differences between the average of successful trials and the activities averaged over erroneous trials to each of the four targets adjacent to the cued target (Methods Section 2.3.12). This ‘direction-targeting’ PCA technique is similar to our method described earlier to find the putative outcome error subspace (‘outcome-targeting’ PCA), except here we focus on observing the variance specific to which direction points towards the correct target. We found that there did indeed exist a different set of neural projections such that the re- sulting variance is mostly explained by the differences between direction conditions, rather than by the condition-average signal (figure 2.4a). Note that this result does not disagree with our previous statement (Sup. figure 2.12) that more than 90% of the putative outcome error signal variance is common across directions, since here we projected the data into a different neural subspace that was specifically targeted to identify direction-related variance, rather than outcome-related variance. Here, we focused on the potential of detecting the direction of the error for BMI. However, we believe that the relationship between the two signals (e.g., temporal, spatial, and causal relationship, and identifying a common source that might exist in other brain areas, etc.) should be further investi- gated in future work. Also, we note that in our task, error direction may be highly correlated with the monkey’s movement intention at the end of the trial [194], and thus further work is needed to disassociate these two factors. Despite this scientific caveat, here we were interested in the practical utility of this component of the neural activity (see next section), and for this BMI purpose we are agnostic to whether it reflects the monkey’s perception of error direction versus his intention to make a correction. Finding these activity differences across error directions motivated us to do an offline analysis to evaluate if we could decode relative error direction (i.e. predict the location of the correct target with respect to the incorrectly selected target) on single trials. As a proof-of-concept for future BMIs, we evaluated the error direction classification accuracy by predicting one of four potential directions after incorrect target selection using a nearest-neighbor classifier (Methods Section 2.3.12). We were able to decode where the correct target was substantially better than chance in both monkeys (figure 2.4b; J: 681%, L: 762%; t-test, p<0.0001). This capability presents an opportunity to further improve BMI performance. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 26

Figure 2.4: Information related to error direction is present in and can be decoded from motor cortical activity. (a) Neural responses exhibited distinct patterns depending on which of the four targets adjacent to the cued target (shown in the colored insert) was incorrectly selected. Here we show monkey J’s neural activity (see Supplementary figure 2.13 for monkey L) projected onto two neural dimensions (using ‘direction-targeting’ PCA) and were chosen because their variance is mostly explained by the differences between direction conditions. Pie charts show relative variance contribution of the averaged-across-directions error signal (black) and the separated-by-direction error signal (yellow). (b) Classification accuracy when predicting which of the four targets adjacent to the cued target the monkey erroneously selected using neural data from 300 ms before until 600 ms after selection time. To determine chance classification, we decoded data with randomly shuffled error direction labels.

2.5 Discussion

This work makes both neural engineering and scientific advances. Its neural engineering contribu- tion is to introduce and validate a new strategy for improving high-performance motor BMIs by simultaneously decoding non-motor cognitive signals. Its scientific advance consists of describing an outcome error signal in motor cortical spiking activity. Here we will discuss each in turn.

2.5.1 Error detect-and-act improves BMI performance

The key neural engineering contribution of this work is the design and closed-loop demonstration of a first-of-its-kind method for augmenting an intracortical BMI with error detection. This sys- tem utilized the brain’s error signals – which we show can be accurately detected from the same sensors and cortical area homologues already being used for clinical motor BMIs – to improve the performance of state-of-the-art BMI decoders. This opens a new avenue for improving intracor- tical motor BMIs, which until now have decoded only neural correlates of movement intentions [233, 204, 25, 163, 194, 159, 238, 80, 61, 88, 115, 116, 172, 179], by simultaneously detecting addi- tional cognitive signals related to the task being performed. Error detect-and-act can be used in parallel to any kinematic BMI and is more helpful in more error-prone scenarios, meaning that the utility of this strategy will increase as the complexity of tasks being performed with BMIs increases. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 27

These error detection techniques can be applied to a broad range of BMI tasks to intervene with corrective actions. If the task outcome error signal generalizes across tasks, then no task-specific training data would be required; otherwise, calibration data would need to be collected within the context of the specific task. This question of generalization warrants future study. In a computer cursor control task, error detection can be used to prevent or undo incorrect clicks during typing [91, 110, 116, 172]. During control of a robotic arm [99, 44], task outcome error detection could be used to cancel the last command (e.g., grasping) and instead return to a previous state (e.g., the state of the robotic arm a second ago). Estimating the direction of the error – rather than just its occurrence – in a real-time BMI could be used to even further improve performance. For instance, the BMI system could automatically select the decoder’s estimate of what the intended key was during typing, or move the effector towards the intended object during robotic arms use. When designing a detect-and-act BMI for a particular application, the optimal corrective action and its corresponding decoder latency would depend on four parameters: the user’s success rate (i.e., task difficulty), the average trial length, the cost of making an error (e.g., additional reaches for deletion), and the error detection accuracy as function of the time. The latency can then be adapted online based on the prevalent error rates given the task difficulty and BMI neural control quality. In addition, error signals can also be used to update decoder parameters and adjust the learning rate of an adaptive algorithm, especially when the ground truth is unknown. For example, the outcome error signal can be used to increase the learning rate after errors, while knowledge about the error direction could be utilized to update decoder parameters [233, 98, 250, 214, 178, 110, 207, 31], thus reducing future errors. Existing communication BMI workspaces are designed for minimum errors at the expense of complexity and efficiency [173, 110] (e.g., keyboard density). Error detect-and-act can improve BMI performance by increasing the tolerable task difficulty. For example, increasing the number of available keys on a keyboard will increase the transmitted information rate from each selection; however, this decreases the target size and as a result reduces the success rate. By using a detect- and-act system, one could increase the number of keys while still keeping the success rate high. To find the optimal keyboard density, a mapping of the success rate as a function of layout needs to be found [173]. When using a BMI with an error detect-and-undo capability, hard tasks will become easier in the sense that the effective success rate will become higher. This may also benefit other types of difficult tasks, such as high-dimensional BMI-driven prosthesis [247] or when very high cursor control accuracy is needed, such as when navigating a link-dense website, game, or computer desktop. Another application of error detection is in the context of rescuing performance following signal degradation. Chronic intracortical electrode signals degrade with time, which decreases BMI per- formance and success rates [56, 215, 12, 132]. To date, efforts to rescue performance have focused on designing new kinematic decoders [225, 231, 185, 115, 178, 137, 75, 217]. The error detection CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 28

methods introduced here provide an alternative approach to increase effective success rates, thus rescuing BMI performance and improving the user experience. Implementing a similar error detect-and-act system in a clinical human BMI should be straight- forward as long as this task outcome error signal also appears in the human brain areas implanted with the electrode arrays, such as the motor cortex, an area typically targeted for BMIs. This open question is an important area for future investigation; recent encouraging ECoG results indeed showed evidence for such activity in the motor cortex [153]. We predict that one source of differences that may be encountered during translation stems from human BMI movements being self-initiated by the user, in contrast to experimenter-paced monkey tasks. A benefit of this is that it is more likely that there will be a naturally-occurring delay between selecting a key and the initiation of movement towards the next key. Thus, it may be possible to extend the latency of error detection – which would improve outcome decoding – without increasing the average trial length. Another factor that could result in improved performance is that a human user would be informed of the error detect-and-act system and could change their strategy to better exploit it, perhaps by learning to modulate their neural activity to better emphasize the outcome error signal.

2.5.2 A putative outcome error signal in the premotor and primary motor cortices

The detect-and-act applications demonstrated in these experiments would not have been possi- ble without the discovery of a suitable outcome error signal in relevant cortical areas. Thus, the key scientific contribution of this study is that, to our knowledge, this is the first report of task outcome-related spiking neural activity in M1 and PMd. These results using intracortical recordings significantly expand a recent ECoG study [153, 151] which suggested the presence of error signals in the motor cortex. First, we showed that error signals are present in both PMd and M1, and that they appear earlier in PMd compared to M1. Second, we also investigated the structure of this error signal and its directional independence at the level of the neural population and ruled out kinematic confounds, strengthening the claim that this is indeed an outcome error signal in the motor cortex. Finally, we have shown that this outcome error signal also exists during BMI use. Finding a putative task-outcome error signal in the PMd and M1 is perhaps more surprising than finding an execution error signal for the following reason: execution error, which arises from a discrepancy between the intended and the actual movement [55, 153], and target error, which arises from unpredictable changes in target location [55], are considered ‘lower-level’ in the error signal hierarchy compared to outcome error [128]. These low-level errors signal a mismatch of desired and estimated effector state that should be corrected immediately by motor cortex. In contrast, outcome error is a higher-level feedback about the end result of the movement [153, 151, 130, 128]. It can indicate the need for changing the motor output on subsequent movements or updating the internal model of the effector [128, 205, 227], but has no immediate relevance to ongoing movement CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 29

generation. Hence, one might have a higher expectation of finding execution and target errors in the motor cortex, which itself is concerned with low-level details of muscle movements [63, 235, 229, 112], and finding the more abstract outcome error signal to be restricted to motor areas believed to be associated with higher levels of movement control, such as the supplementary motor area (SMA) [243, 19], anterior cingulate cortex (ACC), basal ganglia [103, 125, 128, 130] and cerebellum [205]. The existence of an outcome error signal in the motor cortex supports the theoretical proposal that motor controllers such as the motor cortex use reinforcement learning signals to identify an appropriate response strategy to achieve their movement goal [102]. It is also consistent with recent reports that motor cortex is critical for motor learning [123]. We were able to decode the outcome error signal even before the end of the trial (figure 2.2d). At first glance, it might appear surprising that a task outcome error signal should be present before the trial is finished. However, we know from previous studies that high-level error signals can be detected even before the end of the trial and even before the response onset [128]. The source of this task outcome error prediction can be a forward model that estimates the probability of future error and plans a proper response. For example, when a person is about to lose his balance, he knows with increasing confidence as time progresses that a fall is unavoidable, and he prepares for the consequences. More specifically, in our case the monkeys were familiar with the task and could presumably recognize that the cursor had remained inside the acquisition area of an incorrect target for close to the selection duration; they therefore could anticipate that an incorrect selection was imminent.

2.6 Conclusion

In summary, the identification of a putative task outcome error signal in M1 and PMd that this work has uncovered raises important questions about how the motor cortex adapts and learns as well as about what role this signal serves throughout the nervous system. It also raises key questions regarding the origin of this signal, which may well be outside of the motor cortex and the result of cooperating cortical and subcortical networks. Finally, we demonstrated that is possible to leverage this putative outcome error signal to increase BMI performance by corrective interventions. As such, this signal may enable an entirely new way to substantially increase the performance and robustness, user experience, and ultimately the clinical viability of BMI systems. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 30

2.7 Supplementary

2.7.1 Supplementary Information

Controls 1: Kinematic differences between successful and failed trials

As mentioned in the main text, neural activity in motor cortex reflects many processes including, but not limited to, kinematics (potentially of both the hand and BMI cursor), kinetics, trial outcome (the main focus of the present report), and noise. We therefore wondered whether the neural activity difference we observed between successful and failed trials resulted from other variables that indirectly correlate with trial outcome. Specifically, we asked if the trial outcome differences and their corresponding high decoding accuracies could be a result of kinematic differences that differ depending on a trial’s outcome. For example, what if the monkey consistently tried to correct his movement at the end of failed trials, but held still at the end of successful ones? More generally, the monkey may have made distinct movements (either with the BMI or his hand) after successful and failed trials. Indeed, we did find small differences between successful and failed trials’ BMI cursor kinematics (Supplementary figure 2.8). These differences are a result of neural activity moving the BMI cursor via the decoder algorithm; we call this two-dimensional kinematic projection of the neural activity the ‘neural push’ because it reflects the neural activity’s immediate influence on decoded velocity (see Methods: BMI Cursor Control). To test whether these neural push differences, or, alternatively, residual hand movement differences, were a major contributor to our outcome decoding, we conducted two offline comparisons (Supplementary figure 2.9). For the BMI kinematics portion of both of these comparisons we took advantage of a unique aspect of the BMI framework: we have full knowledge of how neural activity relates to cursor movement, via the decoder algorithm of our design. Our first analysis controlled for the effect of kinematics on decoding accuracy by regressing out kinematic information (BMI cursor or hand velocity) from the neural activity (from 300 ms until 600 ms after selection time) of each day (Methods: Kinematic differences control analysis). We found that this did not affect decoding performance (Supplementary figure 2.9a; ’Neural’- J: 970.5, L: 940.5, ‘Neural / Kin’ - J: 970.4, L: 940.6; t-test, J: p=0.69, L: p=0.95). Our second analysis evaluated outcome decoding accuracy when directly decoding BMI and hand kinematics, as well as neural- push (which is closely related to but not identical to BMI kinematics). To be comprehensive, we performed these analyses in both Cartesian and Polar coordinates. We compared the performance of these trial outcome decoders to decoding the full neural activity (‘Neural’) and found that decoding trial outcome using kinematics (Supplementary figure 2.9a, classification accuracy < 80%) performed better than chance (t-test, p<1e-6) but substantially worse than decoders based on the full neural activity (’Neural’- J: 970.5, L: 940.5; t-test, p<0.001). Since one might expect larger kinematic differences leading up to target selection, we also verified that the signal before the target selection time (which is used for error prevention) is not primarily CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 31

kinematics-related. To do so, we repeated these two analyses with data limited to before the selection time (Supplementary figure 2.9b). Regressing out kinematics from the neural activity in this case had a small effect on the decoding performance (’Neural’- J: 831, L: 861 ‘Neural w/o Kin’ - J: 851, L: 882; t-test, J: p<0.001). However, the kinematics-only decoders had substantially lower performance than decoders using all the neural activity (classification accuracy < 75%, t-test p < 0.001). We conclude from these analyses that although there exist small kinematic differences between successful and failed trials, this information alone does not account for our ability to decode trial outcome accurately. Thus, there is another component of neural information (the putative task- outcome error signal) that discriminates between the two outcomes and enables an observer of the neural state to accurately detect errors. Defining the outcome-error targeting neural subspace (see Results: Dissecting the putative out- come error signal) enables us to look at the relationship between the putative outcome error signal and cursor movement kinematics in a complementary way. We asked how much of the putative trial outcome error signal variance can be explained by ongoing movement, i.e., how much of its variance is projected into movement-related versus movement-null neural subspaces. As before, the BMI framework enables us to determine the mapping from neural activity to movement (Methods). The movement-related subspace is a linear projection of the neural activity to BMI velocity in the x- and 2×#Electrodes -directions, and is defined by the mapping matrix M2 ∈ R . By projecting the putative outcome-error signal into these subspaces, we found that less than 1% of the putative outcome error signal variance is explained by the 2D movement-related neural activity (2D decoder-potent space, Supplementary figure 2.11a) compared to 85% on average explained by the three leading PCs of the outcome-error subspace. This means that the neural activity related to the putative outcome error signal is not explained by (and is almost orthogonal to) movement-causing neural activity.

Controls 2: Reward expectation and external cue differences between successes and failures

The second concern that we addressed is whether the neural differences between successful and failed trials result from reward expectation or other task elements that are different between successful and failed trials but are not directly related to the monkey’s internal recognition/prediction of the trial’s outcome. These three experimental elements were 1) auditory feedback, which was different after a success versus failure, 2) liquid reward, which was given only after successful trials, and 3) cued target color, which changed to blue immediately preceding selection only in successful trials. To examine the influence of these elements on our ability to decode trial outcome from neural activity, we conducted online control experiments with monkey J, again using an A-B-A block format where A is the typical task and B is a modified task that omits the experimental factor in question. During these reward control experiments we extended the block to 500 trials (around 10 min), compared to 200-300 trials used for the other controls, to accommodate that it might take the animal longer to CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 32

adjust to the new task reward rules. We examined 1) the effect of auditory feedback by turning off all auditory feedback (while keeping the liquid reward), 2) the effect of reward by rewarding the monkey on both successful and failed trials (while keeping the auditory feedback), and 3) the effect of color by always keeping the cued target green, even while the correct target was being held (Supplementary figure 2.10). Auditory and reward feedback did not affect decoding performance (t-test, p>0.3), which suggests that the neural signal components being decoded does not contain reward expectation components. However, the color change had a minor effect (5% decoding accuracy difference, t-test p<0.01). A possible explanation for this performance difference is that the cued target color change is a very salient aspect of the visual feedback to the monkey that he is holding the cursor over the correct target; its absence decreases the monkey’s certainty that he is about to select the correct target. That is, without this color cue, he may think he is not holding the cued target even though he really is. Alternatively, the color, which has a movement-related meaning in this task (i.e., related to holding the cursor still over the target), could have a small effect on motor cortical neural activity. Although M1 and PMd are not believed to modulate in response to purely sensory input such as color and luminance if these factors are not correlated with movement [42, 194], color cues with movement associations have been reported to affect neural activity [253]. Nevertheless, our observation that classification accuracy without target color change was still high (92%) indicates that most of the signal we decoded was unrelated to this color change. Although there are similarities between putative reward signals and error (or success) signals, these are distinct concepts. We believe that we are decoding an outcome error signal rather than a reward signal. For our purposes, the critical difference between reward and error is that the former is externally signaled (for example, by an audio tone and liquid reward), whereas the latter can be internally generated by the monkey monitoring his own task performance. Recent studies suggest the existence of reward signals in motor cortex [143, 186]. Marsh and colleagues [143] did not attempt to disambiguate between error and reward signals. Notably, however, Ramkumar and colleagues did not find task outcome-related M1 and PMd modulation when the outcome was decorrelated from reward by withholding reward on successful trials [186]. In their work, the monkey performed a reach guided by uncertain visual cues without seeing the target itself; thus, he could not know the outcome until the reward was given, which make it difficult to dissociate the reward from the outcome. This task design element might have prevented the detection of an internal outcome signal. In addition, since the reward and the feedback were given simultaneously in that study, it is hard to separate the motor correlates of reward consumption (e.g., drinking the liquid reward) from the neural correlates of the reward itself. In contrast, we designed the experiment to temporally separate neural activity reflecting the monkey predicting and later recognizing successes/failures from neural activity explicitly related to receiving feedback (e.g., drinking a liquid reward, figure 2.1a-iv). We also conducted the aforementioned control experiment to assess the influence of reward CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 33

on the putative outcome error signal by rewarding failed trials. We found no effect in this experiment, which suggests that the putative task-outcome error signal we decoded does not include a reward signal component. Together, these controls are consistent with the hypothesis that the neural activity modulation we have described and decoded primarily reflects a putative task outcome error signal (i.e., the monkey perceiving that he did, or is about to, succeed versus fail) that cannot be explained by differing kinematics, reward expectation or experimental cues alone.

2.7.2 Supplementary figures

Figure 2.5: Trial averaged firing rates of spike sorted single units. Orange and green dots show hold start and target selection time t0 respectively as in figure 2.1. The traces show trial averaged firing rates mean ± s.e. of example electrodes during failed and successful trials. Gray bars indicate times with significance differences t test p < 0.05 bonferroni corrected. 100 example threshold triggered sorted spike waveforms are shown in blue. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 34

Figure 2.6: Distribution of latency until at least 10% of PMd and M1 electrodes showed a significant difference between success and fail trials. Histograms show the latency until at least 10% of elec- trodes’ firing rates significantly differed depending on trial outcome. The PMd population crosses the 10% significance threshold 11710 ms (monkey J) and 8020 ms (monkey L) earlier than the M1 population (bootstrap t-test, p<0.01). CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 35

Figure 2.7: Sensitivity and specificity of offline trial outcome decoding using a growing window. Time points correspond to the end of a growing time window beginning 300 ms before target selection. Sensitivity (detecting successful trials, i.e. the true positive rate) and specificity (detecting failed trials, i.e. the true negative rate) are plotted as a function of time. Before target selection, the decoding accuracy for failed trials is low compared to successful trials. However, over time the gap in decode accuracy decreases; it differs by less than 6% at selection time. One interpretation of this diminishing difference is that it reflects differences in the monkey’s confidence in his prediction of the trial outcome. During the hold period of what will be a successful trial, he is relatively confident that he will be successful. But in failed trials, he still has time to correct his selection, and therefore his confidence in the trial’s outcome is lower. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 36

Figure 2.8: Neural push speed profile (mean s.e.). Although there are differences in the neural activity’s instantaneous contribution to decoded velocity (‘neural push’) between success and fail trails, this is not the main source of the high-dimensional neural activity difference and the classifi- cation accuracy (see main text and Supplementary Figs. 5). Gray bars denote time periods where the difference between Failure and Success neural push was significant (t-test, p<0.05, Bonferroni corrected). These difference magnitudes similar to those in figure 2.2b, but the underlying data rep- resented in both figures have very different dimensionality. While this figure presents a 2-dimensional projection of neural activity (i.e., decoded velocity in X and Y), figure 2.2b presents an average of a much higher dimensional feature space (192 (J) and 96 (R) electrodes). This is why classification accuracy based on neural activity is higher than one based on kinematics, despite the speed and average neural activity plots appearing similar; the full neural activity decoder has access to a much richer view of the data than the kinematics decoder. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 37

Figure 2.9: Control experiments examining the influence of hand and BMI kinematics on trial outcome decoding. Comparison of single-trial outcome decoding accuracy using different types of data: neural activity (orange); neural activity after regressing out kinematics (‘w/o Kinematics’, purple); cursor position, cursor velocity, hand position, hand velocity, and neural-push in either Cartesian (light gray) or Polar (dark gray) coordinate systems. (a) Classification using the entire time window of 300 ms before until 600 ms after target selection time. (b) Classification using the time window of 300 ms before selection until target selection time. Horizontal black lines show chance classification accuracy. The dataset combines six (J: 12,648 trials) and four (L: 5,528 trials) days of closed-loop BMI experiments. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 38

Figure 2.10: Control experiments examining experimental cues’ influence on trial outcome decoding. Single trial task outcome decoding accuracy during additional experiments designed to control for external cues about task outcome: False Juice (juice was given after all trials); Omitted Target Color (cued target color did not change to blue when it was being held); Omitted Sound (we provided no sound feedback after trials). Each condition was compared to interleaved blocks of the regular experiment setup. Removing any of these external cues did not have a substantial effect on decoding accuracy. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 39

Figure 2.11: Low-dimensional representation of the putative outcome error signal. We performed PCA on the difference between task outcome conditions (failure minus success) firing rate averages to extract the neural activity that covaried with the outcome. (a) Percentage of cumulative variance explained as a function of the number of principal components (PCs) (red) and the variance explained when the PCs were projected into the decoder-null space (gray). Note that almost all the variance (99%) between success and failure trials was in the decoder-null space (see Results). (b-inset) Visualization of the neural activity (the difference between average success and fail trial firing rates) projected into the three leading PCs. ’Corkscrew’ dynamics are present in both monkeys. (b) Time course of the projections into the three leading PCs (rotated to align the ’Corkscrew’ dynamics). It is important to note that although there exists this rotational component to the putative outcome error signal, we are not suggesting that the entire outcome-error subspace obeys rotatory dynamical laws. This is because we’ve only observed a ‘corkscrew’ neural trajectory during one context (the difference between success and fail trials), and thus we do not know whether the entire subspace obeys these dynamics. This is in contrast to Churchland and colleagues’ work, which showed that a significant amount of the neural activity obeys rotational dynamics across many conditions [35, 115]. CHAPTER 2. NEURALLY DRIVEN IBCI ERROR DETECTION IN NHPS 40

Figure 2.12: Direction invariance of putative outcome error signal. Time course of the neural activity projected into the three leading outcome-targeting PCs (of the task outcome neural difference) as described in Supplementary figure 7. Trials are now divided by the relative direction between the incorrectly selected target and the cued target’s location (see inset mapping, ‘T’ indicates the cued target). The black trace shows average across all four directions. Consistent with a common and differential mode (Methods), the total variance of the four direction-sorted failure conditions can be divided into two components: 1) variance that is related to the common activity across these four directions (i.e., the average across directions, black line), and 2) variance related to the activity that is different between them (i.e., the difference from the average across condition). Pie charts show relative PC variance contribution of the averaged-across-directions signal (black) and the separated- by-direction signal (yellow).

Figure 2.13: Monkey L’s directional error signal. Same conventions as monkey J’s data shown in Figure 2.4. Chapter 3

Feasibility neurally driven iBCI error detection in humans

3.1 Summary

In this chapter, we continue our line of work from the previous chapter. We test the feasibility of error detection in humans and estimate its impact on performance. Brain-computer interfaces (BCIs) aim to help people with impaired movement ability by directly translating their movement intentions into command signals for assistive technologies. Despite large performance improvements over the last two decades, BCI systems still make errors that need to be corrected manually by the user. This decreases system performance and is also frustrating for the user. The deleterious effects of errors could be mitigated if the system automatically detected when the user perceives that an error was made and automatically intervened with a corrective action, thus sparing users from having to make the correction themselves. Our previous preclinical work with monkeys demonstrated that task-outcome correlates exist in motor cortical spiking activity and can be utilized to improve BCI performance. Here we asked if these signals also exist in the human hand area of motor cortex, and whether they can be decoded with high accuracy. We analyzed post-hoc the intracortical neural activity of two BrainGate2 clinical trial participants who were neurally controlling a computer cursor to perform a grid target selection task and a keyboard-typing task. Our key findings are that 1) there exists a putative outcome error signal reflected in both the action potentials and local field potentials of the human hand area of motor cortex, and 2) target selection outcomes can be classified with high accuracy (70-85%) of errors successfully detected with minimal (0-3%) misclassifications of success trials, based on neural activity alone. These offline results suggest that it will be possible to improve the performance of clinical intracortical BCIs by incorporating a real-time error detect-and-undo system alongside decoding of movement intention.

41 CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 42

3.2 Introduction

Brain-computer interfaces (BCIs) are devices that estimate a user’s movement intention from neural activity from the brain to guide an assistive device such as a prosthetic arm or a computer cursor. They aim to help people with motor impairment (e.g., due to amyotrophic lateral sclerosis, brainstem stroke, or cervical spinal cord injury) in the ability to communicate (e.g., controlling a cursor to type and use a computer) or through restored mobility. BCIs typically record neural activity through different modalities such as electroencephalography (EEG) [248, 105, 222, 16], electrocorticography (ECoG) [135, 197, 158, 23, 242] or intracortical multielectrode arrays, which are typically chronically implanted in the motor cortex [204, 233, 25, 194, 100, 81, 176, 89, 215, 169, 117, 110, 21, 247, 9]. Intracortical BCIs (iBCI) have shown promising results in pilot clinical trials and are the highest- performing BCI systems to date, making them prime candidates for serving as an assistive technology for people with paralysis [17, 43, 91, 179]. Although the performance of iBCI systems has markedly improved in the last two decades, errors – such as selecting the wrong key during typing as a result of decoder or user error – still occur. The errors can be due to either user’s mistake or BCI misinterpretation of user intention. Nevertheless, they reduce the performance. While much work has and continues to be done to mitigate iBCI errors by improving the accuracy and reliability of movement intention decoders [114, 206, 92], here we explore a complimentary and less explored strategy: identifying when an error occurs so that the iBCI system can automatically correct for it. In our recent work with monkeys, we have successfully augmented the iBCI with a neurally driven error detection system [68]. The error detection system detected errors in real- time and intervened automatically with a corrective action to prevent or undo the errors. The new system improved the iBCI performance, especially during challenging tasks, when errors were more frequent. Similar strategies were also employed successfully in EEG-based BCIs with discrete decoding for trial-based typing [31, 220, 200], trial-based movements [74], and prosthetic device manipulation [109, 29]. This ‘error detect-and-undo’ strategy takes advantage of the closed-loop nature of a BCI: the user has constant visual feedback, and s/he is aware of when the BCI performs an unintended action (i.e., an error). The user’s cerebral activity will reflect the detection of errors, though it is unknown if the same cortical areas being recorded for iBCI use in human will contain the salient neural activity reflecting error detection. If these neural correlates can be found and decoded, they could be used by the iBCI to execute an automatic corrective actions in real-time (e.g., automatically delete the last selected key), spare the user from deleting them manually and increase performance. Prior studies have identified outcome error signals in the human brain, at the coarser resolution of EEG (reviewed in [31]), or more specifically in motor cortex using ECoG [152]. For high-performing iBCIs to perform error detection, an outcome error signal would ideally be available from the same multielectrode arrays used to decode movement intentions. Encouragingly, our prior study found that this is indeed the case in monkey motor cortical spiking activity [68]. However, the ultimate CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 43

application of iBCI error detection is for people with paralysis, and thus it is crucial to test whether these signals also exist in human motor cortex, and more specifically in the hand area of the precentral gyrus, which is successfully used for iBCI. In this work, we asked two key questions that must be answered in the affirmative for automated error detection and mitigation to be a viable strategy for clinical iBCI systems: (1) do outcome error signals exist in the human hand area of motor cortex and (2) if so, can they be accurately and quickly decoded on single trials? We report here that both of these are indeed the case. To better predict the utility of exploiting this signal in an iBCI, we propose an error detect-and-undo system design and estimate the performance improvement that could be expected across a range of scenarios. We extended the error decoding methods we previously developed in preclinical monkey exper- iments to the case of human motor cortical data from the BrainGate2 clinical trial. We offline analyzed intracortical recordings from the motor cortex of two participants performing a grid task (a cued target among a grid of selectable targets) and a typing task with a brain-controlled cursor to investigate the potential of error detection in iBCI.

3.3 Methods

Permission for these studies was granted by the US Food and Drug Administration (Investigational Device Exemption) and Institutional Review Boards of Stanford University (protocol #20804), Part- ners Healthcare / Massachusetts General Hospital (2011P001036), Providence VA Medical Center (2011-009), and Brown University (0809992560). The two participants in this study, T5 and T6, were enrolled in a pilot clinical trial of the BrainGate2 Neural Interface System (http://www.clinicaltrials. gov/ct2/show/NCT00912041). Informed consent, including consent to publish, was obtained from the participants prior to their enrollment in the study. Additional permission was obtained to publish participant photos and reproduce text typed by the participants.

3.3.1 Participants

Participant T6 is a right-handed woman, 51 years old at the time of the study whose data was used for [179], who was diagnosed with ALS and had a resultant motor impairment (functional rating scale (ALSFRS-R) measurement of 16). In December 2012, a 96-channel intracortical silicon microelectrode array (1.0 mm electrode length, Blackrock Microsystems, Salt Lake City, UT) was implanted in the hand area of dominant (left) motor cortex (Fig. 3.1). Participant T5 is a right-handed man, 63 years old at the time of the study whose data was used for [179], who was diagnosed with a C2-3 ASIA C spinal cord injury approximately nine years prior to study enrollment. In August 2016, participant T5 had two 96-channel intracortical silicon microelectrode arrays (1.5 mm electrode length, Blackrock Microsystems, Salt Lake City, UT) implanted in the arm-hand area of dominant (left) motor cortex (Fig. 3.1). CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 44

Figure 3.1: Experiment layout and conceptual example of error detect-and-undo. (a) Image shows participant T6 copying a sentence during a typing task block. Schematic overview shows online iBCI control signal path in blue. Neural activity is recorded from the hand area of motor cortex using multi-electrode array(s) and mapped to cursor velocity with a continuous decoder. A parallel discrete decoder detects the intention to select a key (Methods). In an offline analysis (green-colored path), we extracted the spikes signal and the local motor potential (LMP) and fed them into a task outcome classifier that identifies when a key selection was erroneous. The bottom timeline shows an example of T6 typing a sentence using the iBCI (‘i like when you sit with me and read the paper’). Key selection times are shown with vertical ticks (red ticks for errors), with the selected character shown above each tick (’ ’ denotes space, ’←’ denotes backspace). Selections that the outcome-error decoder flagged as erroneous are marked in green squares: here, the classifier was able to detect the two of the three errors in the example sentence (‘u’ and ‘m’, marked with green boxes). Note that since there was no error classifier during the online research session, the participant subsequently had to select the backspace key (’←’) after both of these errors. Experimental layout figure modified from [179]. (b) Participant’s fMRI imaging (processed with FreeSurfer) and arrays location in the hand area of the motor cortex (A = anterior, P = posterior, L = left, R = right).

3.3.2 BCI

For the present study, neural control and task cuing were controlled by custom software running on the Simulink/xPC real-time platform (The Mathwork, Natick, MA), enabling millisecond-timing precision for all computations. Neural data were collected by the NeuroPort System (Blackrock Microsystems, Salt Lake City, UT) and available to the real-time system with 5 ms latency. Two-dimensional continuous control of the cursor was enabled by the ReFIT Kalman Filter detailed in [89, 91]. Users could select a target by dwelling on it for 1 s or by a discrete ’click’ signal. Discrete selection (’click’) was achieved using a Hidden Markov Model (HMM)-based state classifier, which was previously developed with non-human primates [117] and adapted for the current work. CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 45

The users commanded a ’click’ by attempting to squeeze their left hand (i.e., the hand ipsilateral to the array(s)). While for T5 the control algorithms used only spiking (thresholded action potential) activity, for T6 both spikes and high frequency local field potentials (HF-LFP, representing spectral power in the 150-450 Hz frequency band) were used to compensate for a lower recorded spike signal quality. For both the continuous cursor-positioning ReFIT-KF decoder and the discrete click-state HMM decoder, neural data were binned every 15 ms and sent through the decoders. Thus, for the ReFIT- KF decoder, updated cursor velocity estimates were provided every 15 ms for use in the rest of the iBCI system. This velocity was integrated to update the cursor position estimate every 1 ms, and therefore the most recent cursor position was sent to the display every 1 ms. The computer monitor was updated every 8.3 ms (i.e., at the 120 Hz frame rate of the monitor) with the most recent estimate of the desired cursor position.

Parameters # Days # Trials Success Rate # Successes / # Failures T5-grid 3 2579 98% 2516/63 T5-typing 2 536 93% 498/38 T6-grid 5 1057 93% 980/77 T6-typing 5 801 93% 747/54

Table 3.1: Numbers of recorded days and analyzed trials for each task, and the total success rates (across all analyzed trials), for both participants. These same data appear in Pandarinath et al. 2017. T5-grid days are: 2016-10-12, 2016-10-13, and 2016-10-24; T5-typing days are: 2016-10-12 and 2016-10-24. T6-grid and T6-typing days are: 2014-06-30, 2014-07-02, 2014-07-07, 2014-07-18, and 2014-07-21.

3.3.3 Tasks

Typing task. The participants copied sentences by moving a computer cursor via decoded movement intentions to select letters on an on-screen OPTI-II keyboard (Fig. 1, [179]). Details of how the user commanded the cursor’s velocity and made a ’click’ or ’dwell’ selection are explained in the ’BCI’ Methods section. During typing tasks, the participant saw the keyboard and cursor, as well as a field where entered text appeared with the prompted text above it. Grid task. In this task, a grid spanning 1000 x 1000 pixels on the computer monitor was divided into a 6 x 6 or 9 x 9 grid of equally-sized gray squares [179, 100]. Each square was a selectable target, and on each trial, one square would randomly be prompted as the correct target by changing its color to green. The participant had to select the correct target (which resulted in a trial success) while avoiding selecting any of the other (incorrect) targets, which resulted in a trial failure. Correct versus incorrect selection was indicated by different audio tones immediately after the selection. After a selection had been made (correct or incorrect), a new target was immediately prompted. The overall workspace that the user could move the cursor in was 1078 x 1078 pixels, meaning that there was a CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 46

small border around the grid with no selectable targets. This task is quite similar to the grid task performed in recent non-human primate (rhesus monkey) BCI experiments [68].

3.3.4 Offline data preprocessing

The NeuroPort data acquisition system samples each electrode at 30 kHz and applies an analog 0.3 Hz to 7.5 kHz band-pass filter to each electrode. To remove noise common to all electrodes, a common average reference was subtracted from each electrode [179]. While the online original Kalman filter used 15 ms bins, for the present offline analysis we chose to use slightly longer time bins (20 ms) to better smooth neural firing rates and field potential signals. Spikes. To extract neural spiking activity, a 250 Hz high-pass filter was applied to the data recorded by the NeuroPort system. A threshold detector was then applied every millisecond (in a causal 30 samples window) to detect the presence of a putative neural spike and binned in 20 ms non-overlapping bins. Choice of threshold was specific to each participant (T6: -50 V; T5: -95 V). Local field potential (LFP). To extract the LFP signal a 250 Hz low-pass filter was applied to the recorded neural signal and was resampled in 1 KHz. To compute the LFP power for each frequency band, we computed the mean power of the bandpass filtered signal (3rd order Butterworth, see Sup. Fig 3.9b for magnitude frequency response). Local motor potential (LMP). To compute the LMP, we binned the LFP signal in 20 ms bins, which is equivalent to applying a causal boxcar filter with 20 ms width (see Sup. Fig. 3.9b for magnitude frequency response). Cursor Speed. The cursor speed was computed from the recorded online cursor position and binned in 20 ms non-overlapping bins. Data description and average success rates for each task and participant are presented in Table 3.1. In all analyses, different experiment session (days) were pooled and analyzed as one data set. In both participants, erroneous target selections (failed trials) were rare but nonetheless provided enough data to evaluate whether these events could be detected from neural activity alone (see below). For both participants more than 95% of the errors were in the area of the targets that are adjacent to the cued targets. Only 11% (T5) and 13% (T6) of the trials were selected by dwelling on the target; those trials were removed from the offline analysis since their number was too low for statistical analysis. Work should be done to investigate the error signal when the target is selected by dwelling. In all analyses, the different session (days) were pooled and use as one data set.

3.3.5 Dimensionality reduction

The recorded neural activity is composed of many processes that are related to kinematics, kinetics, and perhaps also to task outcome (the latter being the key question we investigated). Some of these processes are similar during both successful and failed trials, and thus even if they explain a large fraction of the overall neural variance, these are not dimensions of the data that we are CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 47

interested in for the purpose of decoding trial outcome. Rather, here we wanted to perform targeted dimensionality reduction to reduce the number of neural features at each time bin from the full- dimensional space of spike counts and LFP power on each electrode down to a smaller number of features that still capture much of the variance in the neural signal component that is different between failed and successful trials (i.e., the putative error signal). While all of the putative task outcome information is in principle available in the full-dimensional neural data, dimensionality reduction is a widely used technique [49] to both de-noise single-trial data and to reduce the number of classifier parameters, which helps avoid overfitting limited training data. As has been stated earlier (Section 2.3.7), the relationship between any two conditions, such as successful and failed trials, can be represented with a common mode and a differential mode. Here, the common mode contains activity presumably related to performing the task but unrelated to the specific outcome. To focus on the difference between outcomes while trying to filter out common processes, we performed principal component analysis (PCA) on the differential mode; i.e., the difference in the neural activity between the trial-averaged successful and failed trials [68] (see Fig. 3.2a). This identifies a neural subspace (i.e., a linear weighting across electrode features) characterized by highly time-varying patterns of neural activity that differ between successful and failed trials. Projecting neural activity into this subspace will tend to minimize the neural covari- ation patterns that are common between successful and failed trials, and will tend to emphasize outcome-dependent activity patterns. We note that although the dimensionality-reducing linear transformation matrix was identified, via PCA, from trial-averaged neural data (to better estimate the true outcome-dependent signal component), we subsequently also applied this transformation to individual time bins of neural data to measure how well we could classify task outcome on single trials. Doing so does not require knowing a priori whether the data being projected through the PCA matrix comes from a successful or failed trial. This outcome-naive single-trial evaluation is critical, since this is the regime in which a closed-loop error detect-and-undo system would operate in. It is worth noting that although the dimensionality-reducing PCA step was optimized on trial- averaged data, the classifier training operates on single-trial examples and therefore will take into account inter-trial variability when determining the class decision boundary. That said, we recognize that it may be possible to improve performance in future work by using dimensionality reduction techniques that explicitly consider single-trial variance, or by using statistical methods that jointly perform dimensionality reduction and classification. The PCA input matrix was N x K (Fig. 3.2a), where N is the number of recording channels (features), and K is the number of time bins (samples). The resulting projection matrix was N x L, where L is the number of PCs. For each trial, the LDA classifier used as input a length L x K vector generated by concatenating the L PCA-derived features at each of the K time bins. For a hybrid classifier, which utilize both spike and LMP activity, the dimensionality reduction was done on each signal separately, and the features were combined (i.e., Lhybrid=Lspikes+LLMP). CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 48

3.3.6 Error detection

To predict a trial’s outcome, which is a binary classification as to whether the trial succeeded or failed, we used linear discriminant analysis (LDA). The data were composed of labeled trials (successful or failed), each with an associated data matrix of dimensions L x K, where L is the number of features (PCs or 1-D cursor speed), and K is the number of time bins in the chosen analysis window. In our previous non-human primate work [68] we used a support vector machine (SVM) classifier, but in preliminary analyses of these human data, we found that a simpler LDA method had comparable performance. Since LDA is faster to compute and simpler to interpret than SVM, we decided to use LDA in the present work. Unless otherwise mentioned, classification accuracy is computed using a time window from 300 ms before until 500 ms after target selection time (K=40 bins). The number of PCs (L) used in the classifiers was optimized for each signal type (spikes or LMP) and each participant (see Sup. Fig. 3.2). We used 3 and 4 (T5), and 1 and 2 (T6) PCs for spikes and LMP, respectively. In this work, we are reporting the performance of a classifier that seeks to detect errors in a task when the underlying success rate on that task is not known to the error classifier a priori. Thus, we present results in terms of separate classification accuracies of successful (true positive ,‘TP’) and failed (true negative, ‘TN’ rates) trials, rather than the combined success and fail trial outcome classification accuracy, which is more dependent on the underlying specific task performance and obscures potential differences in the error classifier’s false positive and false negative rates. We used 100 random repetitions of Monte Carlo cross-validation (randomly splits the data set into training and testing data) to estimate trial-outcome classification accuracy. For each cross-validation split, we withheld a random 10% of the failed trials and the same number of random successful trials for validation. We used the rest of the trials for training the decoder. Equalizing the number of trials in each condition enabled us to better compare the classification accuracy of each condition (successful or failed, i.e., TP and TN) and compare the combined classification accuracy to chance performance (50%, e.g. in Fig. 3.3b). When comparing classification accuracy to chance level (e.g., Fig. 3.3b) we conducted a shuffle permutation test, in which we shuffled 1000 times the labels of the test set for each of the 100 repetitions. Then, we tested significance of the classification accuracy of the data compared to the distribution of the classification accuracy of the shuffle distribution. When classifying data that had its dimensionality reduced via PCA, we first conducted PCA on only the training set to find the projection matrix and then used these PCA coefficients to subsequently reduce the dimensionality of the test data prior to classification. The 100 repetitions were used to compute the classification accuracy mean and standard deviation.

3.3.7 Statistical testing

When comparing two different distributions, we used two-sided Wilcoxon rank-sum test with a confidence level of p=0.05 with Bonferroni correction (to account for the family-wise error rate) CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 49

unless stated otherwise.

3.4 Results

Here we report the offline classification accuracy of task outcome using neural activity from the motor cortex of two people controlling an iBCI. First, we investigated if the task outcome (successful or failed) of a BCI target selection task modulates spiking and local motor potential (LMP) neural activity. Second, to evaluate the potential for an online error detect-and-undo BCI capability, we report a post-hoc task outcome classification accuracy. We also tested if the error detector can be generalized from one task to another, which is an expected property of a task-independent signal such as an outcome error signal and would be useful for clinical BCI applications. Last, we propose a design for an online error detect-and-undo BCI and estimate the online performance improvement that can be expected for such a system.

3.4.1 Task Outcome Related Neural Modulation

To investigate whether task outcome is reflected in motor cortex neural activity, we first examined the trial-averaged neural activity of successful and failed trials. Figure 3.1 shows the population peristimulus time histogram (PSTH) difference between successful and failed trials of spikes and the LMP signals during a Grid Task. To perform a neural population-level analysis and to better isolate the signals that correlate with task outcome, we reduced the dimensionality of the multielectrode activity using principal component analysis (PCA, Methods, Fig. 3.2c). From the PSTHs and the first PC projection, we can see that both spiking and LMP activity differs between successful and failed trials shortly after target selection. This analysis also reveals that the neural signal that correlates with task outcome is low-dimensional: most of the task outcome difference activity is captured by one to three PCs, depending on the participants and the signal type. In other words, the time-varying differences between successful and failed trials are well-described by changes of just a few patterns of activity across the neural ensemble. We will call the signal that is captured in this low-dimensional space the ‘putative task outcome error signal.’ The presence of such a signal in an area widely used for decoding movement intentions via a BCI encouraged us to test its classification accuracy and its potential use for an additional error detect-and-undo BCI capability.

3.4.2 Single-trial outcome decoding

For this putative neural task outcome error signal to be useful for use online, a BCI would have to be able to decode it with high accuracy on single trials. To evaluate whether this was true, we built a single-trial linear discriminant analysis (LDA) classifier. To reduce the number of classifier parameters and prevent over-fitting, we first projected the data to a lower dimension space using CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 50

Figure 3.2: Task outcome modulates neural activity in the motor cortex. Spikes and LMP of participant T5 during a grid task as a function of time (for T6 see Sup. Fig. 3.1), aligned to target selection time (green dot, t=0). (a) The population peristimulus time histogram (PSTH) difference between successful and failed trials of all electrodes. (b) Selected electrode’s PSTH (means.e. of the firing rate) during failed (red) and successful (blue) trials. Gray bars indicate times with significant differences (two-sided Wilcoxon signed-rank test with Bonferroni correction, p<0.05, Methods). (c) Trial-averaged projected neural activity into the first principal component (PC, means.e.). (c-inset) Accumulated variance of the outcome difference neural activity as a function of the number of PCs. Most of the trial outcome-related variance is captured in just a few PCs.

PCA, similarly to the dimensionality reduction used to visualize the data in Fig. 3.2 (see Methods). In designing the classifier, we had to choose which neural activity features to decode. As described in Methods, we used LMP and spikes signals, which are the low frequency and the high frequency signals of the neural activity, respectively. The number of PCs used in the classifier was optimized for each signal type (spikes or LMP) and each participant (see Sup. Fig. 3.2). We found that the LDA decoded task outcome with high accuracy from spikes alone, LMP signals alone and from a ‘hybrid’ concatenation of spikes and LMP features (Fig. 3.3a). The maximum classification accuracies (Wilcoxon signed-rank test with Bonferroni correction, p<0.05) for successful trials (true positive) are 99.70.2% (T5) and 97.00.6% (T6), and for failures (true negative) are 851.4% (T5) 69.91.9% (T6). The hybrid classifier achieved CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 51

the maximum performance with T5 data but not with T6 data. We primarily attribute the difference between error detection performance to differences in the neural signals available. T5 had two arrays which recorded spikes on many electrodes, whereas T6 had a single array with fewer channels recording spikes (details of T5’s and T6’s signal quality are available in [179], see Figure 3.5 in particular). Consistent with this, T5 had higher overall iBCI communication rates (i.e., better velocity and click decoding performance), and his velocity and click decoders were driven solely by spikes, in contrast to T5’s, which were driven mostly by high frequency LFP power in addition to a smaller contribution by spikes for velocity decoding [179]. The fact that the hybrid classifier did not improve performance for T6 likely reflects the poor quality of spiking signals on T6’s single multielectrode array. That said, there could be other potential differences between participants (e.g., cognitive strategy, sensorimotor system reaction time) that contributed to our observed error detection performance differences, which are outside the scope of the present study. The high true negative rate, combined with close to 100% true positive rate, suggests that an error detect-and-undo system could detect errors (for example, deleting an erroneously selected character) with high accuracy while almost never misclassifying a successful selection as erroneous (for example, the system would rarely mistakenly delete a character that the BCI user did in fact mean to select). Local field potentials are known to also contain information (e.g., kinematics) in other frequency bands [224, 11, 177, 188, 198, 217, 75]. To investigate if these frequency bands were modulated by task outcome, we compared the task outcome classification accuracy using LMP and different frequency bands’ power (Methods, Sup. Fig. 3.9). For all LFP bands compared to LMP alone, the true positive rates were the same for T5 and higher by up to 3% for T6 (two-sided Wilcoxon signed-rank test), and the true negative rates were lower by at least 29% (T5) and 43% (T6). We can therefore infer that the power of those frequency bands contains some information about the task outcome but not as much as the LMP (which also contains the phase information), and thus we chose to use LMP as our LFP feature. To better understand when the putative task outcome signal becomes evident in motor cortical activity, we decoded the task outcome using growing time windows. These windows all started 300 ms before selection and ended between 200 ms before until 500 ms after selection (Fig. 3.3b). The cross-validated combined classification accuracy increased above chance (50%, see Methods) 80 ms (T5) and 100 ms (T6) after target selection time (two-sided Wilcoxon signed-rank test with Bonferroni correction, p < 0.05) and saturated around 260 ms (T5) and 340 ms (T6) later. Thus, we can infer that error-related motor cortex activity increases after target selection in a span of a few hundred milliseconds. This timing (coming >80 ms after selection) argues against the error detector working primarily by detecting mis-classification by the HMM click decoder. Instead, this activity might be composed of several processes, such as error detection, correction planning, and corrective movement execution. We discuss interpretations in more detail in the Discussion (Section 3.5). CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 52

We had examined outcome classification from a start time prior to selection in case participants had some inkling that the upcoming selection would be a failure (for example, if they sensed that their performance was poor on this trial or that they saw the cursor was about to drift off the target). In our data, however, outcome classification was only significantly above chance after target selection. We therefore also assessed whether starting the classified time window at 80 ms (T5) or 100 ms (T6) after target selection instead of 300 ms before selection would decrease overfitting and improve performance (by reducing the number of non-relevant features), but found that this did not affect classification accuracy (p=0.84 for T5 and p=0.12 for T6). For simplicity, we therefore started the time window at 80 ms for subsequent analyses. For the iBCI auto-deletion application, we are interested in the practical utility of the neural activity to detect errors. As such, we are agnostic to whether the neural activity reflects the iBCI user’s perception of errors versus his intention to correct. In a Grid task targets are randomly cued both after successful and failed trials. Thus, a stereotyped movement such as reaching to a backspace key is not intrinsically part of the task. However, other kinematic differences between successful and failed trials might exist. To verify that the decoding is not attributed to kinematic differences (e.g., stereotype movement), which might be expected from motor cortex activity, we have investigated the ability to predict errors through kinematics. We checked whether there were kinematic differences between successful and failed trials, and, if so, whether the neural activity being used by the task outcome decoder was more informative than just decoding these kinematic differences. We note that since this was a BCI task, the cursor’s kinematics themselves reflect a specific projection of the recorded neural activity; thus, in effect we are asking whether the putative trial-outcome error signal is distinct from the neural signals related to movement execution activity. Sup. Fig. 3.8 shows that there were indeed small kinematic differences between successful and failed trials. However, classification accuracy was lower when decoding trial outcome using cursor speed, direction, and X and Y velocity than when decoding the putative trial-outcome error signal (two-sided Wilcoxon signed-rank test, p < 0.001). This decoding performance difference shows that motor cortex neural activity contains information about the outcome that is not directly related to the BCI’s kinematics and suggests that the trial-outcome error signal is distinct from movement intention. This distinction is arguably not critical from a neural engineering perspective, in that if subtle kinematic differences could be used to predict success versus failure, it would still be useful to exploit this. Nonetheless, our results are encouraging because they show that the proposed error detect-and-undo strategy would utilize additional dimensions of the neural data in a way that kinematics-based heuristics (for example, requiring low speed to allow target selection) could not.

3.4.3 Generalization between tasks

Although it would be plausible for the task outcome neural correlates to be task dependent (i.e., different tasks’ outcomes are represented differently in motor cortical activity), we hoped that those CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 53

Figure 3.3: Single-trial task outcome decoding using motor cortical neural activity. Classification accuracy of successful (true positive, blue) and failures (true negative, red) trials of the two par- ticipants (T5 and T6). (a) Classification accuracy is computed using a time window from 300 ms before until 500 ms after target selection time. Three different classifiers using spike signals, LMP signals, and both (Hybrid) were compared. (b) Classification accuracy as a function of the end of a growing decoded time window, which starts at 300 ms before selection and ended between 200 ms before until 500 ms after target selection. Green dot corresponds to t=0, target selection time. Grey horizontal bars indicate when classification accuracy of the best method (hybrid for T5 and LFP for T6) is better than chance (50%, see Methods). correlates would be task independent (i.e., similar regardless of the specific task being used, such as our Grid and Typing tasks). To evaluate how well the success vs. failure signals that we recorded generalized between these tasks, we trained a classifier using Grid Task trials and compared how well it could classify held-out Grid Task trials versus Typing Task trials. In both participants, we could classify Typing Task trials with high accuracy using both spikes and LMP decoders trained using Grid Task data (Fig. 3.4a). Although there was some decrease in performance, the decoder could still generalize well from one task to another. Although this property, which is expected from a task outcome error signal, is not requisite for developing a BCI error detect-and-undo system (if necessary, one could train separate decoders for different tasks), it is fortuitous and simplifying. Generalizability is likely to aid in the practical implementation of such a system by reducing training CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 54

Figure 3.4: Task outcome error signals generalize from the Grid Task to the Typing Task. Compar- ison of classification accuracy of Grid Task trial vs. Typing Task trials, using a classifier trained on Grid Task trials only. Classifiers were trained on time window from 80 ms until 500 ms after target selection time for spikes (top row) and LMP (bottom row). data requirements and improving robustness across different situations in which the BCI is used. We did not test the reverse cross-task generalization (train-on-typing task, test-on-grid task) or a within-task train-on-typing, test-on-typing in the present study because the smaller number of typing task trials available were less than the number of trials we had found led to good task outcome decoders in the grid task. A preliminary investigation found that even within-task typing classification was worse than train-on-grid, test-on-typing performance, consistent with there being insufficient data.

3.4.4 Closed-loop detect-and-undo design and simulations

In this section, we put together what we have learned to propose how these neural correlates of task outcome error can be utilized to improve BCI performance. There are two main design choices that characterize a real-time error detector: 1) what kind of corrective action should it perform (e.g., prevent an action before it occurs or undo it afterward?) and 2) when should it perform this action (e.g., at the time of action selection, 100 ms later, or a second later?). In this work, we analyzed CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 55

trials in which the selection was done using a click signal, which is the current state-of-the-art for motor BCI target selection [179, 117]. This contrasts with our previous study [68] in which monkeys dwelled over a target to select it. In the present human study, we were able to decode that a selection was erroneous only after target selection, which is consistent with the short latency of 30 ms of the ‘clicking signal,’ compared to a 500 ms dwelling time in monkeys. Given this latency, we therefore propose that when the neural correlates of the user perceiving an error are detected by the BCI, its corrective action should be undoing the system’s last action. In a typing application, this would mean auto-deletion of the last typed character. In a real-world application (e.g., typing), classifying whether a selection was erroneous or not after the target selection might delay the next movement. In the worst-case scenario, the BCI user will wait until the classification is done before continuing to his next target (after all, why move to the backspace key or the next letter if the system might undo the previous selection). The best- case scenario is that error detection delay will not affect the user’s cadence at all, because it is less than the user’s preferred (or cognitive load-imposed) natural delay between movements (see more details in Discussion). To better understand the potential effect of detecting errors in real-time, we estimated the effective success rate and the estimated bitrate under different assumptions of underlying success rate, delays between target selection, and classification latency. A real-time error detect-and-undo capability will potentially increase the ‘effective success rate,’ i.e., the success rate after error undoing. If ‘s’ and ‘f’ are the numbers of success and failed trials, the success rate is defined as: s/(s+f). When incorporating an error detector on top of the standard BCI, some erroneous selections will be detected and automatically deleted, and the user would be able to continue to the correct target. Thus, those erroneous trials will not count as errors when computing the performance, since the user does not need to correct them manually. On the other hand, some correct selections could be misclassified as being erroneous, and result in an additional reach. The resulting success and failed trial numbers will be:

s0 = s · TP ; f 0 = f(1 − TN) (3.1) where TP and TN are the true positive and true negative rates. Thus, the effective success rate will be s’/(s+f’). We estimated the effective success rate as a function of classification latency and the initial success rate (Fig. 3.5a) based on the empirically observed accuracy of our offline error detection decoder using T5 data (Fig. 3.3b). The effective success rate increased when the decoder was given more time after target selection, and this increase was greater for lower success rates. Thus, when using a BCI with an error detect-and-undo capability, hard tasks will become easier in the sense that the effective success rate will become higher. However, waiting longer to make the determination of whether a selection was erroneous imposes a cost in terms of how many characters can be selected per minute, especially if this adds a latency between target selection and the next movement. While detect-and-act can be implemented in many CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 56

application, we chose to simulate the its effect on typing. As described in Section 2.4.4, to measure information transfer rate during typing while accounting for both what fraction of trials are correct, and how long these trials take, recent BCI studies use the bitrate metric [169, 171, 117, 179, 113]. We estimated the bitrate improvement that could be expected using error detection under three different task difficulty scenarios (i.e., target selection success rates before error detect-and-undo): 60%, 75%, and 98%, where 98% was the empirical success rate in the offline T5 data analyzed for this feasibility study (Table 1). For the estimation we used Eq. 2.6, the error detection accuracy of T5 (TP(dt) and TN(dt), Fig. 3.3b), and the average trial length and selection information content we observed when T5 performed the Grid Task (T=1.3 sec, N=36). The resulting system’s performance should be somewhere between the solid (worst-case scenario) and the dashed (best-case scenario, dt is set to 0) lines that are shown in Fig. 3.5, depending on the initial success rate (task difficulty) and the effect of the classification latency on the user’s latency to start the next movement. The performance change due to adding error detect-and-undo to the iBCI can range from improving communication rates more than two-fold in the optimistic scenario (2.7 times) under low success rate conditions (e.g., 60%), to decreasing performance when rates are already high in the worst case (e.g., 98%). This makes sense intuitively: automatically undoing most errors at a slight cost of time on every trial will be worth it if errors are frequent but less so (or not at all) if errors are rare. When implementing such a system, the optimal added delay can and should be estimated from real-time error detection experiments and be adapted online based on the prevalent error rates given the task difficulty and BCI neural control quality.

3.5 Discussion

In this study, we translated our previous preclinical (monkey) research on augmenting intracortical movement BMIs with a parallel task outcome decoder [68] to a human clinical trial. Though these pre-clinical tests were encouraging, three critical questions remained: are task outcome neural cor- relates present in the hand area of human motor cortex, how well can task outcome can be decoded, and what should be the design of an error detector.

3.5.1 Putative outcome error signal in the human motor cortex

An important result of this study was finding that task outcome error signals were present in neural activity at the hand area of human motor cortical, which is the brain area that movement iBCIs have achieved the highest performance to date in pre-clinical [117] and clinical [179] studies. Previous studies showed that task outcome correlates exist in other brain areas such as anterior cingulate cortex (ACC), basal ganglia and supplementary motor area [131, 126, 129, 19]. Encouragingly, a few studies postulated the existence of different types of error signals in the motor cortex [237, 107, 224, 152]. However, clear evidence for task outcome error signals in the human motor cortex, and CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 57

Figure 3.5: Estimated success rate and bitrate as a function of added delay and task difficulty. The plots show the predicted success rate and bitrate if an error detect-and-undo system were used during online BCI typing. The three colors correspond to different base success rates (i.e. without parallel error decoding). When success rates are lower, there is more room for improvement using error detect-and-undo. The key parameter of task outcome classification accuracy was based on the empirically observed offline classification accuracy using participant T5’s Grid Task data (which is shown in Fig.3.3). (a) Effective Success rate (Eq. 3.1). (b) Estimated bitrate (Eq. 2.6) - solid and dashed lines are worst and best (dt is set to 0) case scenarios, respectively, based on whether the next reach is delayed or not as a result of the classifier latency. more specifically in the precentral gyrus, with intracortical recordings has not been presented. The existence of task outcome error signals in that brain area suggests that iBCI error detect-and-undo capability can be implemented “for free” in terms of not requiring additional sensors. While we were optimistic that we would find this signal given our previous monkey results [68] and previous human ECoG study [151], this was not guaranteed. In addition to the standard caveat that the homology between monkeys and humans is imperfect, there were important differences in the behavioral tasks performed by our monkey and human BCI users. Several outcome correlates present in monkey experiments – such as expecting a liquid reward and planning to lick for it – are potential confounds because they are distinct from the outcome-error itself. These do not exist in human clinical research sessions. Also, whereas the monkeys were typically directly rewarded for successfully selecting a target with a drop of liquid, the “reward” for the humans was an internal desire to communicate a certain character (in the Typing Task) or succeed in the Grid Task game. Additionally, although the Grid Tasks were otherwise similar between the two species, the additional cognitive burden of the human-only Typing Task was quite different from what can be tested in monkeys. It is therefore highly encouraging that the human motor cortex also shows correlates of successful versus erroneous target selection in this more real-world task. Reproducing the previous monkey results in humans CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 58

also strengthens our prior claim that a putative outcome error signals exist in the motor cortex. An interesting question for future study is whether neural correlates differ between different types of selection errors (for example, unintentionally clicking while traveling towards the target, versus intentionally clicking when just slightly off-target). This additional information could be used to further improve performance, for example by updating the click detection threshold if many false- clicks happen or by decoding what the intended target would have been in a near-target erroneous selection. Unfortunately, the limited numbers of failure trials in the present study and their proximity to the cued target preclude a thorough examination of fine-grained error type differences. In the future, cursor movement perturbations / errors [226], false positive clicks, or false negative clicks could be intentionally introduced during iBCI use to systematically examine neural responses across different types of velocity-and-selection control errors. In this study, we have taken a largely practical view of the putative outcome error signal we observed, asking whether, regardless of the subtleties of what this signal means or does, we can use it for iBCI detect-and-undo. A deeper understanding of the putative outcome error signal can provide both scientific insight about the role of outcome feedback in the motor cortex, as well as help us anticipate whether the iBCI utility of decoding this signal is likely to generalize to different tasks. The putative outcome error signal could be elicited by internal processes (e.g., the user understands he made a mistake based on self-monitoring his performance leading up to and at the time of selection) or extrinsic feedback (e.g., it reflects neural correlates of the user perceiving auditory or visual feedback indicating that he made a mistake). The differences between the Grid task and Typing tasks analyzed here provide some degree of insight in to this question. Whereas the Grid task provides explicit feedback in the form of different auditory tones immediately after correct and incorrect selections, in the Typing task there was no explicit outcome feedback except for the selected letter appearing in the typing bar (as shown in Fig.3.1a). This visual feedback did not directly communicate “correct” vs “incorrect”, but rather the participant had to compare it to the cued letter. Nonetheless, the error signal we observed was present in both tasks, suggesting that it is related to the user’s internal feedback (or at least can be determined without a simple explicit feedback cue). On the other hand, the observation that we were unable to decode task outcome error until shortly after the selection suggests that, at least in these tasks, forward modeling [150] of task performance did not appear to generate a task outcome prediction in the motor cortex. This result contrasts with our previous monkey task outcome decoding study [68], in which neural correlates did anticipate the upcoming dwell selection outcome. This difference could be due to task differences (in particular, dwell versus click selection), the degree of the iBCI user’s familiarity with the task (the monkeys were over-trained and perhaps were better at anticipating outcomes), or human versus monkey differences. Future experiments can more comprehensively investigate these question by, for example, presenting false explicit feedback in order to assess whether the error-related neural correlates reflect self-monitoring outcome estimates, explicit feedback, or both. The fact that we CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 59

only saw the error signal after target selection, and that in the Grid task making an error did not subsequently require any correction (such as the delete key), argues against this signal reflecting the user planning or attempting to correct the action that led to the incorrect target selection. Together, the results imply that task outcome is made available to the human motor cortex. While our study cannot speak to why this outcome error is in the motor cortex, or what other brain regions it arrives from, one possibility is that it is a teaching signal for reinforcement learning [102]. In terms of future iBCI error detection applications, the invariance of the signal to simple vs indirect feedback increases our optimism that this approach will work in more complex tasks. Nonetheless, it remains to be seen whether this is the case, especially in open-ended tasks such as free-typing or drawing where there is no value feedback at all provided after each action, meaning that outcome error can only be provided by the user’s internal self-assessment.

3.5.2 Error detection: detect-and-undo

Our finding that errors (task outcome) can be detected with high accuracy from human motor cortex neural activity (Fig. 3.3) is consistent with the high accuracy of decoding monkey motor cortical task outcome error signals [68]. This bodes well for the future implementation of an online error detect-and-undo system. Whereas these previously reported monkey task outcome error decoders operated on threshold crossing spiking activity, here we also found that high decoder performance was achieved using the LMP feature of the local field potentials. It has been suggested that LFP may be recordable using chronic multielectrode arrays for longer than spikes [75, 184], which would be of high value for extending the useful lifespan of a clinical BCI system. Additionally, the ability to train the decoder based on different days (Table 3.1) suggests that the signal is stable across days; however, future work is needed to characterize it better. The signal stability and task generalization (Fig. 3.4) are encouraging properties since it means that an error classifier can be trained once with pre-collected data and be used without additional training in a real-time BMI. This can save training time and recalibration of the error-decoder, which is often needed for the kinematic decoder in a human BCI use [110, 183]. The error detect-and-undo capability provides a novel opportunity and specific direction for improving human BCI systems. Some work in this area has been previously done using EEG [220, 200, 31, 74, 109] and ECoG [152]. Most recent iBCI research, both in preclinical animal experiments [113, 206, 114, 92] and human clinical trials [2, 247, 91, 110, 9, 179, 62, 4] has focused on designing better kinematic or kinetic decoders to more accurately infer the user’s movement intention. Error detection with corrective action will improve iBCI performance via a very different approach: a parallel, independent decoder that extracts more information from the recorded neural activity [152, 31, 68] and reduces the cost of errors when they occur. Specifically, it provides BCI systems with the capability to automatically undo the last action taken when the system detects that the CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 60

user perceives this action as erroneous, sparing them from having to undo it manually. Such a detect- and-undo system could be used for various BCI applications. During typing [172, 100, 91, 110, 179], this could be used for immediate character auto-deletion or for error tracking to improve upon word prediction algorithms (by assigning a probability to the “correctness” of each typed letter and thereby focusing the options for word completion/correction). Detect-and-undo systems can also be utilize for returning to the previous menu during tablet use, and returning to a previous position when using a robotic arm [99, 43]. Though encouraging, whether or not similar task outcome error signals exist in more complex tasks such as prosthetic limb control remains an open question for future research. Error detect-and-undo is more impactful in a low success rate task. Thus, it can be most effective for rescuing performance when the BCI performance degrades (for example, as a result of neural signal degradation), or increasing performance in more difficult tasks. Chronic intracortical electrode signals degrade with time, which reduces BCI performance and success rates [56, 215, 12, 132]. Recent years have seen considerable work towards rescuing BCI performance by designing new kinematic decoders [224, 231, 185, 113, 178, 137, 75, 217]. Here, we suggest an alternative approach: use error detection to increase effective success rates and the user experience, thus rescuing BCI performance. Even in the absence of performance degradation, error detect-and-undo can help improve performance by increasing the tolerable task difficulty. For example, increasing the number of available keys on a keyboard will increase the transmitted information rate from each selection; however, it will decrease the target size and as a result the success rate. By using the error detector, the system could increase the number of keys while still keeping the success rate high. To find the optimal keyboard density, a mapping of the (error-corrected) success rate as a function of layout needs to be found [169].

3.5.3 Online detect-and-undo design

The design of an online error-decoder hinges on two parameters: the classification latency and the type of corrective action (e.g., auto-deletion). The resulting performance improvement also depends on a number of factors: the system’s classification accuracy (Fig. 3.3b); the user’s baseline success rate (which depends on task difficulty); average length of a discrete action (such as a key selection movement), and the cost of making errors (e.g., whether the error requires a delete key selection). As discussed in the Results section, there is a tradeoff between longer classification latency and accuracy, which have opposite effects on overall system information transfer. Importantly, the effect of classification latency on the trial length is yet unknown and needs to be investigated in online experiments. In the worst-case scenario, the BCI user might develop a strategy of waiting until the error detect-and-undo classification is made before initiating the next action; this will delay this next action by a maximum of the classification latency after every selection. On the other hand, the person could adopt a strategy of initiating the next action immediately and adjusting it CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 61

later only if necessary (i.e., if the selection was erroneous and the error detect-and-undo does not work). Such a strategy will reduce the effect of the classification latency and would be the optimal action after successful trials and after erroneous selections when detect-and-undo works (which our results suggest would be most of the time given the high true positive and low false positive rates measured offline). The average cost of such strategy is low and is incurred when errors are not detected or when a false positive selection undo happens. When that happens, the participant will need to update his/her movement after the decoder latency (dt), which will prolong the trial length by approximately the same latency. However, since selection errors are rare to begin with (e.g., 20%) and the detect-and-undo FN is low (15% (T5)), only about 3% of the trials (20%*15%) will become longer by the decoder latency (dt) as a result of FN. Similarly, detect-and-undo FPs are very rare (<1% (T5)) and presumably each cost the user approximately dt of time moving towards what now becomes the wrong key. Thus, the effect of both FP and FN on trial length using this suggested strategy will on average be approximately dt*0.04. In our data, the trial length average was T=1.3sec, but the delay required for high error detection accuracy will be only about dt=300 ms, which is less than T/4. Thus, the total effect is less than 1% (T+dt*0.04=T*1.01). Thus, the added trial time using this suggested strategy is very low and in practice close to the best-case limit we present in Fig. 3.5. In addition, in typing and other forms of real-world BCI use, the user must decide on a next action after completing the previous action (in contrast to the Grid Task data here, where the experimental system automatically cued the next target). In this case, thinking about the next action (e.g. identifying the next letter to type) might impose a natural delay before starting the action such that the added delay due to the task outcome classification will be reduced. A task with such a cognitive load or longer trial lengths (meaning that the relative cost becomes smaller) will further reduce the effect of the delay. Here, we presented the upper and the lower limits of the error decoder performance improvement for a particular set of parameters (Fig. 3.5). While zero delay (best case) is optimistic, we believe that in a task with high cognitive load and with the right user strategy, detect-and-undo performance improvement can approach close to this limit. When calibrating online systems, a similar analysis should be done for every task and participant, and these parameters should potentially be adapted online based on recent success rates, action completion times, and inferred false positive / false negative rates. Most iBCI studies are to some degree application-specific and try to maximize overall system performance, meaning that not only the iBCI decoder but also its interface (e.g., key size) are optimized to minimize costly errors (e.g., [169]). The data we analyzed here had been collected as part of a study striving for high communication rates (without error detect-and-undo), and consequently the success rate in these experiment sessions was very high (98% (T5) and 94% (T6), see Table 3.1). Our simulation predicts that very high success rate scenarios such as these will not CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 62

benefit from a detect-and-act system (Fig. 3.5b). However, to facilitate iBCI users’ independence across a wider range of activities, we envision them using standard (non-dedicated) interfaces, e.g., a cursor to control an off-the-shelf tablet computer [169]. Because optimal target sizes and layouts will not always be present in real-world use, errors are likely to occur more often than when working with a lab system optimized for that specific user’s information throughput. Furthermore, having an iBCI with error detect-and-undo capability itself changes the calculus of what task success rates will result in high performance. Thus, we simulated a range of task difficulties to show the potential of detect-and-act across a spectrum of target selection error rates. Our classifier was biased towards high accuracy when identifying success trials (true positives) as a result of the empirical distribution bias (i.e., high success rate, Table 3.1). A high true positive rate is a desired property of an error detector since misclassifying success trials will frustrate the user. However, to get an optimal decoder that will balance the two, the weight of each outcome can be modeled and used to modify the classifier. For instance, in a typing application, classifying a successful trial as a failure will result in a penalty of re-selecting the key, but since the cursor is in the vicinity of the key this would require just a short movement (or even just a click). However, classifying a failure as a success (i.e., not detecting an error) will result a higher penalty, since the user would need to manually delete the last key and select the original key (two movements). Such cost differences can be modeled from online experiments and used to re-balance the classifier to achieve even higher bitrates. During the present research sessions, the participants were not instructed to do anything special after successful or failed trials except to carry on with the task. However, in online use of a BCI with error detect-and-undo, the user can be informed about the additional decoder and could potentially be trained to emphasize the task outcome error signal. This would improve error classification accuracy and improve the bitrate.

3.6 Conclusion

In the previous chapter 2.7.2 we demonstrated the potential for incorporating error detection into a motor cortically-driven BCI using a pre-clinical monkey animal model. Here, we tested the feasibility for translation to humans as part of a pilot clinical trial with two participants by demonstrating that a putative task outcome signal also exists in hand area of the human motor cortex, and that this signal can be decoded with high accuracy. This chapter suggests a new neural signal present in the human motor cortex activity and sets the stage for future work incorporating error detector in an online iBCI to increase its performance. CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 63

3.7 Supplementary figures

Figure 3.6: Task outcome modulates neural activity in the motor cortex. Spikes and LMP of participant T5 during a grid task as a function of time, aligned to target selection time (green dot, t=0). (a) Population peristimulus time histogram (PSTH) difference between successful and failed trials of all electrodes. (b) Selected electrode’s PSTH (means.e. of the firing rate) during failed (red) and successful (blue) trials. Gray bars indicate times with significant differences (two-sided Wilcoxon signed-rank test with Bonferroni correction, p¡0.05, Methods). (c) Trial-averaged projected neural activity into the first principal component (PC, means.e.). (c-inset) Accumulated variance of the outcome difference neural activity as a function of the number of PCs. Most of the trial outcome- related variance is captured in the first PC in LMP but is shared by more PCs in spikes. This can be a result of low quality spike recordings in T6 (see Methods). CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 64

Figure 3.7: Optimal number of PCs for maximum classification accuracy. Classification accuracy (true positive and true negative) as a function number of PCs (means.e.) for both participants (T5 and T6).

Figure 3.8: Task outcome classification accuracy using cursor kinematics rather than the full neural activity. (a) Speed profile of successful and failure trials as a function of time, aligned to target selection. The sudden jump to zero speed after a selection is a result of stopping and centering the cursor in the selected target after selection. Gray bars indicate times with significant differences (Wilcoxon signed-rank test with Bonferroni correction, p¡0.05, Methods). (b) Classification accuracy (classifying successful trials is a true positive; classifying failed trials is a true negative) of using cursor kinematics (X and Y velocity, speed, and movement direction) compared to using LMP activity in a time window from 80 ms until 500 ms after selection. CHAPTER 3. FEASIBILITY OF ERROR DETECTION IN HUMANS 65

Figure 3.9: Task outcome classification based on different LFP-derived neural features. (a) Clas- sification accuracy (classifying successful trials is a true positive; classifying failed trials is a true negative) using LFP power in different frequency bands, as well as local motor potential, for both participants (T5 and T6) in the Grid Task. For T5, true positive rates of all LFP power bands were not different from the LMP (Wilcoxon signed-rank test with Bonferroni correction, p=0.05); however, true negative rates were smaller by at least 29% (p¡0.001). For T6, true positive rates of LFPs were higher from the LMP up to 3% (p=1.4e-6); however, true negative rates were smaller by at least 43% (p¡0.001). (b) Comparison of magnitude frequency response of each LFP filter (i.e., the frequencies contribution in each of the signal). Chapter 4

Intracortical neural interface design opportunities for power saving

4.1 Summary

In this chapter, we present a collaborative investigation of the neural interface specifications for iBCI clinical application. The bandwidth of clinically viable transcutaneous wireless intracortical brain-computer interfaces (iBCIs) is limited, in part, by the number of recording channels of the device. This is constrained by the limited power budget of the implantable system. Today’s wired neural interface designs typically focus on providing high-quality recording; however, maintaining the full quality of these recordings in wireless systems may lead to inadvertent over-design at the expense of power consumption and limited scalability. Here, we analyze recorded neural signals, using a decoder to understand the trade-offs between signal quality and decoder performance, in order to propose an efficient design for the next generation of iBCIs. We use experimental iBCI measurements in rhesus macaques and a BrainGate2 clinical trial human participant using 96- channel Utah multielectrode arrays. Our findings suggest that current recording system design parameters can be relaxed considerably without loss of performance. This finding enables power savings of an order of magnitude compared to conventional designs, allowing higher channel count and extended battery life for clinical iBCIs.

66 CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 67

4.2 Introduction

There is a considerable industrial and academic interest to advancing all aspects of iBCI design, in- cluding the neural interface recording devices, to improve iBCI performance and extend its clinically viability for a variety of applications. Two major requirements for improving iBCIs are increasing the number of recording electrodes, and implementing wireless transcutaneous implants [104, 134, 201]. Increasing the number of recorded neurons and the variety of recorded cortical areas is predicted to lead to iBCI performance improvements (see e.g., [134, 25]) and might also enable control of more sophisticated prosthetic devices (e.g., with higher degrees of freedom) [83, 201, 247]. In ad- dition, wireless links will enable the development of transcutaneous systems that minimize the risk of infection, improve aesthetic appearance, users mobility and independence [104, 134]. The two requirements compete for the same resources - area and power. However, both resources are limited when considering a device implanted in the brain and/or skull, especially when designing the system for human daily use outside the lab environment. Existing chronic systems for non-human primates (NHPs) that record from thousands of electrodes are power and area hungry, and usually based on wired communication [156, 32, 201]. However, large wired devices will not translate well to human clinical use and wireless systems, especially transcutaneous ones to date, have a limited number of electrodes ( 100 channels [82, 155, 20, 252]). Current systems were designed for basic neuroscience research to record and transmit wide- bandwidth signals with high resolution, thus requiring a relatively large device area and high power consumption. This approach enables the extraction of a variety of signals including action potentials (spikes) and local field potentials (LFP), and permits ”spike sorting” to attribute action potentials to putative individual neurons [114]. Recent efforts to adapt neural interfaces for iBCI applications provide the ability to record at full-bandwidth from a subset of channels at high-resolution while also recording threshold crossing events from all the channels [218, 97, 108]. However, the absence of a clear characterization of the required neural signals for iBCI applications and the use of multi-mode architectures resulted in a trade-off between power savings and programmability. Custom signal specifications for iBCI applications are now crystallizing and diverging from those needed for basic neuroscience. Here we will show that these iBCI requirements are more relaxed than those of basic neuroscience interfaces. We revisit currently used iBCI neural signal recording system specifications and recommend a much more power efficient approach designed around the needs and constraints of clinical use. Our estimates indicate that the proposed approach can reduce power consumption by an order of magnitude. We focus on three main questions: 1) what type of signal should be recorded from the brain? 2) how reliable should this signal be? and 3) how will the resulting new specifications affect the iBCI neural interface design, with particular emphasis on its power consumption? Relaxing constraints on neural recording for the application of iBCI can achieve advantages similar to those seen in other areas such as audio and video recording when a specific application is considered. For example, humans’ hearing range is roughly 20 Hz - 20 KHz. However, only a CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 68

small fraction of that range called the ’voiceband’ (300 Hz - 3,300 Hz) is necessary for clear speech communication. Thus, in the 19th century when the first phone networks were designed only the voiceband was transmitted to account for technology limitations and design tradeoffs. Here, we propose an evidence-driven iBCI recording strategy, focused on iBCI requirements, that maximizes power efficiency while maintaining high decoding performance. In the first section, we discuss which type of neural signal is needed for iBCIs and how robust the system must be against noise. Next, we assess which design specifications can be relaxed without substantially sacrificing iBCI performance. This informs a proposed customized recording strategy for implantable clinical iBCIs. Finally, we describe how the new specifications affect the overall power consumption of the system and highlight the potential for substantial power savings.

4.3 Neural signal requirements for iBCI decoders

4.3.1 Binary threshold-crossing signals sampled at low rates

Current neural interfaces record and transmit wideband signals (e.g., 0.1-10,000 Hz) at high reso- lution (10-16 bits), see Fig. 4.1(b). The low-frequency spectrum contains the LFP, which reflects a spatial averaging of the neural population activity in the electrode’s surroundings and provides supporting information to action potentials [59, 15, 24]. The high-frequency spectrum enables cap- turing delicate features in the recorded signal, which can help in investigating spike waveforms, spike sorting, and differentiating between neuron classes on the basis of their spike waveform. While these properties are of interest for basic neuroscience research, they are not necessarily essential for estimating the user’s neural state or intention for iBCIs applications (e.g., arm movement direction and speed intention). Most high-performing motor iBCIs use only a simple binary signal encoding of threshold crossing events (’1’ if a spike is detected; ’0’ otherwise) in a 1 ms time bin (see Fig. 4.1(f)) to decode the user’s intention [117, 179, 208, 68, 104, 45, 160, 78, 89, 91, 120, 175]. Low frequency bands, such as LFPs, contain less information about the intended movement (e.g., movement velocity) compared to spikes. However, they are beneficial for iBCI mostly when the spike signals have degraded severely [225, 75, 179, 104, 182] or to classify between a small set of discrete states [69]. The importance of these benefits might diminish as the number of electrodes in iBCI systems increases and as they achieve better ability to record thresholded spikes [72, 254]. Sorting spikes by individual neurons detected by the same electrode (Fig. 4.1(e)) can be of interest when investigating single neuron modulation. However, for decoding purposes, when the activity of the entire neuron population is summarized to evaluate the desired user intention (e.g., by linear combination), this might be unnecessary. Sorting spikes can potentially improve iBCI performance by distinguishing spikes from neurons that are tuned differently (e.g., have different preferred direction) or separating neurons from a high-amplitude noise or high-frequency LFP. However, accumulating evidence in NHPs suggests CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 69

Figure 4.1: iBCI schematic signal flow. Neural activity is recorded using an electrode array (e.g., (a) Utah array), with each electrode measuring the neural activity in its vicinity. The raw analog signal (b) is amplified (by an analog front end - AFE), digitized (by an analog-to-digital converter - ADC), and then transmitted (by a transmitter - TX) to a computer for further processing. In some cases, some preprocessing (e.g., spike detection) happens before the transmitter by digital signal processing (DSP). Most iBCI neuroprosthetic studies reprocess the signal by applying a band-pass filter and a simple threshold crossing (d) for spike detection. The threshold crossings are evaluated for each electrode, although an electrode might record from multiple neurons simultaneously (e), which can mix correlations with behavior (e.g., movement preferred direction). Lastly, a decoder (e.g., Kalman filter) estimates the user’s intention (e.g., robotic arm velocity) from the binary threshold-crossing signal (f), and sends the control signals (g) to the prosthetic controller. CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 70

that the effect of spike sorting on iBCI performance is minimal (∼5% performance loss) compared to simple threshold crossing (e.g., threshold at -4.5 x RMS) [78, 34, 136, 236, 182]. Taken together, these developments suggest that iBCIs may benefit most from larger electrode counts, and can compromise on signal fidelity by transmitting only binary threshold-crossing events. One can imagine transmitting even more abstract signal representations such as binned spike counts (the number of spikes in a defined time window, e.g. 20 ms window), dimensionality-reduced signals (i.e., compressed signals with fewer channels. e.g., [115]), or just the output control signals for the prosthesis (e.g., velocity). While it is common in the iBCI field to use threshold crossings for decoding [179, 208, 89, 91, 206, 68, 117], the optimal bin size, dimensionality reduction technique, and the decoding and control algorithms are still under active investigation (e.g., [208, 231, 117, 115, 92]). In addition, there is evidence that small bin sizes (e.g., 1 ms) can improve performance; however, the effect of bin size on performance is still unclear and likely depends on the decoding algorithm [208, 179, 47]. Intensive processing before transmitting the signal may therefore limit the compatibility of the device with future algorithms. Thus, at the present time, we believe that transmitting the presence or absence of spikes in 1 ms bins is a well-balanced level of simplification that fits current iBCI best practices, while still leaving the door open to future research and development in the field.

4.3.2 Tolerance to high recording and transmission error rates iBCIs being used in clinical research, like many other medical and research devices, are currently designed to have minimal recording and transmission errors, which guarantees minimal spike mis- detection. However, this high reliability of the recorded and transmitted brain activity comes with a high cost in terms of integrated circuit power and area. Redundancy in the neural population spiking activity suggests that high signal fidelity might not be required for iBCIs. The aim in mo- tor iBCI applications is to estimate the user’s intention from the ensemble of all recorded neurons. Correlations across electrodes and the temporal smoothness of the underlying intention (e.g., hand velocity) mitigate the effect of noise on each electrode, i.e., the signal is highly redundant. Therefore, it may be possible to reduce the recording and transmission reliability of each electrode as long as the final decoding accuracy does not degrade. To demonstrate this, we investigated the tolerance of iBCI decoders to noise and quantified how much we could distort the spiking activity while keeping comparable decoding quality. Specifically, we tested an iBCI systems’ robustness to spike errors. Digital communication fidelity is traditionally described by the bit error rate (BER), which is the rate of flipped bits from 0 to 1 and vice versa. For our purpose, to measure the accuracy of the recording and transmission of spikes, which are binary threshold crossing events, we introduce the notion of spike error rate (SER). SER is the rate at which a spike event was falsely transmitted or missed, i.e. a bit in the binary spike train was flipped. We distinguish between BER and SER because SER represents the error rate of the entire neural interface system - both recording and transmission. To evaluate the robustness of CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 71

the iBCI decoder to SER, we post hoc measured NHP and human movement behavior predictability using an intentionally distorted neural signal, i.e. we randomly flipped bits in the binary threshold spikes (Fig. 4.1(f)) and then tried to decode this signal. We note that this noise injection is different from the common practice in our field as we flip spikes in 1 ms resolution and not adding a Gaussian noise to the spike rate in a longer time window (e.g., 20-100 ms [183, 22, 231]). The original neural signals were recorded from able-bodied monkeys and a person with paralysis while they performed a computer cursor movement task. The monkeys moved the cursor to cued targets using their hand, whereas BrainGate2 clinical trial participant ’T5’ controlled it with an iBCI system (for more details see Methods section). As a decoding performance metric, we use the coefficient of determination (R2), which describes how much of the variability of the cursor velocity can be predicted from the neural activity. First, we generated synthetically distorted neural signals by injecting errors in the recorded data at different SER (10−6 to 10−0.5). Then, we estimated how well the distorted neural signal could predict the cursor velocity using a Kalman filter, a widely used decoder for iBCIs [89, 89, 179] (Fig. 4.2(a), see Methods from more information). Surprisingly, across the three monkeys and the human participant, SER only had a significant 2 −3 effect on performance, compared to an undistorted signal (Rorg), at a rate higher than 10 (Fig. 4.2(b)). In other words, the neural interface recording and transmission system can tolerate a SER of up to 10−3 while maintaining comparable decoding performance. Intuitively, if the SER is much smaller than the rate of spikes, it should not have a significant effect on the decoder; but if the SER is of the order of magnitude of the firing rate, then the movement intention information will become highly corrupted. Indeed, our results on SER robustness correspond to the recorded firing rate (∼10 spikes/sec, see Sup. Fig. 4.9) at the sample rate of 1,000 samples/sec (1 kSps). The proposed metric for spike distortion (i.e., SER) and the upper limit for the allowed error can be a guiding tool for iBCI neural interface design, both in terms of recording and transmitting architecture, as well as specifications for the individual blocks in the system. Our results suggest that a neural interface (from electrode to transmitter Fig. 4.2(a,c)) can distort the transmitted spike signal by a rate of up to 10−3, which is several orders of magnitude higher than the BER traditionally targeted by telecommunication systems [10, 58]. We propose iBCI decoder requirements wherein a neural interface transmits a binary threshold-crossing spike signal at 1 kSps with an error rate of up to 10−3. This allows new trade-offs that could lower device power and area requirements, and gives rise to novel neural interface designs that are custom-optimized for iBCIs.

4.4 Custom neural interfaces for iBCIs

Recording and transmitting binary threshold-crossing signals while tolerating high spike error rates opens an avenue for new recording system architectures that are customized for the needs of clinical iBCIs. These devices can be more efficient in power and area compared to current neural interfaces CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 72

Figure 4.2: iBCI robustness to spike error rate (SER). (a) SER analysis process. First, binary threshold neural signal bits (’1’ - spike , ’0’ - otherwise) were flipped at different rates (10−6 to 10−0.5). Second, cursor velocity was predicted from the noisy signal. (b) Decoder performance (velocity coefficient of determination, R2) as a function of added SER. Values are normalized to performance when decoding an undistorted signal (i.e., RSER ). Vertical bars along the lines Rorigianl represent the standard error of 10-fold cross validation across 10 days (total of 100 R2 estimates). Horizontal bars indicate significant change in performance compared to the undistorted signal (two- sided Wilcoxon rank-sum test, p¡0.05). CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 73

(Fig. 4.1(c)). To estimate the potential power savings of this approach, we investigated the benefits of using conventional architectures with distinct parameter choices informed by clinical iBCI needs. We intend for these conventional architecture estimates to be a starting point and an upper bound for more drastically different future designs and architectures. In this section, we describe the key parameters of conventional systems, and perform analyses similar to the previous section to examine how these parameters can be relaxed while still maintaining sufficient decoding accuracy.

4.4.1 Neural interface circuit design parameters

Figure 4.1(c) shows a conventional wireless implantable neural interface system similar to what is currently used in animal studies [201] and is being developed for human use (e.g., Clinatec WIMAG- INE [149]). The system consists of a sensor (such as a penetrating electrode array) connected to multiple recording units and a wireless transmitter (TX). Each recording unit contains an analog front-end (AFE), an analog-to-digital converter (ADC), and digital signal processing (DSP, e.g., spike detector). The AFE amplifies the neural signal in the frequency band of interest (f0, f1 - e.g. 0.3-7.5 kHz for action potentials). The noise introduced by this stage is defined as the input referred noise level (vin,rms) of the AFE. The output signal is then converted into a digital signal by the ADC. The ADC is defined by the sampling frequency (fs) and the resolution (B - number of bits). Due to circuit non-idealities, the achieved effective resolution is usually 0.5-1.5 less than the ADC number of bits, and it is defined by the effective number of bits (ENOB). Threshold crossing detection is implemented in post-processing and adds negligible power consumption [87]. The main factors that guarantee fidelity of this process are a wide frequency band, low noise, high sampling frequency, high quantizer resolution, and low data-link bit error rate (BER). Unfortunately, these capabilities contribute to the power budget and total size of the system. In this subsection, we focus on the recording unit’s design parameters, which also affect the transmitter power consumption. The transmitter-specific design parameters will be discussed below.

4.4.2 Custom circuit parameters for a movement iBCI

To investigate the range of circuit parameters that do not compromise performance in the iBCI application domain, we estimated the velocity prediction quality from a neural signal degraded by relaxing the specifications of several specific circuit components (see Fig. 4.3(a-c) and Method section for more details).

First, we varied the observation frequency band, f0 and f1, by sweeping the lower and upper cut-off frequencies of a second-order Butterworth bandpass filter used to filter the raw signal (see Methods). To relax the filter roll-off requirements and avoid aliasing issues, the sampling rate was set to fs = 3f1, allocating a slight oversampling above the Nyquist limit. Fig. 4.3(d) shows that decoding performance is kept consistent in a wide range of frequency bands, and that competitive CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 74

decoding accuracy is also achieved at lower and narrower frequency bands, e.g. 0.5 kHz - 3 kHz. These results are consistent with previous studies examining finger position decoding [108]. Second, we investigated the effect of the quantizer resolution on performance. Fig. 4.3(e) shows that the decoder performance is fairly independent of ADC resolution for ENOB ≥ 7 bits. This minimum resolution is limited by the precision requirements on the threshold values used for spike detection, rather than by the signal resolution. Here, a threshold was set proportionally to each electrode’s (el) root mean square signal (T hel = n × RMSel), where n was optimized for each set of parameters (e.g., number of bits). Thresholding in the analog domain would allow for 1-bit quantization; however, Gibson and colleagues [87] showed that low-resolution digital spike detection is more efficient than the analog counterpart. The number of necessary bits can be further reduced below 7 by exploring non-uniform quantization steps, like the BER optimal ADC in [166]. This will allow a larger quantization error in a voltage range that is not informative for spike detection. For example, we can potentially saturate all positive values at 0 V since spike detection is usually performed on the negative phase of the spike waveform. This would reduce the required number of bits by 1. Third, we investigated the effect of raw signal noise on decoding performance. In a neural interface, there are four main sources of noise: tissue thermal noise; electrode noise; noise from the interface electronics; and neuronal background electrical activity that might carry information from the surrounding neurons, but which for the purpose of spike detection we also consider as noise (Fig.

4.1(a)). Very low-noise interfaces (e.g., 1-5 µVrms [108, 82, 252]) are usually designed to avoid being the main source of noise and to provide measurements limited only by the biological system [251]. However, fig. 4.3(c) shows that decoder performance is robust to a larger added Gaussian noise of up to 7 µVrms. This knowledge can be utilized by, for example, increasing the input referred noise of the AFE, or accommodating electrode impedance changes in chronic implants. These results suggest that neural interface designs can be relaxed dramatically. An on-going research effort in this direction from the hardware and neurosciences communities already exists to create a custom neural interface (academic prototype systems) [82, 26, 218, 145]. However, the iBCI- focused system we propose will allow for even greater savings in terms of power consumption. Table 4.1 summarizes the system specifications for conventional (commercialized), academic prototype, and our proposed iBCI-focused systems. This presents an opportunity to design custom neural interfaces for iBCI applications based on existing architectures that are power efficient while still supporting higher channel counts and wireless communication. Higher channel counts might enable further relaxed parameters, since the redundancy of the channels’ neural signals will increase. Next, we will quantify the power savings of the proposed custom iBCI design compared to a conventional design. CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 75

Figure 4.3: Study of iBCI performance as a function of the neural interface parameters (monkey J, for the other monkeys and the human participant see Fig. 4.10). (a-c) parameter simulation pipeline and examples: (a) raw data was (b) filtered, re-quantized or corrupted with noise, and then thresholded. The threshold was set proportionally to each electrode’s root mean square voltage (T hresholdelectrode = n × RMSelectrode), were n was optimized for each set of parameters (e.g., number of bits). Orange and blue dots are the corresponding binary spike signals after thresholding. (c) Hand velocity was then predicted with a Kalman filter (10-fold cross validated across 10 days) from the preprocessed spike signal. Decoding performance was evaluated with reconstruction R2 2 (insert). (d) R as a function of f0 and f1. The threshold was optimized for each frequency band separately. The ’o’ marks the frequency band with maximum performance, and ’x’s mark frequency bands that resulted in significantly lower performance than the best frequency band (two-sided Wilcoxon rank-sum test, p¡0.05). (e-f) R2 (mean ± s.e.) as a function of (e) effective number of bits, and (f) standard deviation of added noise for each filter bandwidth. Horizontal lines show significant differences compared to best R2 (two-sided Wilcoxon rank-sum test, p¡0.05). CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 76

Parameters Conventional Prototype Proposed vin,rms 1-5 µVrms 1-5 µVrms 5-10 µVrms f0 <1 Hz <0.1 kHz 0.5-1 kHz f1 5-10 kHz 3-5 kHz 2-4 kHz fs 15-30 /s 10-20 kS/s 6-12 kS/s ENOB 10-15 bits 8-10 bits 5-7 bits

Table 4.1: Neural interface specifications for conventional (commercialized), academic prototype and our proposed iBCI-tailored systems. We propose that parameters can be relaxed up to 2-4 times.

4.5 Neural interface power consumption

The previous results present a wide range of acceptable neural interface designs for use as part of an iBCI. In this section, we analyze how much power is saved in each device component by allowing more noise over a reduced bandwidth of interest.

4.5.1 Analog front-end

To estimate the AFE power consumption we used the power efficiency factor (PEF) metric (Muller [161] extension to Steyaert and colleagues [228] noise efficiency factor):

2 2 vin,rms Itot PEF = NEF VDD = VDD (4.1) ∆f 2πUT kT

kT where Itot is the total bias current, UT = is the thermal voltage, k is the Boltzmann constant, T is the temperature and q is the charge of an electron. The NEF describes how many times the noise of an amplifier is higher compared to the ideal case of a bipolar junction transistor, operating with the same bias current, and the PEF is used to compare solutions working at different supply voltages.

State-of-the-art neural amplifiers [26, 161] usually result in a power budget (PAF E = ItotVDD) in the 2-10 µW range, and PEF in the [15-30] V range. Fig. 4.4(a) shows the power consumption of an amplifier, with PEF = 16 V, for different input- referred noise levels and bandwidths of interest. Moving from conventional systems (red area) or academic prototype systems (blue area) to our proposed custom iBCI systems (green area) could reduce the power consumption of the AFE by about 48x and 8x, respectively.

4.5.2 Analog-to-digital converter

The conversion power for ADCs is a linear function of the sampling speed for sampling rates well below the transit frequency of the technology. Estimating the conversion energy as a function of the ENOB, however, is a more complex task. A model for the conversion energy is used here and described in the Methods section. This model considers the minimum power consumption of a CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 77

proxy successive approximation register ADC, [144], and it provides a realistic estimate of the power savings as a function of the ENOB. Fig. 4.4(b) shows the power consumption of an ADC as a function of the effective number of bits, for different sampling frequencies, fs. Moving from conventional systems (red area) or academic prototype systems (blue area) to our proposed custom iBCI systems (green area) could reduce the power consumption of the ADC by about 1000x and 10x, respectively.

(a) (b) AFE ADC 10-4 10-5 f =2 kHz fs =6 kHz f =4 kHz fs =12 kHz f =5 kHz 10-6 fs =15 kHz f =10 kHz fs =30 kHz -5 ~6x 10 ~100x 10-7

~8x -8 10 10-6 Power [W] ~10x

10-9 AFE Power Consumption [W] -7 10 10-10 2 4 6 8 10 12 14 6 8 10 12 14 Input Referred Noise [uV] ENOB

Figure 4.4: (a) Power consumption as a function of input-referred noise for a neural amplifier - eq. (4.1) and PEF = 16 V used for this plot. (b) Power consumption as a function of the effective number of bits for an analog-to-digital converter - see Methods for model used for this plot. Red areas refer to conventional systems for basic neuroscience, blue areas refer to academic prototype solutions and green areas refer to our proposed systems for iBCI application. The predicted power consumption savings are quantified next to the arrows.

4.5.3 Wireless transmitter

The system proposed here would take advantage of the reduced requirements, both in terms of single channel data rate and bit error rate, to allow for a larger number of channels transmitting simultaneously. Current systems implement simple modulation schemes such as On-Off Keying (OOK) or Frequency-Shift Keying (FSK) to reduce the complexity at the transmitter, while still −4 achieving BER lower than 10 . The efficiency of the transmitter, Eb, is defined in terms of energy per bit and accounts for both the dynamic and static power consumption needed to transmit a single bit of information. At high data rates, the static power consumption is negligible compared to the dynamic power consumption and the overall efficiency is usually high. Given the data rate, fTX = Bfs, the total power consumption becomes

PTX = EbfTX . (4.2) CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 78

Transmitting threshold-crossing spike events, instead of wide-band high-resolution signals, will re- duce the power consumption of the transmitter as long as the transmission efficiency is kept constant. The power saved can be allocated for integrating more channels into the device and maintaining the same data rate, which would guarantee the same efficiency. Compared to a conventional system for basic neuroscience (e.g., 12 bits at 30 kHz) or academic prototype solutions (e.g., 10 bits at 20 KHz), the proposed solution tailored for iBCIs (e.g., 1 bit at 1 kHz) could increase the number of channels by 360x and 200x, respectively.

4.5.4 Low total power consumption for an iBCI

Fig. 4.5 summarizes the results presented in this section. A comparison is made for each component (AFE, ADC and TX) between a conventional system for basic neuroscience, an academic prototype system, and the proposed iBCI system with threshold crossing detection performed on chip. For the conventional system, the parameters are vin,rms = 3 µVrms, ∆f = 7 kHz, fs = 30 kS/s and

B = 12 bit. For the academic prototype system, the parameters are vin,rms = 5 µVrms, ∆f = 5 kHz, fs = 20 kS/s and B = 10 bit. For the proposed iBCI-focused system based on the Section

4.4.2 simulations, the parameters are vin,rms = 7 µVrms, ∆f = 2.5 kHz, fs = 9 kS/s and B = 7 bit. The transmitter assumes an efficiency Eb = 50 pJ/b, and the AFE assumes a power efficiency factor PEF = 16 V. The new relaxed specifications for iBCI applications could reduce the total power consumption by one order of magnitude compared to a conventional system designed for basic neuroscience, or even compared to emerging research-tailored solutions (academic prototype systems). These power savings come from loosening the parameters of all three components together. For example, transmitting spikes detected on chip with wide bandwidth (like in [218]) would reduce the power by only about two fold. In contrast to the conventional system, whose power consumption is dominated by the TX (67%), the proposed system’s power consumption is limited by the AFE (91%).

4.6 Outlook

Our results suggest that iBCIs with dedicated circuits designed for clinical use can consume an order of magnitude less power than an iBCI built to basic neuroscience-influenced specifications. The proposed specifications are dramatically relaxed without compromising decoding accuracy. This can give rise to new high-electrode count wireless iBCIs by reducing power and space requirements to the point that these circuits can support thousands of channels. In this section we identify areas where future research efforts in circuit-level and system-level solutions can further push an exponential increase in the number of wirelessly transmitted recording channels. CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 79

x44 Total AFE 10-5 x20 ADC TX

10-6

10-7

10-8 Channel Power Consumption [W]

10-9 1 2 3 Conventional system Academic prototype Proposed system for basic neuroscience system for iBCI application

Figure 4.5: Custom iBCI design reduces the total power consumption by one order of magnitude. Power consumption per channel (log-scale) for conventional, academic prototype and proposed cus- tom iBCI systems. A 44x and 20x total power consumption savings is predicted.

4.6.1 Circuit-level opportunities

Recording unit and transmitter

Transmitting only threshold crossing events does more than just relax the system specifications. It also opens an avenue for new recording system architectures for clinical iBCIs. For example, different spike detectors can be implemented, such as the nonlinear energy operator () that looks at the energy of the signal instead of the absolute value of the voltage trace, [174, 111]. Such detectors might provide more robust protection against thermal noise and could further relax the AFE and ADC specifications. In our approach, the AFE is the main power consumer. It therefore should be the focus of future studies of new circuit topologies and tests of the robustness of iBCIs to noise. While we found that an iBCI decoder can be robust to added Gaussian noise of up to 5-10 µVrms, we were not able to isolate the different noise sources and calculate the analog front-end input referred noise. This is because noise from different sources (biology, electrodes, electronics) are indivisible in the recordings. Future work should aim to isolate these sources and better characterize the iBCI decoder robustness specifically to noise from the AFE. The total SER is linked to the transmitter BER through the communication protocol. If the raw output of the threshold detector is transmitted, BER = SER, and an error in the transmitted data will result in either a false spike or a missed spike. More elaborate protocols that take into consideration the sparsity of the signal can reduce the transmitter data rate and obtain a different relationship between SER and the transmitter BER. For example, when the average firing rate is roughly 10 Hz (as in our data), at 1 kS/s only 1% of the bits are expected to be 1. Transmitting only the index of firing electrodes will result in a dynamic data rate with an average of Nlog(N) × 1%, were N is the number of channels. In this protocol, a bit error will create a fake spike (at the CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 80

incorrect electrode index) and a missed spike (at the original electrode index), doubling the SER. On the other hand, error detection and correction techniques at the receiver end could help alleviate the requirements on the BER, at the cost of minimal increase in the data rate requirements.

Device area

Another limited resource for implantable neural interfaces is the chip area. In contrast to the power estimates used in this study, quantitative estimates for the area needed for a particular set of design specifications are difficult to achieve. Required area depends on many factors, such as process technology and architecture. However, reducing the noise requirements of an integrated circuit almost always results in a smaller footprint. Reduced transconductance results in smaller active devices, and smaller sampling capacitors result in smaller passive devices. Increasing the high-pass pole of the filter might also reduce the AFE total area. Further work should investigate area consumption limitations and find the right balance between device area and performance.

4.6.2 System-level opportunities

Dimensionality reduction on-chip

As we mentioned earlier, dimensionality reduction technique are still under active investigation and consensus on a single reduction strategy has not been reached. Nevertheless, to further reduce the system’s data rate, one could implement dimensionality reduction directly on-chip. A common approach is to implement principal component analysis (PCA) before the decoder. However, it is not immediately clear how on-chip PCA would help reduce the overall system power consumption. The data rate reduction is not massive and the power overhead of the hardware implementation for PCA might actually result in an increase in power consumption. For example, for 1000 channels the original data rate would be, after the threshold detector, fTX,1 = 1 Mbps (assuming 1b at 1 kHz output). If 20 PCs with 8 bit resolution are transmitted after PCA analysis, the new data rate would be fTX,1 = 0.16 Mbps. The gains in reducing the data rate from 1 Mbps to 0.16 Mbps might not be enough to justify the computational cost of PCA and the storage cost of a projection matrix. This conclusion differs from previous work done on on-chip compression of neural signals, [119], since the raw data here is a binary threshold-crossing signal and not a high-resolution signal used for spike sorting. Currently, PCA is computed using floating-point resolution. To properly estimate the benefit of on-chip PCA, future work should study the resolution requirements on the PCs for iBCI decoders, i.e. how many components and which bit resolution per component. This will allow a numerical analysis on the computation and storage cost of on-chip PCA, as well as the data reduction factor. CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 81

Real-time iBCI

Here, we estimated the effect of system parameters on iBCI performance using offline decoding analyses based on real movement and iBCI data. However, during real-time iBCI control, the user has continuous feedback about the decoder’s performance (for example, by seeing how the cursor or robotic arm is moving). This allows the user to compensate for errors [28, 225, 231]. Thus, the robustness to SER in real-time is probably higher than in the offline analysis we presented here. This can be verified by future closed-loop studies in which various types of signal processing alterations (such as spike errors or different filtering or bit resolution) are made to the neural data during real-time iBCI control.

Number of required recording channels

A natural question is how many channels are needed for an iBCI? Until high electrode count devices exist (e.g., >>1000 channels), it will be difficult to determine how many electrodes suffice for each iBCI application. There have been a few attempts to extrapolate the performance of iBCIs with increasing numbers of electrodes (e.g. [25, 201, 245]). However, extrapolations are challenging because they do not reliably predict how neural activity will change in more complex tasks [84] and how more advanced decoders might make use of this data. Schwarz and colleagues [201] postulated that recording 5,000 to 10,000 neurons is necessary for an iBCI to restore limb movement, and that 100,000 neurons will be required to control whole body movement. Once a high electrode count device exists, it might reveal that it is advantageous to have more electrodes even at the expense of the reliability and accuracy of each electrode signal; this would provide opportunities to reduce per-channel power even more by further relaxing the specifications.

4.6.3 Implications beyond movement iBCIs

Other types of BCIs

Here we evaluated circuit specifications for neural interfaces for decoding movement intentions. Our results – that design specifications can be dramatically relaxed – may well apply to other types of neural interfaces, such as those used in retinal prostheses, peripheral nervous system interfaces (e.g., for amputees), closed-loop deep brain stimulators, etc. Our prediction is that neural interfaces that rely mainly on decoding spike activity will have similar recording system requirements (e.g., f0, f1 and B), though the SER might change based on the redundancy of the signal and the robustness of the decoders. Similar power calculation and parameter analyses might also be beneficial for wireless miniature microscopes to enable longer recording times (e.g., [138]). CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 82

Implications for basic neuroscience research

While this work focuses on neural interface design for a clinical iBCI application, basic neuroscience research might also benefit from low-resolution, high channel count devices. Although research- based studies traditionally require accurate single neuron recording, in some scenarios they can benefit from trading off recording from more neurons for better per-neuron signal fidelity, e.g. when looking for population-level phenomena for which spike sorting is not necessary [236], or in studies where wireless recording is essential [252, 201, 77]. In particular, this approach can enable longer duration and/or wireless recording from model organisms that are too small to carry the bulky electronics needed for high-bandwidth recording and data transmission/storage.

4.7 Conclusion

When developing a new device, an iterative process of design and user testing is essential. In multidisciplinary research, such as neuroscience, this process may take years or even decades since the design and the testing are done by separate entities (e.g., different research labs). A large body of neuroscience research gave rise to the iBCI field, which since its inception used similar methods and tools as neuroscience. Decades of iBCI research with monkeys and recent clinical trials with human participants have now brought the field to a new level of maturity and confidence about its neural interface requirements. While future iterations (e.g., further on-chip processing) are inevitable, our study can be viewed as central feedback on current neural interface designs and a guidance for dedicated designs for the next generation of iBCIs. We believe that this study, which arose from a collaborative effort between electrical engineers, neural engineers, clinicians, and neuroscientists, is a path forward towards the next generation of clinically viable iBCIs.

4.8 Supplementary

4.8.1 Methods

Monkeys hand movement data

All monkeys’ procedures and experiments were approved by the Stanford University Institutional Animal Care and Use Committee. Three male rhesus macaques (monkeys J, R and L) were trained to perform point-to-point movements of a 6 mm radius virtual cursor in a 2D plane, while their other arm was gently restrained. The monkey performed center-out-and-back task to 8 targets uniformly distributed on a 8 cm radius circle (Sup. Fig. 4.6). Two mirrors, setup as a Wheatstone stereo-graph, visually fused the monitors into a single 3-D percept for the monkeys, although all task relevant motion was limited to two dimensions [48]. In this work, about 100 continuous successful CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 83

trials (about 2 min) from 10 experiment session days (about 1000 total trials) were recorded from each monkey and analyzed. Monkeys were implanted with two (monkeys ’J’ and ’R’) or one (monkey ’L’) 96-electrode Utah arrays (Blackrock Microsystems, Inc.), using standard neurosurgical techniques 95 (J), 75 (R) and 91 (L) months prior to the recorded sessions. The arrays contained a 10 10 grid of 1 mm microelectrodes with 400 µm center-to-center spacing between adjacent electrodes. and R’s arrays were implanted into the left cortical hemisphere; one array went into the primary motor cortex (M1) and the other into the dorsal premotor cortex (PMd). In this study we used only the PMd array of monkey R, since his M1 array was severely degraded and recorded almost no large waveform action potentials. single array was implanted into the right hemisphere boundary between M1 and PMd.

Figure 4.6: Illustration of experiment setup and task. Green circles represent the possible target location and the dashed squares show the acceptance area of the target.

Human participant iBCI cursor movement data

Permission for these studies was granted by the US Food and Drug Administration (Investigational Device Exemption) and Institutional Review Boards of Stanford University (protocol #20804), Part- ners Healthcare / Massachusetts General Hospital (2011P001036), Providence VA Medical Center (2011-009), and Brown University (0809992560). The participant in this study, ’T5’, was enrolled in a pilot clinical trial of the BrainGate2 Neural Interface System (http://www.clinicaltrials.gov/ct2/ show/NCT00912041). Informed consent, including consent to publish, was obtained from the par- ticipants prior to his enrollment in the study. Participant T5 is a right-handed man, 63 years old at the time of the study, whose iBCI cursor control experiments were previously described in [179, 69]. T5 was diagnosed with a C4 AIS-C spinal cord injury approximately nine years prior to study enrollment. In August 2016, participant T5 had two 96-channel intracortical silicon microelectrode arrays (1.5 mm electrode length, Blackrock Microsystems, Salt Lake City, UT) implanted in the arm-hand area of dominant (left) motor cortex. T5 also performed 10 research sessions from which we analyzed 2 min durations of a cursor movement task. In his task, a grid spanning 1000 1000 pixels on the computer monitor was divided CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 84

into a 6 6 or 9 9 grid of equally-sized gray squares. Each square was a selectable target, and on each trial, one square would randomly be prompted as the correct target by changing its color to green. The participant had to select the correct target (which resulted in a trial success) while avoiding selecting any of the other (incorrect) targets, which resulted in a trial failure. T5 controlled the computer cursor using an iBCI. In his sessions, neural control and task cuing were controlled by custom software running on the Simulink/xPC real-time platform (The Math- works, Natick, MA), enabling millisecond-timing precision for all computations. Neural data were collected by the NeuroPort System (Blackrock Microsystems, Salt Lake City, UT) and available to the real-time system with 5 ms latency. Two-dimensional continuous control of the cursor was enabled by the ReFIT Kalman Filter detailed in [91, 179]. T5 could select a target by dwelling on it for 1 s or by a discrete click signal. Discrete selection (click) was achieved using a Hidden Markov Model (HMM)-based state classifier. The user commanded a click by attempting to squeeze his left hand (i.e., the hand ipsilateral to the array(s)). For both the continuous cursor-positioning ReFIT-KF decoder and the discrete click- state HMM decoder, spiking activity was binned every 15 ms and sent through the decoders. Since the executed kinematics was an output of a Kalman filter based decoder, it was more temporally structured compared to the monkeys’ hand kinematics.

Neural and hand position recording

We used Blackrock Microsystems neural acquisition systems during both monkey (Cerebus system) and human (NeuroPort system) sessions. Both data acquisition systems achieve 3 µVrms of input referred noise over a bandwidth of [0.3 - 7500] Hz, and it sample each electrode with 16 bits at 30 kSps. We referred to the system output signal as our raw signal. Nonactive electrode with zero firing rates were removed from the analyses. During the monkey sessions, their contralateral hand position was measured for decoder training and hand kinematics analyses using an infrared reflective bead tracking system (Polaris, Northern Digital) polling at 60 Hz. Hand velocity was computed from the recorded position of the bead, which was taped to the monkey’s reaching hand.

Offline decoders

2 We used a Kalman filter to estimate the 2D hand velocity (vt ∈ R ) from the spike events (yt ∈ N {0, 1} , N is number of electrodes), vt = f(yt). In all analyses, decoders were 10-fold cross validated on each day (total 0f 100 decoders per user) and their quality was measured with R2 (r-squared) compared to the true hand (monkeys) or cursor (human) velocity.

Spike error rate (SER) simulation

To extract neural spiking activity using the Blackrock system, a 250 Hz high-pass filter was applied to the raw signal. Then, a spike was detected whenever the voltage crossed below a threshold set at CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 85

4.5 rms voltage. This threshold value was updated every session. The spike detector used a window of 1 millisecond, and multiple spikes were accumulated in non-overlapping 60 Hz bins in order to align to hand velocity recordings. Spike errors were simulated by randomly flipping the binary signal samples yt with the defined error rate (Fig. 4.2(a)).

Neural interface parameter simulation

To simulate a neural interface with a set of new parameters, we degraded the raw signals (recording system output signal - 16 bits at 30kSps) with a series of manipulations, as described in the main text. Then, we detected the spikes from this manipulated raw signal and estimated the hand velocity using the decoders as described earlier (Fig. 4.7). Here, the raw signal emulates a continuous time (CT) signal to be processed by our recording system. This is equivalent to a real CT analysis, since the sampling rate of our recording system is well-below the sampling rate of the raw signal.

Input-referred noise: to simulate higher input-referred noise (vin,rms), we added Gaussian noise 2 with variance of σnoise to the raw signal.

Bandpass: to simulate the analog front end (AFE) filter, we filtered the signal between f0 and nd f1 (the cutoff frequencies of the filter) with a 2 order Butterworth filter.

Sampling: the output of the bandpass filter was sampled at fs = 3f1, for allocating some oversampling above the Nyquist limit and relaxing the bandpass filter performances. This choice is commonly adopted to relax the filter roll-off requirements and avoid aliasing issues. Optimizing the ratio fs can be investigated in future work. f1 Quantization: the sampled signal was re-quantized at B bits. Threshold crossing detection: threshold detection was applied every millisecond (in a causal 30 samples window) to detect the presence of a putative neural spike. The threshold was set to be proportional to the estimated raw signal rms (root mean square) for each electrode

e e Vthreshold = n × Vrms where e is the electrode’s number. The number of rms (n) was optimized (in the range of -6 to -1 using increments of 0.5) for all the electrodes, for each set of parameters - see Fig. 4.11 for best nRMS distribution across parameters sets. The Blackrock systems built-in function was used for calculating the rms voltage of the noise, which is slightly different than the standard rms calculation [34]. Specifically, the BlackRock algorithm calculates a biased estimate of the rms with an aim to exclude spikes and artifacts that inflate the rms. First, the algorithm computes mean squares of each of 100 non-overlapping bins (xj) of 600 continuous samples (20 ms) of the raw data (si), with total of 60,000 samples (2 sec):

600 1 X x = s2, 1 ≤ j ≤ 100 j 600 i i=1 CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 86

Figure 4.7: Neural interface parameter simulation signal processing pipeline.

th Then, the rms is calculated by averaging the 6 until the 25 lowest xj values (20 out 100 values):

v u 25 u 1 X rms =t min x 20 i i=6

minix is the ith minimum value of x. Spike binning: the resulted binary signal was binned in 60 Hz non-overlapping bins aligned to hand velocity recordings.

Statistical Testing

When comparing two different distributions of R2, we used two-sided Wilcoxon rank-sum test with a confidence level of p = 0.05 unless stated otherwise.

ADC Power Model

To study the effect of resolution on the ADC energy, we considered a model of a successive ap- proximation register (SAR) ADC, [144], shown in Fig. 4.8. The model assumes that the three main sources of power consumption are the capacitive DAC, the comparator and the logic. Also, it assumes that the comparator, the sampling capacitor and the quantization process, each contribute a third of the total noise. From these assumptions, we can derive the minimum energy required to resepect the SNR specifications for each component. Capacitive DAC : the input is sampled by the capacitive DAC, hence the minimum capacitance must satisfy: 2 2 1  Vinpp  2 2 SNR = (4.3) 3 kT CDAC where Vinpp is the peak-to-peak input voltage, k is the Boltzmann constant, T is the temperature, B CDAC = 2 CU is the total DAC capacitance, and CU is the unit capacitance. As a result, the CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 87

minimum unit capacitance becomes:

24kT SNR CU = − B 2 + CU,min (4.4) 2 Vinpp where CU,min is the minimum realizable capacitance allowed by the technology (usually [0.1 - 1] fF). The total energy depends on the switching activity of the DAC. The solution in [95] grants:

B−1 X B−3−2i i 2 EDAC = 2 (2 − 1)CU VREF (4.5) i=1 where B is the number of bits of the ADC, and VREF is the reference voltage. Comparator: here, a simple latch model is used for the comparator and the noise is simplified kT to , where CC is the load capacitance of the latch. For a more complete analysis, the reader can CC refer to [187]. Similar to the capacitive DAC, the minimum load capacitance for the latch can be derived as: 24kT SNR CC = 2 + CC,min (4.6) Vinpp where CC,min is the minimum load capacitance available (usually [1 - 10] fF). The total energy then becomes 2 Ecomp = (CC VDD)B (4.7) where VDD is the supply voltage of the comparator. Logic: for simplicity, we assume that the logic complexity depends linearly on the number of bits. The total energy then becomes:

Elogic = NBEGB (4.8)

where NB is the number of gates required per bit, and EG is the energy per gate. The total energy, and contributions from each block are plotted in Fig. 4.8 as a function of SNR. Reference points from literature are also plotted in figure, [96, 82, 27, 145]. For low SNR, the conversion energy is dominated by the logic. For high SNR, the conversion energy is dominated by the comparator and increases 4x per bit, [162].

Here, we assume that power is a linear function of the sampling frequency, fs, which is a realistic assumption for sampling frequencies well below the transit frequency of the technology. Hence,

PADC = fs(EDAC + Ecomp + Elogic) (4.9)

4.8.2 Supplementary figures CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 88

10-8 Logic DAC Comp [Chandrakumar, ISSCC18] Total -10 10 [Gao, JSSC12]

[Mendrela, JSSC16] Vin CDAC -12 10 [Harpe, JSSC16] Energy [J]

10-14 Logic 4x per bit 10-16 20 30 40 50 60 70 80 90 SNR [dB]

Figure 4.8: SAR ADC model and conversion energy as a function of signal-to-noise ratio (SNR). The following parameters, reasonable for a 65 nm CMOS technology, were chosen for this model: Vinpp = VDD = VREF = 1 V, ENOB = B - 0.5, CU,min = 0.5 fF, CC,min = 5 fF, NB = 8 gates/bit, EG = 3 fJ/gate.

Figure 4.9: Electrode mean firing rate distributions. Thresholds were set to -4.5 × RMS (see Threshold crossing detection Methods section for more details). CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 89

Figure 4.10: Study of iBCI performance as a function of the neural interface parameters. (top row) 2 R as a function of f0 and f1. The rms multiple (n), which determines the threshold, was optimized for each frequency band separately. The marker ’o’ represents the frequency band with maximum performance, ’x’ represent frequency bands that resulted in significantly lower performance than the best frequency band (two sided Wilcoxon rank-sum test, p¡0.05). R2 (mean ± s.e.) as a function of number of bits (middle row), and standard deviation of added noise (bottom row) for selected bandwidth. Horizontal lines represent significant differences (two sided Wilcoxon rank-sum test, p¡0.05) compared to best R2. Note: T5 has a slightly higher robustness to parameters change (e.g., bandpass filtering and added noise) compared to the monkeys. We attribute this to the smoother kinematic produced by the iBCI, which are easier to estimate compared to the monkeys’ hand control kinematics (see Methods section for more details). CHAPTER 4. INTRACORTICAL NEURAL INTERFACE DESIGN OPPORTUNITIES 90

Figure 4.11: Optimal threshold RMS-multiplier (n) distribution across 10-folds and 10 days of each user - Vthreshold = n × Vrms (see Methods section for more details). Black dots represent the mean (µ). Chapter 5

Structure and variability of delay activity in premotor cortex

5.1 Summary

In this chapter, we investigate the neural activity before the movement initiation to guide future iBCI user interfaces. Voluntary movements are widely considered to be planned before they are executed. Recent studies have hypothesized that neural activity in the motor cortex during preparation acts as an ‘initial condition’ which seeds the proceeding neural dynamics. Here, we studied these initial conditions in detail by investigating 1) the organization of neural states for different reaches and 2) the variance of these neural states from trial to trial. We examined population-level responses in macaque premotor cortex (PMd) during the preparatory stage of an instructed delayed center-out reaching task with dense target configurations. We found that after target onset the neural activity on single trials converges to neural states that have a clear low-dimensional structure which is organized by both the reach endpoint and maximum speed of the following reach. Further, we found that variability of the neural states during preparation resembles the spatial variability of reaches made in the absence of visual feedback: there is less variability in direction than distance in neural state space. We also used offline decoding to understand the implications of this neural population structure for brain-machine interfaces (BMIs). We found that decoding of angle between reaches is dependent on reach distance, while decoding of arc-length is independent. Thus, it might be more appropriate to quantify decoding performance for discrete BMIs by using arc-length between reach end-points rather than the angle between them. Lastly, we show that in contrast to the common notion that direction can better be decoded than distance, their decoding capabilities are comparable. These results provide new insight into the dynamical neural processes that underline motor control and can inform the design of BMIs.

91 CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 92

5.2 Introduction

A central issue in the study of motor preparation has been identifying which aspects of a movement are specified prior to execution and how precisely these aspects are encoded [191, 53, 246]. Decades of research have addressed this question with a variety of approaches. Many studies have carefully ana- lyzed aspects of movement execution as a proxy for the preparatory process, for example measuring changes in reaction time to estimate the time it takes to specify different parameters during prepara- tion [191], measuring error patterns in movements made to memorized targets [219, 18, 94, 146, 147], or assessing the necessity of preparation in forming motor memories [209]. A potential limitation of using behavioral metrics to measure the preparatory process is the difficulty in delineating which aspects of behavior are related to solely preparation versus movement execution itself [147]. Another prevalent approach for studying motor preparation has been to record neural activity in the motor cortex prior to movement execution. Several studies on the neural basis of preparation have used an ‘instructed-delay paradigm’, where a short delay period separates the movement instruction from execution. By determining which aspects of movement are encoded in neural activity during the delay period, the key factors that constitute the preparation process can be inferred. Several studies have shown that the activity of individual neurons in primary motor cortex (M1) and dorsal premotor cortex (PMd) during the delay period correlates with reach direction and distance [232, 189, 133, 79, 148, 46, 38], reaction time (the elapsed time between movement instruction and movement onset [13, 39]), maximum speed [38], location of the reach target in visual space [210], target location relative to the eye and hand [14], and many other aspects of the reach. While single-neuron studies have been instrumental in identifying several response properties in delay activity, they also have several limitations (see [54] for review). Most critically, recording neurons one-by-one precludes understanding how neurons covary with one another trial-by-trial, a crucial feature of how neural populations encode information [50]. Over the past two decades, advances in recording technology have enabled the study of pop- ulations of simultaneously recorded neurons [40]. Population-level analyses have yielded several advances in the characterization of delay activity, including relating single-trial population activity to reaction time [3], relating responses during the delay to responses during movement execution [122, 60], and assessing the necessity of the preparatory state [5]. One viewpoint that has emerged from the study of population-level delay activity is the ‘initial condition hypothesis’ of motor prepa- ration, which posits that delay activity sets a preparatory state which seeds movement-related dy- namics [39, 37, 3, 36]. While the dynamics of population activity during movement have been studied extensively [36, 213, 60, 192], the structure of the neural states that seed these dynamics has not been fully characterized. In this chapter, we seek to understand how the structure and variability of population activity during motor preparation give rise to the upcoming movement. To shed light on this issue, we used multielectrode array recordings from monkeys during an instructed-delay reaching task with a CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 93

dense target configuration. We first characterized the low-dimensional structure of neural activity in PMd during the delay period and how this structure is related to the upcoming reach. Then, we investigated the single-trial variability of that structure and found that it resembles the behavioral variability found in previous studies [94, 146]. Last, we assessed the implication of the neural structure and variability on decoding reach endpoint for brain-machine interfaces.

5.3 Materials and methods

Ethics Statement

All procedures and experiments were approved by the Stanford University Institutional Animal Care and Use Committee. To minimize any potential suffering surgeries were performed under isoflurane anesthesia with carefully monitored post-operative analgesia.

5.3.1 Experimental design

In this study, we analyzed neural activity from an instructed delayed reaching task (Fig. 5.1). We trained two monkeys (J and R) to perform center-out-and-back reaches on four different target configurations. In all configurations the target acceptance window was a 2 cm box centered on the target location and the required hold time was 500 ms. Delays ranged from 300 to 700 ms for J and 400 to 900 ms for R. Subjects failed the trial if it took longer than 5 seconds to reach the target. Each configuration included a high target count to enable accurate quantification of our ability to predict movement endpoint and to have a reach sample of the neural states. When comparing two different distributions, we used a two-sided Student t-test (assuming un- equal variances) with a confidence level of p = 0.05 unless otherwise indicated. In figures, we denote ∗ for p ≤ 0.05, ∗∗ for p ≤ 0.01, ∗ ∗ ∗ for p ≤ 0.001 and ∗ ∗ ∗∗ for p ≤ 0.0001; n.s. indicates no significant difference. All target configurations are presented in Figure 5.1b. The first target configuration (‘ring’ configuration) varied only in direction; targets were evenly spaced in a circular formation with a radius of 8 cm (24 targets for J, 36 for R; 6161 trials for J, 3577 for R). The ‘horizontal’ and ‘line’ configurations varied distances and direction; 24 targets were arranged in a line with 12 targets both sides of the center spaced 1 cm apart (5017/6110 horizontal/vertical trials for J, 3699/4040 trials for R). The ‘3-rings’ configuration also varied both in direction and in distance, but with more directions and fewer distances (7722 for J, 912 for R); targets were arranged in three concentric rings with radii of 4, 8, and 12 cm, each with 16 targets. We analyzed neural activity prior to the center-out portion of the reach, and restricted our analyses to only successful trials. CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 94

a center target delay go cue reach acquire acquire

J: 300 - 700 ms 500 ms R: 400 - 900 ms b Ring Horizontal Vertical 3-rings

8

y (cm) 0

−8

−8 0 8 −8 0 8 −8 0 8 −8 0 8 x (cm) x (cm) x (cm) x (cm)

Figure 5.1: Task timeline and target layouts. (a) Experimental setup and timeline of standard instructed-delay reach trial. (b) Positions of all targets for four target configurations: ring (24 targets for J; 36 for R, not shown), horizontal line (12 targets), vertical line (12 targets) and 3-rings configuration (48 total targets in 3 rings of 16 targets each); only one target is presented to the monkey per trial. Color scheme used for reference in later figures.

Neural recording and signal preprocessing

Monkeys J and R were each implanted with two 96-electrodes Utah arrays (Blackrock Microsystems, Inc.), using standard neurosurgical techniques [90] 74 (J) and 64 (R) months prior to this study. The multiunit arrays were implanted into the left cortical hemisphere in the dorsal premotor cortex (PMd) and primary motor cortex (M1) as estimated visually from local anatomical landmarks. At the time of the study, monkey R’s M1 array was defective; consequently, in our analyses, we only used the recordings from PMd for both monkeys. Voltage signals from each of the electrodes were bandpass filtered from 250 to 7500 Hz. A spike was then detected whenever the voltage crossed below a threshold set at the beginning of each day (at −4.5 and −4.0 x RMS voltage for J and R, respectively). Contralateral hand position was measured with an infrared reflective bead tracking system (Polaris, Northern Digital) polling at 60 frames/s. All analyses were performed offline after data collection. Threshold crossings recorded on the array’s 96 electrode were binned during the 200 ms prior to the go cue. CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 95

5.3.2 Dimensionality reduction

We used principal components analysis (PCA), an unsupervised technique, to reduce the dimension- ality of our recordings. Following preprocessing and averaging firing rate in a 200 ms time window before go cue, we averaged the data across all trials within each condition, yielding a matrix of size n × c, where n is the number of units and c is the number of reach conditions (i.e. targets) across all tasks (J:120, R:132). We first mean-centered each channel for each day of recording to account for differences in baseline activity, then mean-centered the data across all conditions such that every row had a mean value of zero. We then used PCA to find a reduced-dimensional version of the original data which retained a large percentage of the variance of the original data. We kept the top 3 principal components in an effort to select only dimensions with high explained variance. After reducing dimensionality with PCA, we rotated and scaled (using regression) the principal components to find the subspace that best explains the x and y position of the target. Additionally, we found a projection that best explains the max speed of the reach. For the speed projection, we regressed directly from the neural activity rather than the PCs because the PCs were derived using condition averages of the neural data, and thus averaged over information related to speed. The parameters of the linear mapping for each variable (x, y and speed) were constrained to be orthogonal to one another.

Classification with Support Vector Machines (SVMs)

For classification, we used support vector machines (SVMs). SVMs are classifiers that construct a separating hyperplane between the two classes making a decision boundary with the greatest distance between the boundary and the data points. Multiclass classification was handled with one-vs-one classification. We used the scikit learn library implementations of SVMs [181]. After an extensive hyperparameter sweep, we found the best kernel for the SVM to be a radial-basis function. All reported classification accuracies are the mean accuracy across 10-fold cross validation, and errors are the standard error of the mean (SEM) across folds.

5.4 Results

5.4.1 Structure of neural activity during delay period

To study the structure of delay activity in PMd across different reaching conditions, we represented population responses during the delay period of a trial (the average activity in the last 200 ms) as a point in the 96-dimensional neural state space. We used PCA on the combined datasets (tasks and sessions) to identify primary patterns of activity in an unsupervised fashion. Projecting the condition-averaged neural activity to the first 3 PCs revealed a clear 3D structure between neural states for different reaches (Figure 5.2a). In one plane the condition-average neural states appeared CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 96

x a b monkey J monkey R neural 100 yneural

50

PC3 explained variance (%)

PC2 PC1 1 2 3 1 2 3 PC PC c

neural 8.0

eed

p 7.5

s 7.0 x yneural neural 6.5

6.0

5.5 distance from mean state at end of delay (a.u.) 0 50 100 150 200 250 300 350 400 time from start of delay (ms) d neural state position of e monkey J monkey R max speed 12 12 10 10 8 8 6 6 4 4 distance (cm) mean neural state at end mean position 0.0 5.0 10.0 15.0 0.0 5.0 10.0 15.0 of delay of max speed max speed (cm/s) max speed (cm/s)

7.4 9.0 on-axis f deviation on-axis n.s. off-axis deviation 8.5 deviation off-axis deviation 7.0 yneural y 8.0 n.s. 12 ee d (cm/s) p

x s neural x 7.5 6.6 n.s. ee d (cm/s) mean neural p s center of max n.s. state pre-delay task space n.s. 7.0

max 0 25 speedneural 6.2 6.5 0 4 8 12 0 4 8 12 target distance (cm) target distance (cm)

Figure 5.2: Structure of delay activity and relation to behavior. (a) Projection of condition-averaged delay activity onto top 3 PCs (top row) and xneural, yneural and speedneural (bottom row) dimensions for the horizontal line (left column) and 3-rings (right column) target configurations for monkey J. Bottom gray square shows 2D projection onto the xneural, yneural plane. (b) Explained variance of xneural and yneural dimensions by each of first 3 principal components. (c) Time course of the neural state in the spatial plane (Monkey J). Blue line shows average distance of the neural state from the converged delay state. Projections onto the spatial plane throughout the time course are shown above. (d) Single-trial neural state correlates with initial reach kinematics. Right shows 3-trial- averaged x, y position of maximum speed for reaches to one target. Trials where position of maximum speed falls within bottom-left quadrant of on/off axes are opaque. Left shows corresponding neural states for those reaches where the same trials are opaque as on right; these neural states tend to fall within same quadrant. (e) Each density shows the distribution of maximum speeds for reaches to a given distance in vertical configuration; reach distance correlates with max speed but there is variability of speed within each distance. (f) speedneural component of neural state is correlated with max speed for reaches to same distance (data combined across horizontal and vertical configurations). Regression was fit for each reach distance separately, confirming that this axis encodes speed independent of distance. CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 97

to be organized by their target position, and in an orthogonal dimension by the distance of the upcoming reach. While previous studies provided evidence for directional organization of the neural state [196, 60, 240], the rich and dense targets configurations reveal a more detailed and accurate structure of the neural activity. Visualizing the condition averaged neural state gives us an intuition about the primary organization of delay activity, but it is not immediately clear what the dimensions correspond to: in particular, we cannot infer from the condition averages alone whether the structure is related to task/visual parameters (e.g. location or distance of the target) or a plan for the upcoming movement (reach endpoint, speed). In the following section, we show that the neural state on single trials correlates with aspects of the upcoming reach, suggesting that the structure is related to parameters of the movement. To orient the structure with respect to the target position and distance, we defined a set of axes which correspond to these variables (Figure 5.2a). To define the ‘spatial plane’ (Figure 5.2a - gray plane) which reflects the x, y position of the target, we used linear regression on the first 3 PCs (see

Methods) to yield two orthogonal axes, xneural, and yneural. Thus, xneural, and yneural are each just a linear combination of the first 3 PCs (Figure 5.2b). The spatial plane captures a large percentage of the overall variance of the trial-averaged neural responses for the ring, horizontal, vertical, and 3-rings tasks: 66.8%, 64.4%, 47.7%, and 68.2% (monkey J), 33.7%, 30.7%, 31.0%, 30.1% (monkey R) for each task, respectively. Interestingly, at target onset, the projection of neural states on to this plane start at the center of this plane, start to diverge after 50 ms (R: 75 ms), and converges to steady neural states shown in at after 300 ms (R: 400ms) (Figure 5.2c). It is worth noting that reach direction and distance are encoded together as x, y coordinates, rather than in orthogonal subspaces. This joint encoding was not simply a consequence of the method of constructing this subspace (regressing to x, y); even when the population activity is regressed only to a unit vector in the target direction (without distance information), the resulting neural states are structured nearly identically to the structure in Figure 5.2. To show that the neural state on the spatial plane is predictive of behavior of the upcoming reach and is not merely a result of the visual stimuli, we looked at the neural state on individual trials. The radial position of the single-trial delay state has previously been shown to predict initial reach direction [240]. Here, we test if the neural state in the spatial plane is predictive of the reach endpoint position. Since the monkeys were able to see the location of their arm throughout the reach, corrective motions made after movement onset could change the location of the actual endpoint relative to the planned endpoint. Previous work demonstrated that the spatial position of maximum speed is predictive of reach endpoint in the absence of visual feedback [147], so we measured maximum-speed position as a proxy for the planned reach endpoint. To examine the single-trial relationship between the neural state and the spatial position of maximum speed, we compared the deviations in the neural state space to deviations in task space. By deviations, we mean the displacement of a trial from their condition average: the average neural state or the CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 98

average position of maximum speed for reaches to a given target. To disambiguate deviations in distance from deviations in direction, we decomposed the deviations into two components: ‘on-axis’ deviations, which measures variation in distance, and ‘off-axis’ deviations, which measure variation in directions [94, 146]. Both on-axis (p = 1e-3 for J, 4e-3 for R) and off-axis (p = 4e-4 for J, 2e-4 for R) deviations in the neural state were positively correlated with on-axis and off-axis deviations in the position of max-velocity for both monkeys. Thus, the neural state in the spatial plane is predictive of the maximum-speed position (and the planned end-point position) of the upcoming reach. Next, we investigated the third dimension, on which the neural states are organized based on the (absolute) target distance. During natural reaches, reach distance and maximum speed are known to be highly correlated [6, 94]; thus, it is unclear from the structure seen in the condition- averaged neural states whether this third dimension encodes target distance or reach speed. We resolved this ambiguity by looking at single-trials along this dimension. Despite the correlation between speed and target distance, there is variability of maximum speed across trials within the same target distance (Figure 5.2d), so if the dimension reflects speed, the neural state on single trials should covary with different speeds to the same target. We first defined the dimension in a similar manner to the spatial plane, by regressing to target distance. Surprisingly, we found a significant linear relationship between the neural dimension and the maximum speed for some reach distances (J: 6/12 distances in the vertical and horizontal tasks, R: 3/12, p < 0.05), suggesting that the dimension shows some variation with speed. However, this 1-D neural dimension was constructed through a PCA on condition-average neural activity, which averaged out neural activity related to maximum speed. To find the neural dimension ‘speedneural’ that best captures speed variability, we used single-trials to regress between the high-dimensional neural state and the trial maximum speed. We again tested whether the projection on this dimension varied with speed, and found that for most distances it did (J: 9/12 distances in the vertical and horizontal tasks, R: 10/12, p < 0.05), confirming that this axis encodes speed independently of distance (Figure 5.2f). We note that this test was possible without instructing slow/fast reach conditions as in Churchland et al. [38] because of the simultaneous recording of many neurons afforded us the statistical power to estimate speed from neural activity. However, due to the lack of reach-speed conditions, we cannot report the percentage of variance this dimension captures for condition-averaged neural states (as we did for the spatial plane). This dimension explains J: 2%, R: 1% of the variance in the neural state across all trials; for reference, the spatial plane explains J: 20%, R: 10% for single trials, lower than the condition averaged due to within-condition variability.

5.4.2 Neural state variability during delay

Previous behavioral studies have provided detailed quantification of the variability of motor prepara- tion by using reaches made in the absence of visual feedback as a proxy for the prepared movement CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 99

a b c ) %

10 ( 160

140 on-axis

2.0 ud e t off-axis ud e

5 t 120 gn i a

gn i 1.5 100 a m

m monkey n

0 80 neural o i n t y

J o 1.0 i a

t 60 a ev i

−5 d 40

ev i 0.5 d

ve 20 i t a 0.0 l 0 e

−10 −5 0 5 10 0 2 4 6 8 10 12 r 0 2 4 6 8 10 12 xneural reach distance reach distance

d e f ) %

8 ( 140

2.0 6 120 ud e t ud e

4 t 100 1.5 gn i a

2 gn i a m monkey 80 m n

0 neural o i n 1.0 t R y 60 o i a

−2 t a

ev i 40

−4 d

ev i 0.5

d 20 −6 ve i t a −8 0.0 l 0 e

−8 −6 −4 −2 0 2 4 6 8 0 2 4 6 8 10 12 r 0 2 4 6 8 10 12

xneural reach distance reach distance

Figure 5.3: Variance of neural state in spatial dimensions. (a) Equal frequency ellipses for the distributions neural states for each target in the 3-ring task (monkey J). The major axis of each ellipses is the direction of maximal variance in the distribution. The ellipses axes were scaled to capture 95% of the data then scaled down by a factor of 6 for visual clarity; the orientation and relative lengths of the axes are preserved. (b) Mean absolute values of on and off-axis deviations as a function of reach distance; data taken from all tasks (monkey J). (c) Same as panel b, but vertical axis is expressed as a percentage of the reach distance. (monkey J). (d) Equal frequency ellipses for the distributions of neural states for each target in both the horizontal and vertical tasks (monkey R). e, f Same as b, c but for monkey R.

[94, 146]. Their main findings were that the variability ‘on-axis’ (distance) was larger than ‘off- axis’ (direction), and the two variabilities scaled with distance (but the proportion to the distance decreases). In the previous section, we established the structure of delay activity and showed its connection to the upcoming movement parameters on single trials. In the present study, we can observe the trial-by-trial neural state during preparation directly, and measure variance within the spatial plane described in the previous section. In the following section, we perform analyses parallel to those studies in the neural space, to see whether the properties of preparation variability observed behaviorally are also observed in delay activity. We characterized ‘spatial’ distributions in neural state space in a similar manner to how [94] and [146] measure endpoint distributions. First, we used PCA to determine the axis of maximal variance for each reach condition. We visualized the distribution for each condition as an ellipse whose major and minor axes correspond to the first and second principal components, respectively; distributions CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 100

for the 3-ring task are shown in Figure 5.3a. The axes of the ellipses are scaled relative such that, on average, 95% of the neural states fall within the ellipse. Much like the endpoint distributions of reaches made in the absence of visual feedback in previous behavioral studies [94, 146, 147], we found that the ellipses for most conditions were oriented in the direction of the mean neural state from the origin. To quantify the difference in distance and direction variability, we decomposed the deviations of single trials into their ‘on-axis’ (distance) and ‘off-axis’ (direction) components (as in the previous section) and calculated the overall variance of these components separately. The mean absolute on-axis deviation for each target and for each monkey was systematically greater than the mean absolute off-axis deviations in the tasks (p = 9e-7 (ring), 4e-7 (horizontal), 1e-8 (vertical), and 3e-14 (3-rings) for J, 8e-3, 4e-7, 2e-7, 0.19 for R). We did not observe a significant result in monkey R 3-ring task likely due to the significantly smaller trial count. In sum, deviations in distance were larger than deviations in direction. Gordon et al. [94] and Messier and Kalaska [146] also analyzed the influence of movement distance on variability in both direction and distance. We performed similar analyses by testing whether on-axis and off-axis deviations in the neural state were affected by reach distance. Specifically, we found that deviations in both distance and direction in the neural state increased in absolute value as a function of reach distance (5.3b,e). While this increase is significant, it is small in magnitude: the regression equations for the on-axis and off-axis deviations (D) as a function of distance (r) are: Don = 0.115r + 1.56, p < 1e−4; Doff = 0.0634r + 1.46, p < 1e−4 for monkey J, and Don = 0.266r + 0.831, p < 1e−4; Doff = 0.097r + 1.12, p < 1e−4 for monkey R. While these deviations increased in absolute value, they decrease when expressed in proportion to reach distance (5.3c,f). Both of these findings are consistent with what was observed in the referenced behavioral studies [94, 146].

5.4.3 Accuracy of endpoint prediction from delay activity

Information in PMd can be utilized for discrete brain-machine interfaces (BMIs), which use neural activity to classify the most likely movement endpoint from a discrete set of possible endpoints (e.g. [164, 195, 211]). We sought to understand what implications our findings have on the accuracy of decoding reach endpoint from delay activity. Most studies describe distance and direction as the main two factors that are prepared for the upcoming reach. Previous single neuron studies have suggested that neurons have weaker tuning for distance compared to direction [38, 148]. Following this observation, BMI studies have typically used radial target layouts to maximize correct predic- tions (and communication rate, e.g. [195]). Indeed, when we compared the classification accuracies for classifying the ring and horizontal/vertical dataset (using SVMs - see Methods), direction was J:32.2% ± 0.6% for 24 targets (R:16% ± .5% for 36 targets) accuracy while distance classification for only 12 targets was lower for J (18.9% ± .1%) and comparable for R (21.4% ± .2% for R). However, our results on the structure and variance of delay activity imply that measuring decoding accuracy CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 101

for direction and distance separately may be misguided; for example, from Figure 5.3a it seems that distinguishing between two targets with the same angular separation would be easier when they are further away from the center. Indeed, classifying direction yields higher classification accuracy at further distances; when classifying target in 3-rings separately for each distance, accuracy increases with ring distance (23%, 36%, 43% for J; 22%, 28%, 29% for R). The results suggest that quantify- ing decoding performance in terms of direction and distance might be misleading, as classification accuracy for direction decoding varies with distance. Two factors without interaction would be a better choice from a decoding point of view and can be useful for designing decoders or target interfaces. Surprisingly, we found that quantifying directional decoding performance in terms of the arc-length error provides a measure that is independent of target distance. To show this, we first quantified decoding performance in terms of classifier errors rather than overall accuracy (Figure 5.4a and b show confusion matrices and error distributions for direction/distance decoding, respectively). The distribution of errors gives a more complete description of the classifier’s performance than overall accuracy and is less sensitive to the total number of targets. When presenting the decoding accuracy in term of angular error, mean error decreases as a function target distance (Figure 5.4c). In contrast, when presenting the errors as arc- length (scaling the angle based on the radius), the arc-length error distributions are not significantly different (F test; p > .05 for both J and R), i.e. the arc-length errors are distance independent. Thus, arc-length provides a measure of decoder performance that is independent of distance. Another benefit of presenting the directional decoding accuracy as arc-length is that it has the same unit as distance (i.e., cm) permitting direct comparison between the two. We plotted the mean error from the distance classification in Figure 5.4d. Surprsingly we found that the mean classification error for distance classification was significantly (albeit only slightly) lower than the errors for directional classification. In contrast to previous claims [195], this result suggests that decoding distance from delay activity is at least as accurate as decoding direction. This is surprising given the difference in variance between distance and direction in Figure 5.3, but may be explained by the presence of information related to speed during preparation [38] which is correlated with distance during natural reaches [6, 94]. To test this, we projected the delay activity to the spatial plane (Figure 5.2) prior to classification to remove speed information. The resulting classification error rate is significantly greater than classification using the full dimensional neural activity (p < .05 for J and R), and is not significantly different than the directional classification errors (p > .05 for each distance in J and R). CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 102

a b

1.0 1.0

0.5 0.5 )

0.8 0.8 )

ee s 0.4 m

r -90 0.4 c g ( s s

l l e e d a a ( 0.3 c

0.3 n tr i tr i 0.6 e 0 0.6

a 6 f f t s o o i ng l

0.2 d a 0.2

n n e e o 90 o i i u u t t r 0.4 r 0.1 0.4 c c T T 0.1 a a r r F 180 0.0 F 12 -90 0 90 180 0.0 0.2 0.2 6 12 Predicted angle (degrees) Predicted distance (cm)

0.0 0.0 0 50 100 150 200 0 2 4 6 8 10 12 Error magnitude (degrees) Error magnitude (cm) c d 1.0 1.0

0.8 0.8 s s l l ) 40 a a 3 ) tr i tr i

ee s f f m 0.6 r 0.6 c o o g

30 (

e n n r

d 2 o o ( i i

t t rr o r c 20 c e a a

r 0.4 r 0.4 rr o F F e 1

10 ea n M 0.2 ea n 0.2 M 0 0 4 8 12 4 8 12 full-d spatial Target distance (cm) Target distance (cm) plane 0 40 80 120 160 0 10 20 30 40 Angular error magnitude (degrees) Arc-length error magnitude (cm)

Figure 5.4: Quantifying endpoint information content in motor preparatory activity, Monkey J. (a) Direction classification (8 cm ring of 24 targets ‘ring’ task). Histogram of residual angles (absolute angle difference between true and predicted direction). Line shows cumulative total fraction of classified trials. Inset shows confusion matrix for classification. (b) Distance classification. Data from horizontal and vertical target configurations. Both target arrangements have 12 targets on two sides of center (up/down or left/right), but the classifier was trained and tested on only one direction at a time; the results are aggregated across directions. Results are shown as in a.(c) Cumulative distribution of angle errors for direction classification (16 targets) at 3 distances. Inset shows mean angle error. (d) Same as e, but error is reported in arc-length instead of angle. Inset shows mean arc error; for the 8 and 12 cm rings, this mean was computed using only errors within the range of possible errors for the 4 cm ring. Left blue bar shows mean error in distance classification (i.e. the mean of the errors in b); right blue bar shows mean error in distance classification when neural data is projected to spatial plane before classification. 5.5 Discussion

5.5.1 Does delay activity represent kinematic variables?

Reaching to a visual target necessarily involves a series of visuomotor transformations beginning in the coordinate system of the retina and resulting in an appropriate motor response. The details of CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 103

when and where visual information is transformed into abstract kinematics, action selection, and movement specification have yet to be settled. Several observations have been consistent with PMd encoding ‘high-level’ aspects of reaching not directly related to movement specification: neurons in PMd respond selectively for the location of the target in visual space [210], correlate with upcoming reaches with the ipsilateral arm [41], and represent movement in a variety of reference frames [14]. Other studies have shown that PMd activity during movement changes when reach kinematics are fixed but muscle activity differs, suggesting that neurons in PMd support ‘low-level’ movement specification [202]. While we describe population activity with reference to kinematic variables, it is not the aim of our study to provide evidence for whether PMd encodes abstract kinematics or muscle-like com- mands. Instead, the primary goal of this work is to determine the structure of population-level delay activity; we use the language of abstract kinematic variables (x, y position of reach endpoint and maximum speed) to describe the subspace of delay activity, but we note that these abstract variables are correlated with lower-level aspects of movement [165, 193]. To better assess whether the struc- ture observed in delay activity more strongly resembles abstract kinematics or muscle commands, future work could employ a similar strategy to Scott et al. [202] whereby subjects make reaches with similar kinematics (e.g. hand paths) but with different muscle forces (e.g. arm postures). If the population responses retain the structure in Figure 5.2a despite different muscle output, this would support the notion that delay activity encodes abstract kinematic variables. If, instead, the organi- zation changes or delay activity occupies a different subspace when movement specification changes, then delay activity is likely more related to the particular muscle activations or joint trajectories required for movement execution.

5.5.2 Independence of direction and distance

The issue of the independence between direction and distance in motor planning has long been the subject of debate in both behavioral and neurophysiological studies. In [94], it was argued that be- cause errors in direction and extent scaled differently with movement amplitude, the two parameters must be planned by two separate channels. [146] refined this claim by noting that the differential scaling was strongly dependent on experimental conditions (e.g. in some conditions they scaled sim- ilarly), but nonetheless concluded that the two parameters are planned independently because the magnitude of variable errors of direction and extent can be altered relatively independently by task conditions. Because these movements were made in the absence of visual feedback, it was concluded that this variability was a result of the planning process, suggesting that reach direction is planned independently of reach distance. Here, we have taken a different approach to answering this question by examining the information related to direction and distance in neural activity during planning. Our results suggest that distance and direction are not planned independently. There are two primary pieces of evidence to suggest CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 104

this. First, the structure of preparatory activity reflects the reach endpoint in Cartesian coordinates; in Cartesian coordinates, distance and direction and reflected in conjunction with one another, not separately. Secondly, we find that the distance of a target affects the accuracy with which we can estimate its direction. These results do not necessarily contradict the findings of [94, 146] for several reasons. Firstly, as shown in [146], the distribution of errors is strongly influenced by experimental conditions, and there were several substantial differences between the task setup for our study and that of [146] and [94]. Additionally, our subjects performed reaches in the vertical plane, whereas both [146] and [94] were reaches in the horizontal plane (though in [94] and one task from [146], visual feedback about the location in horizontal plane was translated to a display in the vertical plane). It is possible that direction and distance have a distinct relationship in the horizontal plane rather than the vertical. An additional difference is that our subjects always had visual feedback about the location of their hand and the target. Though it is not clear that visual feedback during movement affects preparatory activity, this could be the case; for example, knowing that feedback will be available during movement could influence the extent to which either the direction or distance are reflected during preparation. Our study is not the first to explore the relationship between distance and direction during preparation in neural activity. [148] showed that most PMd neurons that were modulated by reach distance were also modulated by direction, arguing that information related to distance tended to only be processed in conjunction with information about direction. This provided evidence for shared neural substrate for the processing of both distance and direction, but did not address whether they affected one another. Churchland et al. [38] showed that the preferred direction of neurons is sometimes affected by distance. While this study showed that particular encoding of direction in single neurons depends on distance, the effects at the population level do not follow (e.g. as they acknowledge, this dependence could have feasibly ‘canceled out’ in the population encoding.) In contrast to these studies, we used data from simultaneously recorded populations of neurons, which allowed us to study how distance and direction are reflected at the population level on a trial-by-trial basis. Importantly, even disregarding differences in experimental design, our findings are compatible with the notion that, at some point prior to movement, direction and distance become independent. In particular, our findings do not preclude the possibility that these parameters become independent at a later point in time (e.g. at movement onset) or that the translation of preparatory activity to muscle commands involves separating these parameters. Instead, our results should be regarded as elucidating aspects of preparation in PMd and M1 prior to movement onset. Future work should ex- plore the connection between how distance and direction are reflected in preparatory neural activity and the aforementioned behavioral findings. CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 105

5.5.3 Organization of initial conditions

The ‘initial condition hypothesis’ of motor preparation posits that the preparatory state seeds movement-related dynamics [39, 37, 3, 36]. One way to view the present work is as an exten- sion of the initial condition hypothesis: we describe how the initial conditions for different reaches are organized with respect to one another. The radial organization of neural states had been previ- ously reported in studies using center-out reaches that varied solely in direction [196, 60, 240]. By using target layouts that varied in both direction and distance, we observed further organization of the neural states by 1) the x, y location of the reach endpoint and 2) maximum speed. Though the organization of these initial conditions provides a signature of the dynamical system, further work should investigate the computational purpose of this organization. For example, future com- putational experiments could assess under which task conditions this structure is observed by e.g. training a recurrent neural network to perform similar tasks [142, 60, 192].

5.5.4 How does the neural space scale with task complexity?

In our work we sought to understand a simple 2D center-out reach task. We found that the main three parameters encoded in PMd during delay activity are x, y position of reach endpoint and maximum speed, which are a sufficient set of parameters to specify ballistic reach. In more complex tasks such as reaching in high dimensional space, reaching with obstacles, movement in a maze, or a sequence of reaches, a larger set of parameters are required to define the upcoming reach (such as the curvature or additional dimensions for the spatial subspace). In those tasks we might expect to reveal a neural state during the delay with more dimension than three during the delay period before movement [83].

5.5.5 Delay activity and motor preparation

We, and many others, have observed correlations between neural activity during the delay period and aspects of the subsequent reach. In particular, we have shown that neural states during the delay are predictive of the upcoming movement on single trials and that ‘spatial’ variability of these states is similar to the variability observed in behavioral studies in the absence of visual feedback [94, 146, 147]. The resemblance between the variability of the neural state and the variability of movement suggests that the movement variability is a consequence of the preparatory process rather than e.g. properties of movement execution. That said, our results do not provide a causal link between the delay state and the following movement; indeed, recent studies have questioned the necessity of delay activity for motor preparation [5]. To concretely demonstrate that movement execution is determined by neural activity during the delay, future studies could perturb delay activity along specific dimensions in the neural state (Figure 5.2a) and observe whether the following reach is similarly perturbed. CHAPTER 5. STRUCTURE AND VARIABILITY OF DELAY ACTIVITY IN PMD 106

5.5.6 Applications to brain-machine interfaces

Our results have the potential to aid the design of target-layouts for brain-machine interfaces (BMIs). BMIs are medical devices that can assist people with paralysis and improve their independence by using neural activity to restore communication or motor function. Discrete decoders, which use neural activity to classify the most likely movement endpoint from a discrete set of possible endpoints, show promising results for communication [211, 164, 195, 1]. The properties of delay activity explored in this work may be leveraged to improve target layouts for communication BMIs by better understanding the decoding capabilities of direction, distance and their interaction. In particular, in designing target layouts for use with BMIs, it is often the goal to maximize decoding accuracy by placing targets in such a way that the neural activity for reaches to different targets is maximally distinguishable [170]. Prior studies have evaluated the differences in decoding accuracy for reach speed versus reach direction from neural activity during execution, reaffirming the notion that direction is more easily decodable than speed [93]. Our results shows that direction and distance (which is correlated with speed) are decodable with comparable accuracy, suggesting that there may be differences in how decodable direction/distance are during movement versus preparation. In prior work on target-layout optimization for BMIs [52], gains in decoder performance were proposed by optimizing target placement based on the tuning properties scaled by distance of the recorded neurons. Based on our results, a model that also includes a separate distance term (which can be indirectly influenced from planned max velocity), in addition to the x, y location of the target, might increase decoding performance and better utilize a given workspace for communication. Future experiments with different target layouts could verify the optimal target layout.

5.6 Conclusion

In this chapter, we continue the line of work of early studies which explored how individual neurons directly encode aspects of an upcoming movement during preparation. Recent developments have proposed that the dynamics of populations of neurons underlie motor control, and that neural activity during preparation serves to set up these dynamics. While the dynamics of motor control have been studied extensively, several aspects of the preparatory activity remain unresolved. Here, we ask how the patterns of neural activity during preparation for different reaches are related to one another. From neural population recorded during task with dense target layout, we found that the neural activity during preparation for reaches has a clear ’structure’ in the neural space. Additionally, we assessed the implications of our findings for predicting upcoming movements from neural activity, as in brain-machine interfaces. Chapter 6

Efficient virtual keyboards for high-dimensional BCIs

6.1 Summary

Intracortical brain-computer interfaces (iBCIs) translate brain activity into useful control signal for a prostheses. They can be used as an assistive device for people with paralysis to control a robotic arm or a computer cursor. Current iBCI typing with virtual keyboards is reasonably slow and is done through a 2D computer cursor. Utilizing the high-dimensional controllability of iBCIs (3D position control and rotations) could be utilized to increase the typing rate. Here, we propose a method to design virtual keyboards in 3D visualizations that better utilizes iBCI capabilities of high-dimensional cursor control. The proposed method decrease average distance between keys by more than two fold. Typing with our proposed keyboards can, in theory, double typing rate which could bring iBCI users to a level of able-bodied smart-phone typing rate.

6.2 Introduction

People with paralysis use assistive technology to improve their independence and the ability to communicate. Communicating by typing can be assistive when the ability to speak is limited, and can also be used for entertainment or for work. Eye-tracking and head movements are common techniques for communication for people with physical or speech impairments. In clinical motor prosthesis applications, intracortical brain-computer interfaces (iBCIs) estimate the user’s intention from brain activity and use this ’decoded’ intention to guide the person’s own limb [21, 4] or an assistive device, such as a prosthetic arm [99, 43, 57] or a computer cursor [100, 179, 110, 9]. iBCIs have had promising results as an assistive device for typing by controlling a 2D computer cursor

107 CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 108

[110, 179, 9]. In those three approaches (head movement, eye-tracking and BCI), the common typing paradigm is using a cursor (or a pointer). In cursor typing, the user moves the cursor to the desired key on a virtual keyboard and selects it by dwelling on the key for a predefined period (e.g., a second) or ’clicking’ on the key with an additional action (e.g., imaging squeezing their hand when using a BCI)[117, 179]. Unfortunately, cursor typing is slower and prone to more errors compared to an able-bodied typing with 10-digits. Increasing the typing rate for people with paralysis can improve their independence and communication. The main reason for the slower typing rate (and lower information throughput) during cursor typing is the control of only 1-digit compared to ten simultaneous digits in conventional typing (with two hands). Recent studies have shown the ability to control a computer cursor with more than two degrees of freedom (DOF) in virtual reality (i.e., 3D visualization). While using the high-dimensional iBCI, the user was able to move the cursor also in depth (z-direction) and rotate it (around the z-axis), in addition to moving the cursor in a two-dimensional plane (2D, e.g., XY plane). Increasing the number of controlled dimension from 2D to 3D and even to 4D conveys higher information throughput since the cursor can move simultaneously in more dimensions. To utilize the high dimensional control for typing, a custom keyboard design is needed. Here, we present a novel keyboard design method that will utilize high dimensional cursor control to increase typing rate. When designing an efficient keyboard for a specific human-computer interface (e.g., smartphones, virtual keyboards, etc.) the main aim is to reduce the average reach time between key selections. Two complementary approaches can achieve this: efficient physical location of the keys in space and efficient labeling of the keys [140, 216]. For example, labeling puts the frequently used symbols (e.g., vowel) closer to each other at the center of the keyboard. This decreases the average reach distance and increases the typing rate. The other approach, which is in the heart of our work, is to place the keys efficiently in the workspace to decrease the average distance between them. Previous studies have shown the benefit of using an efficient virtual keyboard (e.g., OPTI-II) compared to a conventional keyboard (QWERTY) for iBCI users [169, 179]. Here, we present efficient designs of keyboards in 3D virtual reality for high dimensional cursor control that reduces the average distance between keys dramatically and can increase information throughput when typing with iBCIs.

6.3 Methods

6.3.1 Information throughput - Bitrate

Typing rate is measured in words or characters per minute, it does not take into account the keyboard design. Information throughput of an iBCI is commonly measured by bit-rate [117, 168, 179]:

log (N − 1) · max(S − E, 0) bitrate = 2 (6.1) T CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 109

where N is the number of targets on the screen, S is the number of selections, E is the number of errors, and T is the time elapsed. The floor of this value is 0 since bitrate cannot be less than zero. The bitrate equation can also be expressed as a function of the average distance between targets:

log (N − 1) · #T rials · max(s − e, 0) log (N − 1) bitrate = 2 = 2 · v¯ · max(1 − 2e, 0) (6.2) #T rials · d/¯ v¯ d¯ wherev ¯ and d¯ are the average velocity and distance of the reaches, and e ∈ [0, 1] is the error rate. Equation 6.2 presents the main factor that effects the communication rate: the keyboard design, and the velocity and accuracy of the iBCI. Most iBCI studies focused on improving iBCI controllability, user’s intention estimation [233, 204, 25, 163, 194, 159, 238, 80, 61, 88, 115, 116, 172, 179], and preventing errors (as described in Chapters 2.7.2 and 3.7). Here, we focused on the first part of Eq. 6.2 that summaries the keyboard layout, and represents the bit-rate dependency on number of keys

log2(N−1) and their average distance from each other ( d¯ ).

6.3.2 Face-Centered Cubic keyboard layout

In virtual keyboards the user types by moving the cursor to the desired target and selects it. Selection is done by dwelling on the target for a predefined duration or by ’clicking’ on it using an additional command. For example, ’clicking’ can be done by a computer mouse button or by a separate brain signal using an iBCI [117, 180]. A key’s acceptance area (or volume) is the area around the key that dwelling or clicking selects the key. In some cases, the acceptance area is bigger than the visualization of the key. For example, in the visualization in Fig 6.2 the black squares or hexagons are bigger than the sphere visualization of the targets. As we will show below, in a virtual keyboard presented in 3D visualization it might be necessary to make the keys smaller than their acceptance area to prevent the first layer of keys obscuring the layers behind it. In 3D virtual keyboards, keys are 3D objects in volume, and the aim is to position them in a layout that is as dense as possible, as a way to minimize the distance between them. The problems of organizing objects (e.g., keys) in a given volume (e.g., workspace) are called ’Packing problems’ and are a class of optimization problems in geometry. Designing keyboard keys as squares or cubes is common. However, as iBCIs are agnostic to the key shape, we chose to design our keyboards with spheres shape keys, as it is a perfectly symmetric shape. In three-dimensional space, the densest packing of equal spheres is achieved by a family of structures called close-packed structures. Many crystal structures in nature are based on a close-packing of a single kind of atom. One method for generating such a structure is called Face-Centered Cubic (FCC), which defines the position of the spheres in a lattice geometric repetitive structure (Fig. 6.1). In general, the coordinates of sphere centers can be written as:

√ 1 2p(6) [2i + ((j + k) mod 2) , 3(j + (k mod 2)) , k] · r (6.3) 3 3 CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 110

where i, j and k are indices starting at 0 for the x-, y- and z-coordinates, and r is the sphere radius.

In our study we chose rFCC =1 arbitrary units (a.u., e.g., cm or inch).

Figure 6.1: Face-centered cubic (FCC) structure with spheres of 1 arbitrary unit (a.u.) radius. The FCC structure repeats itself every three layers. Colors are used to visualize the different layers. (Left) side view of FCC structure with six layers. (Middle and Right) View from the ’z’ direction (user view) and a side view of a 3D FCC keyboard with three layers and 39 keys. While the FCC structure is design with rFCC =1 a.u., for the keyboards we visualize it with rvisual=0.5 a.u. to enable line of sight to all keys. Grey key mark the key on which the cursor is dwelling.

The benefit of FCC geometric structure is that the repetitive structure is every three layers, in contrast to other structure which repeat every two layers (e.g., hexagonal close-packed or cubic honeycomb). This allows a direct line of sight to spheres’ centers of the first three layers. This property is necessary for keyboards, as the user needs to see all keys. To have direct line of sight to all keys and spheres centers we visualize them with rvisual=0.5 a.u. while their centered are designed based on rFCC =1 a.u. (Fig 6.1). In our design, we position the keys in one to three layers of a FCC geometric structure. The number of keys can vary depending on how many keys are required for the keyboard.

6.4 Results

6.4.1 Keyboard design for 3D cursor control

To investigate the benefit of an FCC-based geometry keyboard, we compared the average distance ¯ log2(N−1) between keys (d) and the normalized bitrate ( d¯ ) as a function of the number of keys (N). Fig. 6.2 shows the comparison between a 2D square keyboards (e.g., OPTI-II is a 6 x 6 keyboard) CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 111

with 3D-FCC keyboards with one to three layers (L). For any number of targets (N) the average distance of the FCC keyboards is smaller than the 2D keyboards and decreases as the number of layers increase (Fig. 6.2(top left)). More importantly, for any number of target (N) the normalized bitrate of the FCC keyboards is higher than 2D keyboards, and increases as the number of layers increase (Fig. 6.2(top right)). To better understand the FCC benefit, we visualized the average distance of every key to the rest of the keys (Fig. 6.3). The FCC layout positions the keys in a much denser layout and have fewer keys with high average distance. As shown in Fig. 6.3 the keys in the corners have higher average distance. In a FCC keyboard design, the benefit of removing those targets is 2%. The virtual keyboard layout based on FCC structure improve the normalized bit-rate dramatically. For example, for a keyboard with 36-39 keys, a 3D FCC design keyboards can improve bit-rate by 60% compared to a 2D OPTI-II keyboard.

6.4.2 Keyboard design for 4D cursor control

While 3D keyboards utilize additional dimension of control compared to a 2D keyboard, it does not utilize the full capabilities of iBCIs. To utilize the 4th dimension of control another keyboard design is required. Our proposed ’4D keyboard’ is based on a 3D keyboard as described above but also utilize the fourth controlled dimension of the cursor - its rotation around the depth (z) axis. In this design, each key of the 3D keyboard is divided into M sub-keys (e.g., M>1), where each sub-key is labeled separately. Each sub-key can be selected by dwelling on the primary key and rotating the cursor to the desired sub-key. We note that for M=1 the 4D keyboard is a 3D keyboard. Since rotation can be done simultaneously with moving the cursor in space, as long as rotation does not take longer than the movement, the bit-rate will only benefit from increasing the number of targets. The benefit from dividing each key to M sub-keys will increase the normalized bit-rate by a product log(N·M−1) of log(N−1) . In Fig. 6.4, we presented the normalized bitrate as a function of targets for both OPTI-II, 3D FCC with three layers, and a 4D keyboard (4D-FCC) with a variety of key divisions (M=2,3,4). Increasing the key division increases the normalized bitrate. For 39 keys (target layout of a 3D keyboard with 13 targets) the normalized bitrate of the 4D keyboard is 50% more compared to the 3D keyboard and 130% more compared to the 2D keyboard. The results suggest using a 4D keyboard might double the bit-rate compared to a 2D keyboard.

6.5 Discussion

To have efficient communication throughput, a typing communication device requires a custom interface that utilizes the device properties. Our results suggest that utilizing the high dimensional control of iBCIs might increase the communication rate by two-fold. Current state-of-the-art iBCI bitrate is 7.8 words/minute (wpm) [179] which falls short of communication rates for able-bodied CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 112

Figure 6.2: 2D and 3D keyboards comparison. (Top) Average distance (d¯) and the normalized log2(N−1) bitrate ( d¯ ) as a function of number of keys (N). The black circle mark keyboards layouts that are presented in the middle and bottom rows. (Middle and Bottom) An example of 2D and 3D keyboards with a similar number of keys. Spheres represent the location of the keys in the virtual environment. The black border around selected keys represents the acceptance area of the keys. (Middle) User view - 2D projection. In a 3D visualization, the depth will be available as seen in (Bottom). Red, green and blue colors mark keys in the same layer (depth). Grey color mark the same key in the top and bottom view to assist with orientation. CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 113

Figure 6.3: FCC keys’ average distance. Each key is colored by its average distance to the rest of the keys. The left layout is the same FCC layout as in the middle but without the keys in the corner, which has the highest average distance. subjects using smartphones (12-19 wpm [101, 139]), touch typing (40-60 wpm [140]), and speaking (90-170 spoken wpm [239]). A ’4D keyboard’, a keyboard that utilizes 4D iBCI control, can bring to current state-of-the-art iBCI the throughput of able-bodied subjects using smartphones, and increase the clinical viability of iBCIs. Doubling typing performance can be of substantial benefit to people with severe paralysis who use those assistive devices and can make the difference for them between using the system and typing, or not.

6.5.1 Online validation

In our work, we designed keyboard layouts that reduce the average distance between pairs of keys. As we understand typing rate, this will have a direct effect on reach time and as a result the typing rate. As typing in with a high-dimensional control has not been investigated before, further work should be done to verify that other factors such as user perception, user attention, and high-dimensional control coordination do not degrade significantly the typing rate. CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 114

log2(N−1) Figure 6.4: ’4D keyboards’ comparison. (Top) Normalized bitrate ( d¯ ) as a function of number of keys (N). The black circle mark keyboard layout that is presented in bottom row. (Bottom) Black lines are the borders between sub-keys.

3D visualization

Clear visual perception of the keys and their position is necessary to fast typing. In contrast to 2D visualization, 3D visualization of keyboards in virtual reality conveys a few challenges such as 3D perception and clear visualization of the back layers of the keyboard. Current technology enables visualizing 3D objects by presenting two, slightly different, stereoscopic images for each of the eyes. The disparity between the two images yields the depth perception. However, the quality of the depth perception in 3D visualization is inferior to the natural, real-world depth perception as a result of missing depth cues such as accommodation [86, 190]. To improve depth perception, CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 115

a variety of depth cues can be implemented such as linear perspective (3D grid room), shadows, texture gradients, size, etc. The depth disparities between layers of keyboards can be artificially emphasized by increasing the distance between layers. However, this will also increase the reach time between keys in different layers. To compensate for that, the velocity in z-axis can be scaled in the same proportion of the distance. In addition to depth perception, the keys and the cursor should be designed to enable efficient typing. As a cursor can be located behind a key, the transparency of the keys should be calibrated to have a clear key visualization while allowing sight of the cursor. As users might not be experienced with 3D visualization, a training period might be required before their performance will stabilize and could be compared to a standard 2D keyboard.

High-dimensional BCI control

The proposed ’3D’ and ’4D’ keyboards were designed under the assumption that the control quality of all degrees of freedom is the same. Meaning that the speed and accuracy (see Eq.6.2) is kept constant as we add more dimensions of control. For example, that the reach time between two keys separated in z-axis (depth) is the same as between two keys separated in x-axis. If there is a discrepancy in the control quality between movement in z-axis and xy-plane, the keys distance (and size) can be modified accordingly. For example, if the movement in z-axis is not accurate as in xy-plane, the layers should be located further away from each other to account for the lack of accuracy. This, of course, will decrease the benefit of additional layers, as it will take longer to move from one layer to another. In this case, 3D keyboards with only two layers should be considered. In a ’4D’ keyboard, the choice of how many sub-keys to use (e.g., 2, 3, or 4) depends on the rotation control quality. The number of sub-keys should be as high as possible as long as it does not increase the average reach time. Meaning, that the average rotation time from one orientation to another will not be higher than the average reach time in 3D space from one key to another. The number of sub-keys can be calibrated for each user with offline analysis based on previous high-dimensional control sessions and can be validated in online sessions.

Key selection

A key acquisition is composed of two phases: the reach and the selection itself (i.e., ’clicking’ on a key). The proposed keyboard layouts save time only from the reach period. Thus, it will be more beneficial when the selection itself is short. For example, if the reach time is 1 sec and the selection is done by dwelling on a key for 0.5 sec, the benefit of cutting distance (and time) by half will reduce the total time by a third. However, if keys are selected by separate action of ’clicking’ [117, 179] (e.g., by squeezing the other arm) the selection time can be reduced dramatically (e.g., 200 ms). Thus, the benefit of high-dimensional keyboards will be greater when using a ’click’ selection compared to a dwell selection. CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 116

6.5.2 Additional variations

Various implementations

3D and 4D keyboards can be implemented in a variety of ways. The most intuitive way is to present them in a 3D visualization (e.g., using 3D glasses) in a virtual or augmented reality. For example, the iBCI user can wear 3D glasses which presents a virtual keyboard in 3D on a computer screen. The user will move the computer cursor in three or four dimensions to select the desired key on the keyboard. Another option for implementation is in a 2D visualization. In a 2D visualization, the keyboard will be presented as shown in Fig. 6.2(middle-right), and the user will ’browse’ between the FCC keyboards layers using the z-dimension control of the iBCI. In this implementation, the user ’depth’ visual information is given by marking (e.g., by color) the layer or the key the cursor is dwelled on. Also, in 2D visualization, a 3D keyboard can be implemented with a standard 2D keyboard, where each key is divided into sub-keys. The user will move the cursor in a 2D plane to select the primary key and rotate the cursor to select the desired sub-key. The high dimensional key layout is not limited to keyboards and can also be utilized for menu selection in a computer or virtual or augmented reality. For example, a menu design in 3D can give the iBCI user a variety of options when controlling his/her smart house or working with computer applications. Here, we discussed high dimensional keyboard for BCI use. However, those keyboard layouts are not limited to this use and can be utilized for any cursor based typing with high-dimensional control. Those designs can be used when using an eye-tracker, a head-movements pointer, or when combining the two. In addition, the fields of virtual reality (VR) and augmented reality (AR) are in their infancy and our novel keyboard design might be used in the future to also improve able-bodied VR or AR applications.

Character layout

A keyboard design starts with the application and the desired characters, which define the number of required keys. For example, for typing in English, a keyboard of 30-36 key is needed, which also includes keys such as ’space,’ ’delete,’ ’Enter,’ ’Shift,’ etc. A calculator keypad might require 10-20 keys, and a computer menu requires an even smaller number of keys. The next step would be to decide on the key labeling, i.e., to allocate characters to keys. The labeling can be optimized and adapted to the user language. Typically, frequently used characters or keys (e.g., ’space’ or vowels) are positioned in the center of the keyboard to make a short movement more frequent. Future studies can investigate the efficient labeling of the proposed high dimensional keyboards. CHAPTER 6. EFFICIENT VIRTUAL KEYBOARDS FOR HIGH-DIMENSIONAL BCIS 117

Keys size and volume

In our analysis, we used keys with 1 arbitrary unit (a.u.) radius. To utilize the entire workspace area or volume, the workspace is equally distributed across keys acceptance area or volume. For example, in the OPTI-II layout (Fig. 6.2) the shape of the acceptance area is a square and in the 1-layer FCC layout it is a hexagon. While the same circle (1 a.u. radius) is inscribed in both the square and the hexagon, the area of the square is larger than the hexagon. This means that while the distance between neighboring keys is the same (2 a.u.), the acceptance area is smaller for FCC layouts. Future studies should investigate the effect of the key shape on the error rate, i.e., the percentage of false key selections. Key size and volume can also be used to make some keys easier to select than others. For example, frequently used keys can be relatively big to make their selection easier and faster compared to uncommon keys. Also, the cost of selecting the wrong key closer to the ’delete’ key is lower than the cost of making a mistake far from it. Thus, keys closer to the ’delete’ key can be smaller. Chapter 7

Conclusions

Decades of intracortical electrophysiological research in motor neuroscience gave rise to the field of iBCI. Considerable development of intracortical neural interfaces, research on control algorithms in non-human primates and clinical trial evaluations in people with paralysis resulted in the current state-of-the-art iBCIs and showed the potential for clinical viability. From its inception, the field was strongly linked to its ancestor, basic neuroscience research. This link is natural, as it was necessary to demonstrate that it is possible to translate neural activity into movement. This connection is manifested in the neural interfaces in use and the algorithm development approach. For example, neural interfaces used for iBCI experiments and clinical trials had the same signal specifications as interfaces used for basic neuroscience. While this strong tie gave rise to the current impressive state of results, it might confine it from advancing to its objective of creating a clinically viable device. Thus, I believe that alongside the basic neuroscience approach to improving iBCI a more holistic strategy, motivated by the clinical need, should be encouraged to advance the field. An iBCI system is composed of three main components: a neural interface, a neural decoder, and a prosthesis. Each one of the components is a field of research requires multidisciplinary expertise. For example, development of neural interfaces that record neural activity and are implanted un- der the skin requires expertise in material sciences, circuit design, and other engineering disciplines alongside the understanding of neuron activity and physiology. Development of neural decoders re- quires expertise in data analysis, machine learning, and control theory alongside neuroscience. Last, prostheses development and design require expertise in mechanical engineering, robotics, control theory, and human-computer interfaces. Each subfield has had tremendous advances that brought us to its current state-of-the-art. However, a high-level system view and collaborative work across those subfields can take the field a huge step towards clinical viability. My research, which is sum- marized in this dissertation, spanned the three iBCI components and their interactions. The clinical application motivated my projects, and the solutions I proposed emerged from taking neuroscience insights and applying engineering strategies.

118 CHAPTER 7. CONCLUSIONS 119

To advance iBCI neural interfaces I collaborated with a circuit design lab to investigate the dependencies between the neural interface and the neural decoder. With my neuroscience and neural decoding expertise, and their recording system design expertise, we revised the current circuit designs of a neural interface. The conventional design was heavily influenced by basic neuroscience needs as there were no explicit requirements for iBCI. In this cross-disciplinary work, we proposed a new iBCI-focused design which presents opportunities for an order of magnitude power savings without compromising decoding performance. An order of magnitude power savings will allow the design of wireless transcutaneous neural interfaces with thousands of channels, in contrast to the current devices under development with only a hundred channels. Increasing the number of channels by an order of magnitude will increase and diversify the information recorded from the neural activity. This could improve performance, enable the control of more complex prostheses and extend the clinical application of iBCIs. Implanting the device under the skin will decrease the risk of infection, and improve aesthetic appearance, users mobility and independence. The impact of implementing such a system can have a significant impact on the iBCI field as both the performance and clinical viability could improve simultaneously. Future collaborations of hardware engineers and neuroscientists should continue this line of work, implement an iBCI-focused device, and show the full potential of the proposed design. In that work, we had another equally important finding. We clearly defined the type of signal and accuracy required for the iBCI decoder. The fact that only a binary signal sampled at 1 KSps with 10−3 error rate is needed can open an avenue for new recording system architectures for clinical iBCIs. Conventional systems are amplifying, digitizing, and thresholding the neural signal before decoding the user intention. The requirement to transmit only threshold events with up to 10−3 error rate opens an avenue for new recording system architectures that can be even more power efficient than our proposed modification of the conventional system. Principals in control theory inspired the neurally driven error detector development which aims to improve neural decoders. In this field, the error, which is the difference between the desired state and the actual state, is applied as feedback to generate a control action. The error signal can be used to correct the state or even to adapt the parameters of the algorithm (e.g., adaptive controller). The importance of the error signal and its utility in control theory brought us to search for such a signal in the brain in the aim to utilize it to improve iBCI control. Surprisingly, we found such a signal on the same electrodes we used to decode the desired kinematics. Then, we demonstrated the ability to undo or even prevent mistakes which improve performance. In addition to the performance increase, we had another significant contribution to the field - we pioneered the use of a cognitive neural signal for iBCI. We showed the potential of using cognitive information as complementary to kinematic information for iBCI control. A natural continuation for our study would be to implement a real-time error detector system in human iBCI. In contrast to monkeys, humans could be instructed how to use an error detect-and-act CHAPTER 7. CONCLUSIONS 120

system to maximize its benefits. Also, users might be trained to emphasize such a cognitive signal which can improve its detection. While our primary work was to undo or prevent the mistake, in the monkey work, we showed the ability to estimate the desired action (e.g, which target the monkey was aiming for) rather than just the occurrence of a mistake. Future studies could continue this line of work and develop an error detect-and-correct system based on neural activity. In our work, we focused on a task-outcome error signal which exists only at the end of a movement or a task. Investigating other types of error signals such as execution error signals, which reflect the difference between the desire and the actual instantaneous speed or position of the prosthesis, can be a great benefit for iBCIs. This error signal helps to intervene earlier in the movement and prevent the errors from accumulating. In addition, other types of cognitive neural signal could be explored to use in parallel with the kinematic signal. For example, decision making and confidence neural correlates could be used as predictors for movement persistence or possible changes in movements. For example, if there is a low certainty in the decision that initiated the movement, there is a higher chance for a change of mind which can result in a change in movement. This information could be used to decrease the momentum of the decoder. In a broader view regarding this study, the neuroscience investigation and the following decoder design development were inspired by controlled signals used for machines. I believe that iBCI can benefit from motivating neuroscience studies from control theory. Last, we investigated user interface designs for iBCI through two complementary approaches: a neuroscience study and an engineering investigation. First, we studied the neural activity properties to guide an efficient keyboard layout design for ’discrete’ iBCIs. Second, we designed novel virtual keyboards that utilize high-dimensional iBCI control that can increase the typing rate. Future studies can implement keyboards based on those studies and investigate their effect on performance and user experience. The significance of the second study on the field is broader in my opinion. This study strengthens the importance of designing interfaces custom for iBCIs. We have shown that a custom user interface design could reduce during typing the average reach distance between keys by half. This distance reduction has the potential to double typing rate and can bring current state-of-the-art iBCI to the typing rate of able-bodied using smartphones. The effort to develop such systems requires the collaboration with human-computer interfaces specialists. Also, the effort to build iBCI tailored systems should not only be limited to user interfaces but also include robotic arms. As neural interface design was influenced by the decoder requirements, also prostheses for iBCIs might benefit from taking into account the type of control signal and the dimensionality of the signal that can be decoded from the brain. A collaboration of neuroscientists and roboticists could lead to new approaches in both fields. As mentioned earlier, neuroscientist could study the neural signal that can be useful for control (e.g., error signals), and roboticists could design a prosthesis that better fit to the decoded neural signal. Furthermore, most iBCI robotic arms were not designed specifically to CHAPTER 7. CONCLUSIONS 121

serve people with paralysis, a survey of the clinical needs combined with the potential controllability of neural decoder might initiate new robotic arm designs which can better serve iBCI user’s. The iBCI field has demonstrated encouraging results and has risen to a level of maturity that requires a more holistic view. Performance and clinical viability of iBCIs can benefit from expending even more this cross-disciplinary work. Appendix A

Publications

The following appendix lists all refereed publications I was a part of during my PhD. This includes work that was not included in this dissertation.

A.1 Journal publications

1. N. Even-Chen*, D. G. Muratore*, S.D. Stavisky, L. R. Hochberg, J. M. Henderson, B. Murmann**, K. V. Shenoy**, Intracortical neural interface design opportunities for orders of magnitude power savings, (under review)

2. N. Even-Chen*, B. Sheffer*, S. Vyas, S. I. Ryu, and K. V. Shenoy, Structure of Delay Activity in Premotor Cortex. (under revision)

3. N. Even-Chen, S.D. Stavisky, C. Pandarinath, P. Nuyujukian, C. . Blabe, L. R. Hochberg, J. M. Henderson, K. V. Shenoy, Feasibility of Automatic Error Detect-and-Undo System in Human Intracortical Brain-Computer Interfaces, in IEEE Transactions on Biomedical Engi- neering, vol. 65, no. 8, pp. 1771-1784, Aug. 2018.

4. S. Vyas, N. Even-Chen, S. D. Stavisky, S. I. Ryu, P. Nuyujukian, and K. V. Shenoy, Neu- ral Population Dynamics Underlying Motor Learning Transfer, Neuron, vol. 97, no. 5, pp. 11771186.e3, Mar. 2018.

5. N. Even-Chen, S. D. Stavisky, J. C. Kao, S. I. Ryu, and K. V. Shenoy, Augmenting intra- cortical brain-machine interface with neurally driven error detectors, J. Neural Eng., vol. 14, no. 6, p. 066007, Dec. 2017.

122 APPENDIX A. PUBLICATIONS 123

A.2 Refereed conference publications

1. N. Even-Chen*, D. G. Muratore*, B. Murmann**, K. V. Shenoy** (2018) Assessing cir- cuit design parameters for lower-power clinically-viable intracortical brain-computer interfaces. 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Soci- ety, Honolulu, HI.

2. N. Even-Chen, S.D. Stavisky, C. Pandarinath, P. Nuyujukian, C. H. Blabe, L. R. Hochberg, J. M. Henderson, K. V. Shenoy (2018) Task outcome error signals in human primary motor cortex and their use in brain-computer interfaces. 8th International IEEE EMBS Conference on Neural Engineering, Shanghai, China.

3. N. Even-Chen, S. D. Stavisky, J. C. Kao, S. I. Ryu, and K. V. Shenoy (2015) Auto-deleting brain machine interface: Error detection using spiking neural activity in the motor cortex. 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pp. 7175.

A.3 Patents

1. N. Even-Chen, S. D. Stavisky, J. C. Kao, S. I. Ryu, and K. V. Shenoy (2017) Task-outcome error signals and their use in brain-machine interfaces. US Patent App. 15/234,844 Bibliography

[1] Neil Achtman, Afsheen Afshar, Gopal Santhanam, Byron M Yu, Stephen I Ryu, and Krishna V Shenoy. Free-paced high-performance brain-computer interfaces. J. Neural Eng., 4(3):336–347, September 2007.

[2] Tyson Aflalo, Spencer Kellis, Christian Klaes, Brian Lee, Ying Shi, Kelsie Pejsa, Kathleen Shanfield, Stephanie Hayes-Jackson, Mindy Aisen, Christi Heck, Charles Liu, and Richard A Andersen. Neurophysiology. decoding motor imagery from the posterior parietal cortex of a tetraplegic human. Science, 348(6237):906–910, May 2015.

[3] Afsheen Afshar, Gopal Santhanam, Byron M Yu, Stephen I Ryu, Maneesh Sahani, and Krishna V Shenoy. Single-trial neural correlates of arm movement preparation. Neuron, 71(3):555–564, August 2011.

[4] A Bolu Ajiboye, Francis R Willett, Daniel R Young, William D Memberg, Brian A Mur- phy, Jonathan P Miller, Benjamin L Walter, Jennifer A Sweet, Harry A Hoyen, Michael W Keith, P Hunter Peckham, John D Simeral, John P Donoghue, Leigh R Hochberg, and Robert F Kirsch. Restoration of reaching and grasping movements through brain-controlled muscle stimulation in a person with tetraplegia: a proof-of-concept demonstration. Lancet, 389(10081):1821–1830, May 2017.

[5] K Cora Ames, Stephen I Ryu, and Krishna V Shenoy. Neural dynamics of reaching following incorrect or absent motor preparation. Neuron, 81(2):438–451, 22 January 2014.

[6] C H An, C G Atkeson, and J M Hollerbach. Estimation of inertial parameters of rigid body links of manipulators. In 1985 24th IEEE Conference on Decision and Control, pages 990–995, December 1985.

[7] Brian S Armour, Elizabeth A Courtney-Long, Michael H Fox, Heidi Fredine, and Anthony Cahill. Prevalence and causes of Paralysis-United states, 2013. Am. J. Public Health, 106(10):1855–1857, October 2016.

124 BIBLIOGRAPHY 125

[8] K J Astr¨omand˚ B Wittenmark. Adaptive Control: Second Edition. Dover Books on Electrical Engineering. Dover Publications, 2013.

[9] Daniel Bacher, Beata Jarosiewicz, Nicolas Y Masse, Sergey D Stavisky, John D Simeral, Katherine Newell, Erin M Oakley, Sydney S Cash, Gerhard Friehs, and Leigh R Hochberg. Neural Point-and-Click communication by a person with incomplete Locked-In syndrome. Neu- rorehabil. Neural Repair, 29(5):462–471, June 2015.

[10] H Bahrami, S. A. Mirbozorgi, L. A. Rusch, and B. Gosselin. BER performance of implant-to- air high-speed UWB data communications for neural recording systems. IEEE Proceedings of Engineering in Medicine and Biology Society Conference, pages 3961–3964, aug 2014.

[11] Arjun K Bansal, Wilson Truccolo, Carlos E Vargas-Irwin, and John P Donoghue. Decoding 3D reach and grasp from hybrid signals in motor and premotor cortices: spikes, multiunit activity, and local field potentials. J. Neurophysiol., 107(5):1337–1355, March 2012.

[12] James C Barrese, Naveen Rao, Kaivon Paroo, Corey Triebwasser, Carlos Vargas-Irwin, Lachlan Franquemont, and John P Donoghue. Failure mode analysis of silicon-based intracortical microelectrode arrays in non-human primates. J. Neural Eng., 10(6):066014, December 2013.

[13] Annette Bastian, Gregor Sch¨oner,and Alexa Riehle. Preshaping and continuous evolution of motor cortical representations during movement preparation. Eur. J. Neurosci., 18(7):2047– 2058, October 2003.

[14] Aaron P Batista, Gopal Santhanam, Byron M Yu, Stephen I Ryu, Afsheen Afshar, and Kr- ishna V Shenoy. Reference frames for reach planning in macaque dorsal premotor cortex. J. Neurophysiol., 98(2):966–983, August 2007.

[15] Andrei Belitski, Arthur Gretton, Cesare Magri, Yusuke Murayama, Marcelo A Montemurro, Nikos K Logothetis, and Stefano Panzeri. Low-frequency local field potentials and spikes in primary visual cortex convey independent visual information. J. Neurosci., 28(22):5696–5709, May 2008.

[16] Guangyu Bin, Xiaorong Gao, Zheng Yan, Bo Hong, and Shangkai Gao. An online multi- channel SSVEP-based brain-computer interface using a canonical correlation analysis method. J. Neural Eng., 6(4):046002, August 2009.

[17] Christine H Blabe, Vikash Gilja, Cindy A Chestek, Krishna V Shenoy, Kim D Anderson, and Jaimie M Henderson. Assessment of brain-machine interfaces from the perspective of people with paralysis. J. Neural Eng., 12(4):043002, August 2015.

[18] O Bock and K Arnold. Error accumulation and error correction in sequential pointing move- ments. Exp. Brain Res., 95(1):111–117, 1993. BIBLIOGRAPHY 126

[19] Francesca Bonini, Boris Burle, Catherine Li´egeois-Chauvel, Jean R´egis,Patrick Chauvel, and Franck Vidal. Action monitoring and medial frontal cortex: leading role of supplementary motor area. Science, 343(6173):888–891, February 2014.

[20] David A Borton, Ming Yin, Juan Aceros, and Arto Nurmikko. An implantable wireless neural interface for recording cortical circuit dynamics in moving primates. J. Neural Eng., 10(2):026010, April 2013.

[21] Chad E Bouton, Ammar Shaikhouni, Nicholas V Annetta, Marcia A Bockbrader, David A Friedenberg, Dylan M Nielson, Gaurav Sharma, Per B Sederberg, Bradley C Glenn, W Jerry Mysiw, Austin G Morgan, Milind Deogaonkar, and Ali R Rezai. Restoring cortical control of functional movement in a human with quadriplegia. Nature, 533(7602):247–250, May 2016.

[22] David M Brandman, Michael C Burkhart, Jessica Kelemen, Brian Franco, Matthew T Harri- son, and Leigh R Hochberg. Robust Closed-Loop control of a cursor in a person with tetraplegia using gaussian process regression. Neural Comput., pages 1–23, September 2018.

[23] Peter Brunner, Anthony L Ritaccio, Joseph F Emrich, Horst Bischof, and Gerwin Schalk. Rapid communication with a “p300” matrix speller using electrocorticographic signals (ECoG). Front. Neurosci., 5:5, February 2011.

[24] Gy¨orgyBuzs´aki,Costas A Anastassiou, and Christof Koch. The origin of extracellular fields and currents–EEG, ECoG, LFP and spikes. Nat. Rev. Neurosci., 13(6):407–420, May 2012.

[25] Jose M Carmena, Mikhail A Lebedev, Roy E Crist, Joseph E O’Doherty, David M Santucci, Dragan F Dimitrov, Parag G Patil, Craig S Henriquez, and Miguel A L Nicolelis. Learning to control a brain-machine interface for reaching and grasping by primates. PLoS Biol., 1(2):E42, November 2003.

[26] Hariprasad Chandrakumar and Dejan Markovi´c.An 80-mVpp linear-input range, 1.6-G input impedance, low-power chopper amplifier for closed-loop neural recording that is tolerant to 650-mVpp common-mode interference. IEEE Journal of Solid-State Circuits, 52(11):2811– 2828, 2017.

[27] Hariprasad Chandrakumar and Dejan Markovic. A 15.2-ENOB continuous-time Σ∆ ADC for a 200mV pp-linear-input-range neural recording front-end. In IEEE International Solid-State Circuits Conference-(ISSCC), pages 232–234, Feb. 2018.

[28] Steven M Chase, Andrew B Schwartz, and Robert E Kass. Bias, optimal linear estimation, and the differences between open-loop simulation and closed-loop performance of spiking-based brain–computer interface algorithms. Neural Netw., 22(9):1203–1213, November 2009. BIBLIOGRAPHY 127

[29] R Chavarriaga, I Iturrate, and J d R Mill´an.Robust, accurate spelling based on error-related potentials. pages 1328–1337. Verlag der TU Graz, Graz University of Technology, 2016.

[30] Ricardo Chavarriaga, Chavarriaga Ricardo, Sobolewski Aleksander, and Jos˜a c del R. MillA`n.˜ Errare machinale est: the use of error-related potentials in brain-machine interfaces. Front. Neurosci., 8, 2014.

[31] Ricardo Chavarriaga, Aleksander Sobolewski, and Jos´eDel R Mill´an. Errare machinale est: the use of error-related potentials in brain-machine interfaces. Front. Neurosci., 8:208, July 2014.

[32] Xing Chen, Jessy K Possel, Catherine Wacongne, Anne F van Ham, P Christiaan Klink, and Pieter R Roelfsema. 3D printing and modelling of customized implants and surgical guides for non-human primates. J. Neurosci. Methods, 286:38–55, July 2017.

[33] Cynthia A Chestek, Vikash Gilja, Paul Nuyujukian, Justin D Foster, Joline M Fan, Matthew T Kaufman, Mark M Churchland, Zuley Rivera-Alvidrez, John P Cunningham, Stephen I Ryu, and Krishna V Shenoy. Long-term stability of neural prosthetic control signals from silicon cortical arrays in rhesus macaque motor cortex. J. Neural Eng., 8(4):045005, August 2011.

[34] Breanne P Christie, Derek M Tat, Zachary T Irwin, Vikash Gilja, Paul Nuyujukian, Justin D Foster, Stephen I Ryu, Krishna V Shenoy, David E Thompson, and Cynthia A Chestek. Comparison of spike sorting and thresholding of voltage waveforms for intracortical brain- machine interface performance. J. Neural Eng., 12(1):016009, February 2015.

[35] Mark M Churchland, John P Cunningham, Matthew T Kaufman, Justin D Foster, Paul Nuyu- jukian, Stephen I Ryu, and Krishna V Shenoy. Neural population dynamics during reaching. Nature, 487(7405):51–56, July 2012.

[36] Mark M Churchland, John P Cunningham, Matthew T Kaufman, Justin D Foster, Paul Nuyu- jukian, Stephen I Ryu, and Krishna V Shenoy. Neural population dynamics during reaching. Nature, 487(7405):51–56, 2012.

[37] Mark M Churchland, John P Cunningham, Matthew T Kaufman, Stephen I Ryu, and Kr- ishna V Shenoy. Cortical preparatory activity: representation of movement or first cog in a dynamical machine? Neuron, 68(3):387–400, 4 November 2010.

[38] Mark M Churchland, Gopal Santhanam, and Krishna V Shenoy. Preparatory activity in pre- motor and motor cortex reflects the speed of the upcoming reach. J. Neurophysiol., 96(6):3130– 3146, December 2006.

[39] Mark M Churchland, Byron M Yu, Stephen I Ryu, Gopal Santhanam, and Krishna V Shenoy. Neural variability in premotor cortex provides a signature of motor preparation. J. Neurosci., 26(14):3697–3712, April 2006. BIBLIOGRAPHY 128

[40] Mark M Churchland, Byron M Yu, Maneesh Sahani, and Krishna V Shenoy. Techniques for extracting single-trial activity patterns from large-scale neural recordings. Curr. Opin. Neurobiol., 17(5):609–618, October 2007.

[41] Paul Cisek, Donald J Crammond, and John F Kalaska. Neural activity in primary motor and dorsal premotor cortex in reaching tasks with the contralateral versus ipsilateral arm. J. Neurophysiol., 89(2):922–942, February 2003.

[42] Paul Cisek and John F Kalaska. Neural correlates of reaching decisions in dorsal premo- tor cortex: specification of multiple direction choices and final selection of action. Neuron, 45(5):801–814, March 2005.

[43] Jennifer L Collinger, Michael L Boninger, Tim M Bruns, Kenneth Curley, Wei Wang, and Douglas J Weber. Functional priorities, assistive technology, and brain-computer interfaces after spinal cord injury. J. Rehabil. Res. Dev., 50(2):145–160, 2013.

[44] Jennifer L Collinger, Brian Wodlinger, John E Downey, Wei Wang, Elizabeth C Tyler-Kabara, Douglas J Weber, Angus J C McMorland, Meel Velliste, Michael L Boninger, and Andrew B Schwartz. High-performance neuroprosthetic control by an individual with tetraplegia. Lancet, 381(9866):557–564, February 2013.

[45] Jennifer L Collinger, Brian Wodlinger, John E Downey, Wei Wang, Elizabeth C Tyler-Kabara, Douglas J Weber, Angus J C McMorland, Meel Velliste, Michael L Boninger, and Andrew B Schwartz. High-performance neuroprosthetic control by an individual with tetraplegia. Lancet, 381(9866):557–564, February 2013.

[46] D J Crammond and J F Kalaska. Prior information in motor and premotor cortex: activity during the delay period and effect on pre-movement activity. J. Neurophysiol., 84(2):986–1005, August 2000.

[47] John P Cunningham, Vikash Gilja, Stephen I Ryu, and Krishna V Shenoy. Methods for estimating neural firing rates, and their application to brain–machine interfaces. Neural Netw., 22(9):1235–1246, November 2009.

[48] John P Cunningham, Paul Nuyujukian, Vikash Gilja, Cindy A Chestek, Stephen I Ryu, and Krishna V Shenoy. A closed-loop human simulator for investigating the role of feedback control in brain-machine interfaces. J. Neurophysiol., 105(4):1932–1949, April 2011.

[49] John P Cunningham and Byron M Yu. Dimensionality reduction for large-scale neural record- ings. Nat. Neurosci., 17(11):1500–1509, November 2014.

[50] John P Cunningham and Byron M Yu. Dimensionality reduction for large-scale neural record- ings. Nat. Neurosci., 17(11):1500–1509, November 2014. BIBLIOGRAPHY 129

[51] John P Cunningham, Byron M Yu, Vikash Gilja, Stephen I Ryu, and Krishna V Shenoy. Toward optimal target placement for neural prosthetic devices. J. Neurophysiol., 100(6):3445– 3457, December 2008.

[52] John P Cunningham, Byron M Yu, Vikash Gilja, Stephen I Ryu, and Krishna V Shenoy. Toward optimal target placement for neural prosthetic devices. J. Neurophysiol., 100(6):3445– 3457, December 2008.

[53] B L Day, J C Rothwell, P D Thompson, A Maertens de Noordhout, K Nakashima, K Shannon, and C D Marsden. Delay in the execution of voluntary movement by electrical or magnetic brain stimulation in intact man. evidence for the storage of motor programs in the brain. Brain, 112 ( Pt 3):649–663, June 1989.

[54] S A Deadwyler and R E Hampson. The significance of neural ensemble codes during behavior and cognition. Annu. Rev. Neurosci., 20:217–244, 1997.

[55] J¨ornDiedrichsen, Yasmin Hashambhoy, Tushar Rane, and Reza Shadmehr. Neural correlates of reach errors. J. Neurosci., 25(43):9919–9931, October 2005.

[56] Ana R C Donati, Solaiman Shokur, Edgard Morya, Debora S F Campos, Renan C Moioli, Claudia M Gitti, Patricia B Augusto, Sandra Tripodi, Cristhiane G Pires, Gislaine A Pereira, Fabricio L Brasil, Simone Gallo, Anthony A Lin, Angelo K Takigami, Maria A Aratanha, Sanjay Joshi, Hannes Bleuler, Gordon Cheng, Alan Rudolph, and Miguel A L Nicolelis. Long- Term training with a Brain-Machine Interface-Based gait protocol induces partial neurological recovery in paraplegic patients. Sci. Rep., 6:30383, 2016.

[57] John E Downey, Jeffrey M Weiss, Katharina Muelling, Arun Venkatraman, Jean-Sebastien Valois, Martial Hebert, J Andrew Bagnell, Andrew B Schwartz, and Jennifer L Collinger. Blending of brain-machine interface and vision-guided autonomous robotics improves neuro- prosthetic arm performance during grasping. J. Neuroeng. Rehabil., 13:28, March 2016.

[58] Ali Ebrazeh and Pedram Mohseni. 30 pJ/b, 67 Mbps, centimeter-to-meter range data teleme- try with an IR-UWB wireless link. IEEE Transactions on Biomedical Circuits and Systems, 9(3):362–369, 2015.

[59] Gaute T Einevoll, Christoph Kayser, Nikos K Logothetis, and Stefano Panzeri. Modelling and analysis of local field potentials for studying the function of cortical circuits. Nat. Rev. Neurosci., 14(11):770–785, November 2013.

[60] Gamaleldin F Elsayed, Antonio H Lara, Matthew T Kaufman, Mark M Churchland, and John P Cunningham. Reorganization between preparatory and movement population re- sponses in motor cortex. Nat. Commun., 7:13239, October 2016. BIBLIOGRAPHY 130

[61] C Ethier, E R Oby, M J Bauman, and L E Miller. Restoration of grasp following paralysis through brain-controlled stimulation of muscles. Nature, 485(7398):368–371, May 2012.

[62] Christian Ethier and Lee E Miller. Brain-controlled muscle stimulation for the restoration of motor function. Neurobiol. Dis., 83:180–190, November 2015.

[63] E V Evarts, C Fromm, J Kr¨oller,and V A Jennings. Motor cortex control of finely graded forces. J. Neurophysiol., 49(5):1199–1215, May 1983.

[64] Nir Even-Chen, Dante G Muratore, Sergey D Stavisky, Leigh R Hochberg, Henderson Jaimie M., Boris Murmann, and Krishna V Shenoy. Intracortical neural interface design opportunities for orders of magnitude power savings.

[65] Nir Even-Chen, Blue Sheffer, Saurabh Vyas, Stephen I Ryu, and Krishna V Shenoy. Structure of delay activity in premotor cortex.

[66] Nir Even-Chen, Krishna V Shenoy, Jonathan C Kao, and Sergey Stavisky. Task-outcome error signals and their use in brain-machine interfaces, February 2017.

[67] Nir Even-Chen, Sergey D Stavisky, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Auto-deleting brain machine interface: Error detection using spiking neural activity in the motor cortex. Conf. Proc. IEEE Eng. Med. Biol. Soc., 2015:71–75, August 2015.

[68] Nir Even-Chen, Sergey D Stavisky, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Augmenting intracortical brain-machine interface with neurally driven error detectors. J. Neural Eng., 14(6):066007, December 2017.

[69] Nir Even-Chen, Sergey D Stavisky, Chethan Pandarinath, Paul Nuyujukian, Christine H Blabe, Leigh R Hochberg, Jaimie M Henderson, and Krishna V Shenoy. Feasibility of auto- matic error Detect-and-Undo system in human intracortical Brain-Computer interfaces. IEEE Trans. Biomed. Eng., 65(8):1771–1784, August 2018.

[70] M Falkenstein, J Hohnsbein, J Hoormann, L Blanke, and Others. Effects of errors in choice reaction tasks on the ERP under focused and divided attention. Psychophysiological brain research, 1:192–195, 1990.

[71] Joline M Fan, Nuyujukian Paul, Jonathan C Kao, Cynthia A Chestek, Stephen I Ryu, and Krishna V Shenoy. Intention estimation in brain–machine interfaces. J. Neural Eng., 11(1):016004, 2014.

[72] Eduardo Fern´andezand Pablo Botella. Biotolerability of intracortical microelectrodes. Adv. Biosys., 2(1):1700115, January 2018. BIBLIOGRAPHY 131

[73] Pierre W Ferrez and Jos´edel R Millan. Error-related EEG potentials generated during simu- lated brain-computer interaction. IEEE Trans. Biomed. Eng., 55(3):923–929, March 2008.

[74] Pierre W Ferrez and Jos´edel R Mill´an. Simultaneous real-time detection of motor imagery and error-related potentials for improved BCI accuracy. In Proceedings of the 4th international brain-computer interface workshop and training course, pages 197–202. infoscience.epfl., 2008.

[75] Robert D Flint, Eric W Lindberg, Luke R Jordan, Lee E Miller, and Marc W Slutzky. Accurate decoding of reaching movements from field potentials in the absence of spikes. J. Neural Eng., 9(4):046006, August 2012.

[76] Robert D Flint, Michael R Scheid, Zachary A Wright, Sara A Solla, and Marc W Slutzky. Long-Term stability of motor cortical activity: Implications for brain machine interfaces and optimal feedback control. J. Neurosci., 36(12):3623–3632, March 2016.

[77] Justin D Foster, Paul Nuyujukian, Oren Freifeld, Hua Gao, Ross Walker, Stephen I Ryu, Teresa H Meng, Boris Murmann, Michael J Black, and Krishna V Shenoy. A freely-moving monkey treadmill model. J. Neural Eng., 11(4):046020, August 2014.

[78] George W Fraser, Steven M Chase, Andrew Whitford, and Andrew B Schwartz. Control of a brain-computer interface without spike sorting. J. Neural Eng., 6(5):055004, October 2009.

[79] Q G Fu, J I Suarez, and T J Ebner. Neuronal specification of direction and distance during reaching movements in the superior precentral premotor area and primary motor cortex of monkeys. J. Neurophysiol., 70(5):2097–2116, November 1993.

[80] Karunesh Ganguly and Jose M Carmena. Emergence of a stable cortical map for neuropros- thetic control. PLoS Biol., 7(7):e1000153, July 2009.

[81] Karunesh Ganguly, Dragan F Dimitrov, Jonathan D Wallis, and Jose M Carmena. Reversible large-scale modification of cortical networks during neuroprosthetic control. Nat. Neurosci., 14(5):662–667, April 2011.

[82] H Gao, R M Walker, P Nuyujukian, K A A Makinwa, K V Shenoy, B Murmann, and T H Meng. HermesE: A 96-channel full data rate direct neural interface in 0.13 mu m CMOS. IEEE J. Solid-State Circuits, 47(4):1043–1055, April 2012.

[83] Peiran Gao and Surya Ganguli. On simplicity and complexity in the brave new world of large-scale neuroscience. Curr. Opin. Neurobiol., 32:148–155, June 2015.

[84] Peiran Gao, Eric Trautmann, Byron M Yu, Gopal Santhanam, Stephen Ryu, Krishna Shenoy, and Surya Ganguli. A theory of multineuronal dimensionality, dynamics and measurement. November 2017. BIBLIOGRAPHY 132

[85] William J Gehring, Brian Goss, Michael G H Coles, David E Meyer, and Emanuel Donchin. A neural system for error detection and compensation. Psychol. Sci., 4(6):385–390, November 1993.

[86] Nicolas Gerig, Johnathan Mayo, Kilian Baur, Frieder Wittmann, Robert Riener, and Peter Wolf. Missing depth cues in virtual reality limit performance and quality of three dimensional reaching movements. PLoS One, 13(1):e0189275, January 2018.

[87] Sarah Gibson, Jack W Judy, and Dejan Markovi´c. Technology-aware algorithm design for neural spike detection, feature extraction, and dimensionality reduction. IEEE Trans. Neural Syst. Rehabil. Eng., 18(5):469–478, October 2010.

[88] Vikash Gilja, Paul Nuyujukian, Cindy A Chestek, John P Cunningham, Byron M Yu, Jo- line M Fan, Mark M Churchland, Matthew T Kaufman, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A high-performance neural prosthesis enabled by control algorithm design. Nat. Neurosci., 15(12):1752–1757, December 2012.

[89] Vikash Gilja, Paul Nuyujukian, Cindy A Chestek, John P Cunningham, Byron M Yu, Jo- line M Fan, Mark M Churchland, Matthew T Kaufman, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A high-performance neural prosthesis enabled by control algorithm design. Nat. Neurosci., 15(12):1752–1757, December 2012.

[90] Vikash Gilja, Paul Nuyujukian, Cindy A Chestek, John P Cunningham, Byron M Yu, Jo- line M Fan, Mark M Churchland, Matthew T Kaufman, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A high-performance neural prosthesis enabled by control algorithm design. Nat. Neurosci., 15(12):1752–1757, December 2012.

[91] Vikash Gilja, Chethan Pandarinath, Christine H Blabe, Paul Nuyujukian, John D Simeral, Anish A Sarma, Brittany L Sorice, J´anos A Perge, Beata Jarosiewicz, Leigh R Hochberg, Krishna V Shenoy, and Jaimie M Henderson. Clinical translation of a high-performance neural prosthesis. Nat. Med., 21(10):1142–1145, October 2015.

[92] Joshua I Glaser, Raeed H Chowdhury, Matthew G Perich, Lee E Miller, and Konrad P Kording. Machine learning for neural decoding. August 2017.

[93] Matthew D Golub, Byron M Yu, Andrew B Schwartz, and Steven M Chase. Motor cortical control of movement speed with implications for brain-machine interface control. J. Neuro- physiol., 112(2):411–429, July 2014.

[94] J Gordon, M F Ghilardi, and C Ghez. Accuracy of planar reaching movements. i. independence of direction and extent variability. Exp. Brain Res., 99(1):97–111, 1994. BIBLIOGRAPHY 133

[95] V Hariprasath, Jon Guerber, S-H Lee, and U-K Moon. Merged capacitor switching based SAR ADC with highest switching energy-efficiency. Electronics letters, 46(9):620–621, 2010.

[96] Pieter Harpe, Hao Gao, Rainier van Dommele, Eugenio Cantatore, and Arthur HM van Roer- mund. A 0.20 mm2 3 nW signal acquisition IC for miniature sensor nodes in 65 nm CMOS. IEEE Journal of Solid-State Circuits, 51(1):240–248, 2016.

[97] Reid R Harrison, Ryan J Kier, Cynthia A Chestek, Vikash Gilja, Paul Nuyujukian, Stephen Ryu, Bradley Greger, Florian Solzbacher, and Krishna V Shenoy. Wireless neural recording with single low-power integrated circuit. IEEE Trans. Neural Syst. Rehabil. Eng., 17(4):322– 329, August 2009.

[98] S I Helms Tillery, D M Taylor, and A B Schwartz. Training in cortical control of neuroprosthetic devices improves signal extraction from small neuronal ensembles. Rev. Neurosci., 14(1-2):107– 119, 2003.

[99] Leigh R Hochberg, Daniel Bacher, Beata Jarosiewicz, Nicolas Y Masse, John D Simeral, Joern Vogel, Sami Haddadin, Jie Liu, Sydney S Cash, Patrick van der Smagt, and John P Donoghue. Reach and grasp by people with tetraplegia using a neurally controlled robotic arm. Nature, 485(7398):372–375, May 2012.

[100] Leigh R Hochberg, Mijail D Serruya, Gerhard M Friehs, Jon A Mukand, Maryam Saleh, Abra- ham H Caplan, Almut Branner, David Chen, Richard D Penn, and John P Donoghue. Neuronal ensemble control of prosthetic devices by a human with tetraplegia. Nature, 442(7099):164–171, July 2006.

[101] Eve Hoggan, Stephen A Brewster, and Jody Johnston. Investigating the effectiveness of tactile feedback for mobile touchscreens. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, CHI ’08, pages 1573–1582, New York, , USA, 2008. ACM.

[102] Clay B Holroyd and Michael G H Coles. The neural basis of human error processing: rein- forcement learning, dopamine, and the error-related negativity. Psychol. Rev., 109(4):679–709, October 2002.

[103] Clay B Holroyd and Olave E Krigolson. Reward prediction error signals associated with a modified time estimation task. Psychophysiology, 44(6):913–917, November 2007.

[104] Mark L Homer, Arto V Nurmikko, John P Donoghue, and Leigh R Hochberg. Sensors and decoding for intracortical brain computer interfaces. Annu. Rev. Biomed. Eng., 15:383–405, 2013.

[105] Han-Jeong Hwang, Jeong-Hwan Lim, Young-Jin Jung, Han Choi, Sang Woo Lee, and Chang- Hwan Im. Development of an SSVEP-based BCI spelling system adopting a QWERTY-style LED keyboard. J. Neurosci. Methods, 208(1):59–65, June 2012. BIBLIOGRAPHY 134

[106] Masato Inoue, Motoaki Uchimura, and Shigeru Kitazawa. Error signals in motor cortices drive adaptation in reaching. Neuron, 90(5):1114–1126, June 2016.

[107] Masato Inoue, Motoaki Uchimura, and Shigeru Kitazawa. Error signals in motor cortices drive adaptation in reaching. Neuron, 90(5):1114–1126, June 2016.

[108] Zachary T Irwin, David E Thompson, Karen E Schroeder, Derek M Tat, Ali Hassani, Au- tumn J Bullard, Shoshana L Woo, Melanie G Urbanchek, Adam J Sachs, Paul S Cederna, William C Stacey, Parag G Patil, and Cynthia A Chestek. Enabling Low-Power, Multi-Modal neural interfaces through a common, Low-Bandwidth feature space. IEEE Trans. Neural Syst. Rehabil. Eng., 24(5):521–531, May 2016.

[109] I˜nakiIturrate, Ricardo Chavarriaga, Luis Montesano, Javier Minguez, and Jos´edel R Mill´an. Teaching brain-machine interfaces as an alternative paradigm to neuroprosthetics control. Sci. Rep., 5:13893, September 2015.

[110] Beata Jarosiewicz, Anish A Sarma, Daniel Bacher, Nicolas Y Masse, John D Simeral, Brittany Sorice, Erin M Oakley, Christine Blabe, Chethan Pandarinath, Vikash Gilja, Sydney S Cash, Emad N Eskandar, Gerhard Friehs, Jaimie M Henderson, Krishna V Shenoy, John P Donoghue, and Leigh R Hochberg. Virtual typing by people with tetraplegia using a self-calibrating intracortical brain-computer interface. Sci. Transl. Med., 7(313):313ra179, November 2015.

[111] J. F. Kaiser. On a simple algorithm to calculate the energy of a signal. 1:381–384, 1990.

[112] J F Kalaska, D A Cohen, M L Hyde, and M Prud’homme. A comparison of movement direction- related versus load direction-related activity in primate motor cortex, using a two-dimensional reaching task. J. Neurosci., 9(6):2080–2102, June 1989.

[113] J C Kao, S I Ryu, and K V Shenoy. Leveraging historical knowledge of neural dynamics to rescue decoder performance as neural channels are lost: Decoder hysteresis. In 2015 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pages 1061–1066, August 2015.

[114] J C Kao, S D Stavisky, D Sussillo, P Nuyujukian, and K V Shenoy. Information systems opportunities in Brain-Machine interface decoders. Proc. IEEE, 102(5):666–682, May 2014.

[115] Jonathan C Kao, Paul Nuyujukian, Stephen I Ryu, Mark M Churchland, John P Cunningham, and Krishna V Shenoy. Single-trial dynamics of motor cortex and their applications to brain- machine interfaces. Nat. Commun., 6:7759, July 2015.

[116] Jonathan C Kao, Paul Nuyujukian, Stephen I Ryu, and Krishna V Shenoy. A high-performance neural prosthesis incorporating discrete state selection with hidden markov models. IEEE Trans. Biomed. Eng., June 2016. BIBLIOGRAPHY 135

[117] Jonathan C Kao, Paul Nuyujukian, Stephen I Ryu, and Krishna V Shenoy. A High- Performance neural prosthesis incorporating discrete state selection with hidden markov mod- els. IEEE Trans. Biomed. Eng., 64(4):935–945, April 2017.

[118] Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Leveraging neural dynamics to extend functional lifetime of brain-machine interfaces. Sci. Rep., 7(1):7395, August 2017.

[119] Vaibhav Karkare, Hariprasad Chandrakumar, Dejan Rozgi´c,and Dejan Markovi´c. Robust, reconfigurable, and power-efficient biosignal recording systems. In IEEE Custom Integrated Circuits Conference (CICC), pages 1–8, 2014.

[120] K D Katyal, M S Johannes, S Kellis, T Aflalo, C Klaes, T G McGee, M P Para, Y Shi, B Lee, K Pejsa, C Liu, B A Wester, F Tenore, J D Beaty, A D Ravitz, R A Andersen, and M P McLoughlin. A collaborative BCI approach to autonomous control of a prosthetic limb system. In 2014 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pages 1479–1482, October 2014.

[121] Matthew T Kaufman, Mark M Churchland, Stephen I Ryu, and Krishna V Shenoy. Cor- tical activity in the null space: permitting preparation without movement. Nat. Neurosci., 17(3):440–448, March 2014.

[122] Matthew T Kaufman, Mark M Churchland, Stephen I Ryu, and Krishna V Shenoy. Cor- tical activity in the null space: permitting preparation without movement. Nat. Neurosci., 17(3):440–448, March 2014.

[123] Risa Kawai, Kawai Risa, Markman Timothy, Poddar Rajesh, Ko Raymond, Antoniu L Fan- tana, Ashesh K Dhawale, Adam R Kampff, and Bence P Olveczky.¨ Motor cortex is required for learning but not for executing a motor skill. Neuron, 86(3):800–812, 2015.

[124] J W Krakauer, M F Ghilardi, and C Ghez. Independent learning of internal models for kinematic and dynamic control of reaching. Nat. Neurosci., 2(11):1026–1031, November 1999.

[125] O E Krigolson and C B Holroyd. Evidence for hierarchical error processing in the human brain. Neuroscience, 137(1):13–17, 2006.

[126] O E Krigolson and C B Holroyd. Evidence for hierarchical error processing in the human brain. Neuroscience, 137(1):13–17, 2006.

[127] Olav E Krigolson, Cameron D Hassall, and Todd C Handy. How we learn to make decisions: rapid propagation of reinforcement learning prediction errors in humans. J. Cogn. Neurosci., 26(3):635–644, March 2014.

[128] Olav E Krigolson and Clay B Holroyd. Hierarchical error processing: different errors, different systems. Brain Res., 1155:70–80, June 2007. BIBLIOGRAPHY 136

[129] Olav E Krigolson and Clay B Holroyd. Predictive information and error processing: the role of medial-frontal cortex during motor control. Psychophysiology, 44(4):586–595, July 2007.

[130] Olav E Krigolson, Clay B Holroyd, Geraldine Van Gyn, and Mathew Heath. Electroencephalo- graphic correlates of target and outcome errors. Exp. Brain Res., 190(4):401–411, October 2008.

[131] Olav E Krigolson, Clay B Holroyd, Geraldine Van Gyn, and Mathew Heath. Electroencephalo- graphic correlates of target and outcome errors. Exp. Brain Res., 190(4):401–411, October 2008.

[132] J¨urgenKr¨uger,Fausto Caruana, Riccardo Dalla Volta, and Giacomo Rizzolatti. Seven years of recording from monkey cortex with a chronically implanted multiple microelectrode. Front. Neuroeng., 3:6, May 2010.

[133] K Kurata. Premotor cortex of monkeys: set- and movement-related activity reflecting ampli- tude and direction of wrist movements. J. Neurophysiol., 69(1):187–200, January 1993.

[134] Mikhail A Lebedev and Miguel A L Nicolelis. Brain-Machine interfaces: From basic science to neuroprostheses and neurorehabilitation. Physiol. Rev., 97(2):767–837, April 2017.

[135] Eric C Leuthardt, Gerwin Schalk, Jonathan R Wolpaw, Jeffrey G Ojemann, and Daniel W Moran. A brain-computer interface using electrocorticographic signals in humans. J. Neural Eng., 1(2):63–71, June 2004.

[136] Jie Li and Zheng Li. Sums of spike waveform features for motor decoding. Front. Neurosci., 11:406, 2017.

[137] Zheng Li, Joseph E O’Doherty, Mikhail A Lebedev, and Miguel A L Nicolelis. Adaptive decoding for brain-machine interfaces through bayesian parameter updates. Neural Comput., 23(12):3162–3204, December 2011.

[138] William A Liberti, L Nathan Perkins, Daniel P Leman, and Timothy J Gardner. An open source, wireless capable miniature microscope system. J. Neural Eng., 14(4):045001, August 2017.

[139] M H Lopez, S Castelluci, and I S MacKenzie. Text entry with the apple iphone and the nintendo wii. In Proceedings of the Twenty-Seventh Annual SIGCHI Conference on Human Factors in Computing Systems, Boston, USA, 2008.

[140] I Scott MacKenzie and R William Soukoreff. Text entry for mobile computing: Models and Methods,Theory and practice. Human–Computer Interaction, 17(2-3):147–198, September 2002. BIBLIOGRAPHY 137

[141] Wasim Q Malik, Wilson Truccolo, Emery N Brown, and Leigh R Hochberg. Efficient decoding with steady-state kalman filter in neural interface systems. IEEE Trans. Neural Syst. Rehabil. Eng., 19(1):25–34, February 2011.

[142] Valerio Mante, David Sussillo, Krishna V Shenoy, and William T Newsome. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature, 503:78, November 2013.

[143] Brandi T Marsh, Venkata S Aditya Tarigoppula, Chen Chen, and Joseph T Francis. Toward an autonomous brain machine interface: integrating sensorimotor reward modulation and reinforcement learning. J. Neurosci., 35(19):7374–7387, May 2015.

[144] James L McCreary and Paul R Gray. All-MOS charge redistribution analog-to-digital conver- sion techniques. IEEE Journal of Solid-State Circuits, 10(6):371–379, 1975.

[145] Adam E Mendrela, Jihyun Cho, Jeffrey A Fredenburg, Vivek Nagaraj, Theoden I Netoff, Michael P Flynn, and Euisik Yoon. A bidirectional neural interface circuit with active stimu- lation artifact cancellation and cross-channel common-mode noise suppression. IEEE Journal of Solid-State Circuits, 51(4):955–965, 2016.

[146] J Messier and J F Kalaska. Differential effect of task conditions on errors of direction and extent of reaching movements. Exp. Brain Res., 115(3):469–478, July 1997.

[147] J Messier and J F Kalaska. Comparison of variability of initial kinematics and endpoints of reaching movements. Exp. Brain Res., 125(2):139–152, March 1999.

[148] J Messier and J F Kalaska. Covariation of primate dorsal premotor cell activity with direction and amplitude during a memorized-delay reaching task. J. Neurophysiol., 84(1):152–165, July 2000.

[149] Corinne S Mestais, Guillaume Charvet, Fabien Sauter-Starace, Michael Foerster, David Ratel, and Alim Louis Benabid. WIMAGINE: wireless 64-channel ECoG recording implant for long term clinical applications. IEEE Trans. Neural Syst. Rehabil. Eng., 23(1):10–21, January 2015.

[150] R C Miall and D M Wolpert. Forward models for physiological motor control. Neural Netw., 9(8):1265–1279, November 1996.

[151] Tomislav Milekovic, Tonio Ball, Andreas Schulze-Bonhage, Ad Aertsen, and Carsten Mehring. Error-related electrocorticographic activity in humans during continuous movements. J. Neural Eng., 9(2):026007, April 2012.

[152] Tomislav Milekovic, Tonio Ball, Andreas Schulze-Bonhage, Ad Aertsen, and Carsten Mehring. Detection of error related neuronal responses recorded by electrocorticography in humans during continuous movements. PLoS One, 8(2):e55235, February 2013. BIBLIOGRAPHY 138

[153] Tomislav Milekovic, Milekovic Tomislav, Ball Tonio, Schulze-Bonhage Andreas, Aertsen Ad, and Mehring Carsten. Detection of error related neuronal responses recorded by electrocor- ticography in humans during continuous movements. PLoS One, 8(2):e55235, 2013.

[154] Wolfgang H R Miltner, Christoph H Braun, and Michael G H Coles. Event-Related brain potentials following incorrect feedback in a Time-Estimation task: Evidence for a “generic” neural system for error detection. J. Cogn. Neurosci., 9(6):788–798, 1997.

[155] Henrique Miranda, Vikash Gilja, Cindy A Chestek, Krishna V Shenoy, and Teresa H Meng. HermesD: A High-Rate Long-Range wireless transmission system for simultaneous multichan- nel neural recording applications. IEEE Trans. Biomed. Circuits Syst., 4(3):181–191, June 2010.

[156] Andrew R Mitz, Ramon Bartolo, Richard C Saunders, Philip G Browning, Thomas Talbot, and Bruno B Averbeck. High channel count single-unit recordings from nonhuman primate frontal cortex. J. Neurosci. Methods, 289:39–47, July 2017.

[157] P Read Montague, Steven E Hyman, and Jonathan D Cohen. Computational roles for dopamine in behavioural control. Nature, 431(7010):760–767, October 2004.

[158] Daniel Moran. Evolution of brain-computer interface: action potentials, local field potentials and electrocorticograms. Curr. Opin. Neurobiol., 20(6):741–745, December 2010.

[159] Chet T Moritz, Steve I Perlmutter, and Eberhard E Fetz. Direct control of paralysed muscles by cortical neurons. Nature, 456(7222):639–642, December 2008.

[160] Katharina Muelling, Arun Venkatraman, Jean-Sebastien Valois, John Downey, Jeffrey Weiss, Shervin Javdani, Martial Hebert, Andrew B Schwartz, Jennifer L Collinger, and J Andrew Bag- nell. Autonomy infused teleoperation with application to BCI manipulation. March 2015.

[161] Rikky Muller. Low Power, Scalable Platforms for Implantable Neural Recording. PhD thesis, University of California at Berkeley, May 2015.

[162] B. Murmann. The race for the extra decibel: A brief review of current adc performance trajectories. IEEE Solid State Circuits Magazine, 7(3):58–66, Summer 2015.

[163] S Musallam, B D Corneil, B Greger, H Scherberger, and R A Andersen. Cognitive control signals for neural prosthetics. Science, 305(5681):258–262, July 2004.

[164] S Musallam, B D Corneil, B Greger, H Scherberger, and R A Andersen. Cognitive control signals for neural prosthetics. Science, 305(5681):258–262, 9 July 2004.

[165] F A Mussa-Ivaldi. Do neurons in the motor cortex encode movement direction? an alternative hypothesis. Neurosci. Lett., 91(1):106–111, August 1988. BIBLIOGRAPHY 139

[166] Rajan Narasimha, Minwei Lu, Naresh R Shanbhag, and Andrew C Singer. BER-optimal analog-to-digital converters for communication links. IEEE Transactions on Signal Processing, 60(7):3683–3691, 2012.

[167] P Nuyujukian, J M Fan, V Gilja, P S Kalanithi, C A Chestek, and K V Shenoy. Monkey models for brain-machine interfaces: The need for maintaining diversity. In 2011 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, 2011.

[168] P Nuyujukian, J C Kao, S I Ryu, and K V Shenoy. A nonhuman primate brain computer typing interface. Proc. IEEE, PP(99):1–7, 2016.

[169] Paul Nuyujukian, Joline M Fan, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A high-performance keyboard neural prosthesis enabled by task optimization. IEEE Trans. Biomed. Eng., 62(1):21–29, January 2015.

[170] Paul Nuyujukian, Joline M Fan, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A high-performance keyboard neural prosthesis enabled by task optimization. IEEE Trans. Biomed. Eng., 62(1):21–29, January 2015.

[171] Paul Nuyujukian, Jonathan C Kao, Joline M Fan, Sergey D Stavisky, Stephen I Ryu, and Krishna V Shenoy. Performance sustaining intracortical neural prostheses. J. Neural Eng., 11(6):066003, December 2014.

[172] Paul Nuyujukian, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. A non-human primate brain computer typing interface. Proceedings of the IEEE, In press, 2016.

[173] Paul Nuyujukian, Chethan Pandarinath, Christine H Blabe, Leigh R Hochberg, Krishna V Shenoy, and Jaimie M Henderson. A bluetooth wireless brain-machine interface for general purpose computer use. page Program No. 748.01. Neuroscience Meeting Planner, 2015.

[174] I. Obeid and P. D. Wolf. Evaluation of spike-detection algorithms for a Brain-Machine interface application. IEEE Transactions on Biomedical Engineering, 51(6):905–911, June 2004.

[175] Emily R Oby, Sagi Perel, Patrick T Sadtler, Douglas A Ruff, Jessica L Mischel, David F Montez, Marlene R Cohen, Aaron P Batista, and Steven M Chase. Extracellular voltage threshold settings can be tuned for optimal encoding of movement and stimulus parameters. J. Neural Eng., 13(3):036009, June 2016.

[176] Joseph E O’Doherty, Mikhail A Lebedev, Peter J Ifft, Katie Z Zhuang, Solaiman Shokur, Hannes Bleuler, and Miguel A L Nicolelis. Active tactile exploration using a brain-machine- brain interface. Nature, 479(7372):228–231, October 2011. BIBLIOGRAPHY 140

[177] John G O’Leary and Nicholas G Hatsopoulos. Early visuomotor representations revealed from evoked local field potentials in motor and premotor cortical areas. J. Neurophysiol., 96(3):1492–1506, September 2006.

[178] Amy L Orsborn, Helene G Moorman, Simon A Overduin, Maryam M Shanechi, Dragan F Dimitrov, and Jose M Carmena. Closed-loop decoder adaptation shapes neural plasticity for skillful neuroprosthetic control. Neuron, 82(6):1380–1393, June 2014.

[179] Chethan Pandarinath, Paul Nuyujukian, Christine H Blabe, Brittany L Sorice, Jad Saab, Francis R Willett, Leigh R Hochberg, Krishna V Shenoy, and Jaimie M Henderson. High performance communication by people with paralysis using an intracortical brain-computer interface. Elife, 6, February 2017.

[180] Liam Paninski and John Cunningham. Neural data science: accelerating the experiment- analysis-theory cycle in large-scale neuroscience. October 2017.

[181] Fabian Pedregosa, Ga¨elVaroquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, Jake Van- derplas, Alexandre Passos, David Cournapeau, Matthieu Brucher, Matthieu Perrot, and Edouard´ Duchesnay. Scikit-learn: Machine learning in python. J. Mach. Learn. Res., 12(Oct):2825–2830, 2011.

[182] Sagi Perel, Patrick T Sadtler, Emily R Oby, Stephen I Ryu, Elizabeth C Tyler-Kabara, Aaron P Batista, and Steven M Chase. Single-unit activity, threshold crossings, and local field potentials in motor cortex differentially encode reach kinematics. J. Neurophysiol., 114(3):1500–1512, September 2015.

[183] J´anosA Perge, Mark L Homer, Wasim Q Malik, Sydney Cash, Emad Eskandar, Gerhard Friehs, John P Donoghue, and Leigh R Hochberg. Intra-day signal instabilities affect decoding performance in an intracortical neural interface system. J. Neural Eng., 10(3):036004, June 2013.

[184] J´anosA Perge, Shaomin Zhang, Wasim Q Malik, Mark L Homer, Sydney Cash, Gerhard Friehs, Emad N Eskandar, John P Donoghue, and Leigh R Hochberg. Reliability of directional information in unsorted spikes and local field potentials recorded in human motor cortex. J. Neural Eng., 11(4):046007, August 2014.

[185] Eric A Pohlmeyer, Babak Mahmoudi, Shijia Geng, Noeline W Prins, and Justin C Sanchez. Using reinforcement learning to provide stable brain-machine interface control despite neural input reorganization. PLoS One, 9(1):e87253, January 2014.

[186] Pavan Ramkumar, Brian Dekleva, Sam Cooler, Lee Miller, and Konrad Kording. Premotor and motor cortices encode reward. PLoS One, 11(8):e0160851, August 2016. BIBLIOGRAPHY 141

[187] Behzad Razavi. The strongarm latch [a circuit for all seasons]. IEEE Solid-State Circuits Magazine, 7(2):12–17, 2015.

[188] J¨ornRickert, Simone Cardoso de Oliveira, Eilon Vaadia, Ad Aertsen, Stefan Rotter, and Carsten Mehring. Encoding of movement direction in different frequency ranges of motor cortical local field potentials. J. Neurosci., 25(39):8815–8824, September 2005.

[189] A Riehle and J Requin. Monkey primary motor and premotor cortex: single-cell activity related to prior information about direction and extent of an intended movement. J. Neurophysiol., 61(3):534–549, March 1989.

[190] Robert Riener and Matthias Harders. Virtual Reality in Medicine. Springer Science & Business Media, April 2012.

[191] D A Rosenbaum. Human movement initiation: specification of arm, direction, and extent. J. Exp. Psychol. Gen., 109(4):444–474, December 1980.

[192] Abigail A Russo, Sean R Bittner, Sean M Perkins, Jeffrey S Seely, Brian M London, Antonio H Lara, Andrew Miri, Najja J Marshall, Adam Kohn, Thomas M Jessell, Laurence F Abbott, John P Cunningham, and Mark M Churchland. Motor cortex embeds muscle-like commands in an untangled population response. Neuron, 97(4):953–966.e8, February 2018.

[193] Terence D Sanger. Theoretical considerations for the analysis of population coding in motor cortex. Neural Comput., 6(1):29–37, January 1994.

[194] Gopal Santhanam, Stephen I Ryu, Byron M Yu, Afsheen Afshar, and Krishna V Shenoy. A high-performance brain-computer interface. Nature, 442(7099):195–198, July 2006.

[195] Gopal Santhanam, Stephen I Ryu, Byron M Yu, Afsheen Afshar, and Krishna V Shenoy. A high-performance brain-computer interface. Nature, 442(7099):195–198, 13 July 2006.

[196] Gopal Santhanam, Byron M Yu, Vikash Gilja, Stephen I Ryu, Afsheen Afshar, Maneesh Sahani, and Krishna V Shenoy. Factor-analysis methods for higher-performance neural pros- theses. J. Neurophysiol., 102(2):1315–1330, August 2009.

[197] G Schalk, K J Miller, N R Anderson, J A Wilson, M D Smyth, J G Ojemann, D W Moran, J R Wolpaw, and E C Leuthardt. Two-dimensional movement control using electrocorticographic signals in humans. J. Neural Eng., 5(1):75–84, March 2008.

[198] Hansj¨orgScherberger, Murray R Jarvis, and Richard A Andersen. Cortical local field potential encodes movement intentions in the posterior parietal cortex. Neuron, 46(2):347–354, April 2005. BIBLIOGRAPHY 142

[199] Nico M Schmidt, Benjamin Blankertz, and Matthias S Treder. Online detection of error-related potentials boosts the performance of mental typewriters. BMC Neurosci., 13:19, February 2012.

[200] Nico M Schmidt, Benjamin Blankertz, and Matthias S Treder. Online detection of error-related potentials boosts the performance of mental typewriters. BMC Neurosci., 13(1):19, 2012.

[201] David A Schwarz, Mikhail A Lebedev, Timothy L Hanson, Dragan F Dimitrov, Gary Lehew, Jim Meloy, Sankaranarayani Rajangam, Vivek Subramanian, Peter J Ifft, Zheng Li, Arjun Ramakrishnan, Andrew Tate, Katie Z Zhuang, and Miguel A L Nicolelis. Chronic, wire- less recordings of large-scale brain activity in freely moving rhesus monkeys. Nat. Methods, 11(6):670–676, June 2014.

[202] S H Scott, L E Sergio, and J F Kalaska. Reaching movements with similar hand paths but different arm orientations. II. activity of individual cells in dorsal premotor cortex and parietal area 5. J. Neurophysiol., 78(5):2413–2426, November 1997.

[203] Stephen H Scott. Optimal feedback control and the neural basis of volitional motor control. Nat. Rev. Neurosci., 5(7):532–546, July 2004.

[204] Mijail D Serruya, Nicholas G Hatsopoulos, Liam Paninski, Matthew R Fellows, and John P Donoghue. Brain-machine interface: Instant neural control of a movement signal. Nature, 416(6877):141–142, March 2002.

[205] Reza Shadmehr, Maurice A Smith, and John W Krakauer. Error correction, sensory prediction, and adaptation in motor control. Annu. Rev. Neurosci., 33:89–108, 2010.

[206] Maryam M Shanechi. Brain-Machine interface control algorithms. IEEE Trans. Neural Syst. Rehabil. Eng., December 2016.

[207] Maryam M Shanechi, Amy L Orsborn, and Jose M Carmena. Robust Brain-Machine interface design using optimal feedback control modeling and adaptive point process filtering. PLoS Comput. Biol., 12(4):e1004730, April 2016.

[208] Maryam M Shanechi, Amy L Orsborn, Helene G Moorman, Suraj Gowda, Siddharth Dangi, and Jose M Carmena. Rapid control and feedback rates enhance neuroprosthetic control. Nat. Commun., 8:13825, January 2017.

[209] Hannah R Sheahan, David W Franklin, and Daniel M Wolpert. Motor planning, not execution, separates motor memories. Neuron, 92(4):773–779, November 2016.

[210] L Shen and G E Alexander. Preferential representation of instructed target location versus limb trajectory in dorsal premotor area. J. Neurophysiol., 77(3):1195–1212, March 1997. BIBLIOGRAPHY 143

[211] Krishna V Shenoy, Daniella Meeker, Shiyan Cao, Sohaib A Kureshi, Bijan Pesaran, Christo- pher A Buneo, Aaron P Batista, Partha P Mitra, Joel W Burdick, and Richard A Andersen. Neural prosthetic control signals from plan activity. Neuroreport, 14(4):591–596, 24 March 2003.

[212] Krishna V Shenoy, Maneesh Sahani, and Mark M Churchland. Cortical control of arm move- ments: a dynamical systems perspective. Annu. Rev. Neurosci., 36:337–359, July 2013.

[213] Krishna V Shenoy, Maneesh Sahani, and Mark M Churchland. Cortical control of arm move- ments: a dynamical systems perspective. Annu. Rev. Neurosci., 36:337–359, July 2013.

[214] Lavi Shpigelman, Hagai Lalazar, and Eilon Vaadia. Kernel-ARMA for hand tracking and Brain-Machine interfacing during 3D motor control. In D Koller, D Schuurmans, Y Bengio, and L Bottou, editors, Advances in Neural Information Processing Systems 21, pages 1489– 1496. Curran Associates, Inc., 2009.

[215] J D Simeral, S-P Kim, M J Black, J P Donoghue, and L R Hochberg. Neural control of cursor trajectory and click by a human with tetraplegia 1000 days after implant of an intracortical microelectrode array. J. Neural Eng., 8(2):025027, April 2011.

[216] Brian A Smith, Xiaojun Bi, and Shumin Zhai. Optimizing touchscreen keyboards for gesture typing. In Proceedings of the 33rd Annual ACM Conference on Human Factors in Computing Systems, pages 3365–3374. ACM, April 2015.

[217] Kelvin So, Siddharth Dangi, Amy L Orsborn, Michael C Gastpar, and Jose M Carmena. Subject-specific modulation of local field potential spectral power during brain–machine inter- face control in primates. J. Neural Eng., 11(2):026002, 2014.

[218] Amir M Sodagar, Kensall D Wise, and Khalil Najafi. A fully integrated mixed-signal neural processor for implantable multichannel cortical recording. IEEE Transactions on Biomedical Engineering, 54(6):1075–1088, 2007.

[219] J F Soechting and M Flanders. Sensorimotor representations for pointing to targets in three- dimensional space. J. Neurophysiol., 62(2):582–594, August 1989.

[220] Martin Sp¨uler,Michael Bensch, Sonja Kleih, Wolfgang Rosenstiel, Martin Bogdan, and Andrea K¨ubler.Online use of error-related potentials in healthy users and people with severe motor impairment increases performance of a P300-BCI. Clin. Neurophysiol., 123(7):1328–1337, July 2012.

[221] Martin Sp¨uler,Sp¨ulerMartin, Bensch Michael, Kleih Sonja, Rosenstiel Wolfgang, Bogdan Martin, and K¨ublerAndrea. Online use of error-related potentials in healthy users and people BIBLIOGRAPHY 144

with severe motor impairment increases performance of a P300-BCI. Clin. Neurophysiol., 123(7):1328–1337, 2012.

[222] Martin Sp¨uler,Wolfgang Rosenstiel, and Martin Bogdan. Online adaptation of a c-VEP brain- computer Interface(BCI) based on error-related potentials and unsupervised learning. PLoS One, 7(12):e51077, December 2012.

[223] Lakshminarayan Srinivasan, Uri T Eden, Sanjoy K Mitter, and Emery N Brown. General- purpose filter design for neural prosthetic devices. J. Neurophysiol., 98(4):2456–2475, October 2007.

[224] S D Stavisky, J C Kao, J M Sorokin, S I Ryu, and K V Shenoy. System identification of brain- machine interface control using a cursor jump perturbation. In Neural Engineering (NER), 2015 7th International IEEE/EMBS Conference on, pages 643–647, April 2015.

[225] Sergey D Stavisky, Jonathan C Kao, Paul Nuyujukian, Stephen I Ryu, and Krishna V Shenoy. A high performing brain–machine interface driven by low-frequency local field potentials alone and together with spikes. J. Neural Eng., 12(3):036009, May 2015.

[226] Sergey D Stavisky, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Motor cortical visuomotor feedback activity is initially isolated from downstream targets in Output-Null neural state space dimensions. Neuron, 95(1):195–208.e9, July 2017.

[227] Sergey D Stavisky, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Trial-by-Trial motor cortical correlates of a rapidly adapting visuomotor internal model. J. Neurosci., 37(7):1721–1732, February 2017.

[228] Michel SJ Steyaert and Willy MC Sansen. A micropower low-noise monolithic instrumentation amplifier for medical purposes. IEEE Journal of Solid-State Circuits, 22(6):1163–1168, 1987.

[229] David Sussillo, Mark M Churchland, Matthew T Kaufman, and Krishna V Shenoy. A neural network that finds a naturalistic solution for the production of muscle activity. Nat. Neurosci., 18(7):1025–1033, July 2015.

[230] David Sussillo, Paul Nuyujukian, Joline M Fan, Jonathan C Kao, Sergey D Stavisky, Stephen Ryu, and Krishna Shenoy. A recurrent neural network for closed-loop intracortical brain– machine interface decoders. J. Neural Eng., 9(2):026027, March 2012.

[231] David Sussillo, Sergey D Stavisky, Jonathan C Kao, Stephen I Ryu, and Krishna V Shenoy. Making brain-machine interfaces robust to future neural variability. Nat. Commun., 7:13749, December 2016.

[232] J Tanji and E V Evarts. Anticipatory activity of motor cortex neurons in relation to direction of an intended movement. J. Neurophysiol., 39(5):1062–1068, September 1976. BIBLIOGRAPHY 145

[233] Dawn M Taylor, Stephen I Helms Tillery, and Andrew B Schwartz. Direct cortical control of 3D neuroprosthetic devices. Science, 296(5574):1829–1832, June 2002.

[234] Stephan F Taylor, Emily R Stern, and William J Gehring. Neural systems for error monitoring: recent findings and theoretical perspectives. Neuroscientist, 13(2):160–172, April 2007.

[235] E Todorov. Direct cortical control of muscle activation in voluntary arm movements: a model. Nat. Neurosci., 3(4):391–398, April 2000.

[236] Eric Trautmann, Sergey Stavisky, Subhaneil Lahiri, Katherine Ames, Matthew Kaufman, Stephen Ryu, Surya Ganguli, and Krishna Shenoy. Accurate estimation of neural population dynamics without spike sorting. December 2017.

[237] Hein T van Schie, Rogier B Mars, Michael G H Coles, and Harold Bekkering. Modulation of activity in medial frontal and motor cortices during error observation. Nat. Neurosci., 7(5):549–554, May 2004.

[238] Meel Velliste, Sagi Perel, M Chance Spalding, Andrew S Whitford, and Andrew B Schwartz. Cortical control of a prosthetic arm for self-feeding. Nature, 453(7198):1098–1101, June 2008.

[239] H S Venkatagiri. Clinical measurement of rate of reading and discourse in young adults. J. Fluency Disord., 24(3):209–226, September 1999.

[240] Saurabh Vyas, Nir Even-Chen, Sergey D Stavisky, Stephen I Ryu, Paul Nuyujukian, and Krishna V Shenoy. Neural population dynamics underlying motor learning transfer. Neuron, 97(5):1177–1186.e3, March 2018.

[241] P Waelti, A Dickinson, and W Schultz. Dopamine responses comply with basic assumptions of formal learning theory. Nature, 412(6842):43–48, July 2001.

[242] Wei Wang, Jennifer L Collinger, Alan D Degenhart, Elizabeth C Tyler-Kabara, Andrew B Schwartz, Daniel W Moran, Douglas J Weber, Brian Wodlinger, Ramana K Vinjamuri, Robin C Ashmore, John W Kelly, and Michael L Boninger. An electrocorticographic brain interface in an individual with tetraplegia. PLoS One, 8(2):e55344, February 2013.

[243] Yan Wang, Wang Yan, Shima Keisetsu, Sawamura Hiromasa, and Tanji Jun. Spatial dis- tribution of cingulate cells projecting to the primary, supplementary, and pre-supplementary motor areas: a retrograde multiple labeling study in the macaque monkey. Neurosci. Res., 39(1):39–49, 2001.

[244] B Widrow and S D Stearns. Adaptive signal processing. Englewood Cliffs, , Prentice-Hall, Inc., 1985, 491 p., 1985. BIBLIOGRAPHY 146

[245] Francis R Willett, Brian A Murphy, William D Memberg, Christine H Blabe, Chethan Pan- darinath, Benjamin L Walter, Jennifer A Sweet, Jonathan P Miller, Jaimie M Henderson, Kr- ishna V Shenoy, Leigh R Hochberg, Robert F Kirsch, and A Bolu Ajiboye. Signal-independent noise in intracortical brain-computer interfaces causes movement time properties inconsistent with fitts’ law. J. Neural Eng., 14(2):026010, February 2017.

[246] S P Wise. The primate premotor cortex: past, present, and preparatory. Annu. Rev. Neurosci., 8:1–19, 1985.

[247] B Wodlinger, J E Downey, E C Tyler-Kabara, A B Schwartz, M L Boninger, and J L Collinger. Ten-dimensional anthropomorphic arm control in a human brain-machine interface: difficulties, solutions, and limitations. J. Neural Eng., 12(1):016011, February 2015.

[248] J R Wolpaw, H Ramoser, D J McFarland, and G Pfurtscheller. EEG-based communica- tion: improved accuracy by response verification. IEEE Trans. Rehabil. Eng., 6(3):326–333, September 1998.

[249] D M Wolpert and Z Ghahramani. Computational principles of movement neuroscience. Nat. Neurosci., 3 Suppl:1212–1217, November 2000.

[250] Wei Wu and Nicholas G Hatsopoulos. Real-time decoding of nonstationary neural activity in motor cortex. IEEE Trans. Neural Syst. Rehabil. Eng., 16(3):213–222, June 2008.

[251] Zhi Yang, Qi Zhao, Edward Keefer, and Wentai Liu. Noise characterization, modeling, and reduction for in vivo neural recording. Advances in Neural Information Processing Systems, pages 2160–2168, 2009.

[252] Ming Yin, David A. Borton, Jacob Komar, Naubahar Agha, Yao Lu, Hao Li, Jean Laurens, Yiran Lang, Qin Li, Christopher Bull, Lawrence Larson, David Rosler, Erwan Bezard, Gr´egoire Courtine, and Arto V. Nurmikko. Wireless neurosensor for full-spectrum electrophysiology recordings during free behavior. Neuron, 84(6):1170–1182, dec 2014.

[253] Neta Zach, Dorrit Inbar, Yael Grinvald, Hagai Bergman, and Eilon Vaadia. Emergence of novel representations in primary motor cortex and premotor neurons during associative learning. J. Neurosci., 28(38):9545–9556, September 2008.

[254] Shumin Zhai, Michael Hunter, and Barton A Smith. Performance optimization of virtual keyboards. Human–Computer Interaction, 17(2-3):229–269, September 2002.

[255] H Zhang, R Chavarriaga, Z Khaliliardali, L Gheorghe, I Iturrate, and J d R Mill´an. EEG- based decoding of error-related brain activity in a real-world driving task. J. Neural Eng., 12(6):066028, December 2015.