View source: R/htbCountSpike.R
htbCountSpike | R Documentation |
Counts number of spikes or firing rate an htbRas object.
htbCountSpike(ras, from = NULL, to = NULL, type = "m")
ras |
An |
from |
A numeric or string.
The start of the targeted period you want to examine in millisecond
(relative to the aligning event you used in creating |
to |
A numeric or string.
Same to |
type |
A string either |
After you aligned and visualized neural activity
by creating an htbRas
object,
you will then want to perform statistical tests
for the difference in firing between task conditions.
To count number of spikes in the htbRas
object,
you can use htbCountSpike()
function.
Because htbRas
objects are already aligned by
certain task event (usually the most important
task event you are targeting),
you need to just designate the range of the period
by from
and to
arguments.
The spike counts within the range are calculated
for each of the conditions in the htbRas
object.
The result is returned as a list,
whose length and numbers of elements contained
equal to the original number of conditions and numbers of trials
in the htbRas
object, respectively.
htbCountSpike()
can also return the firing rates
instead of the raw spike counts,
that may be more useful when you need to further
compare the neural activation between periods with different ranges
(and therefore this is set as the default behavior of the function).
A list. Each element contains
the spike counts or firing rates of the corresponding condition
in the provided htbRas
object.
alignment <- list(CUEON_L = c(-1500, 2000), CUEON_R = c(-1500, 2000))
incld <- list(TRIALSTART = c(-2000, 0), TRIALEND = c(0, 2000))
excld <- list(ERROR = c(0, 2000))
## Not run:
db_sp <- htbGetDb("spike.htb")
db_ev <- htbGetDb("event.htb")
ras <- htbGetRas(db_sp, db_ev, alignment,
incld = incld, excld = excld)
s <- htbCountSpike(ras, 0, 500)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.