R/EstimateResponseDelayByMomentMatching.R
EstimateResponseDelayByMomentMatching.Rd
A function that detects the delay of a response relative to the odor onset by finding the delay with maximum cross correlation of the given response rate timecourse, with that of the odor onset convolved with a decaying exponential. The parameters of the exponential are found by moment matching.
EstimateResponseDelayByMomentMatching(y, x0, verbose = FALSE, plot = FALSE, minDelay = 0, fitOdorProfileOnError = TRUE)
y | A length T vector of the mean firing rate of the neuron in a series of bins. |
---|---|
x0 | A binary length T vector indicating the odor window. |
verbose | Whether to print out the results |
plot | Whether to plot the delayed exponential on top of the firing rate. |
minDelay | The minimum delay value that can be used. |
fitOdorProfileOnError | Whether to fit the odor profile itself if learning the filter parameters failed. |
A list consisting of
The amplitude of the exponential.
The autoregressive coefficient of the exponential
The time constant of the exponential. a1 = exp(-1/tau).
The baseline firing rate.
The delay with the highest correlation.
A string. "OK" if the parameters could be learned, "ERROR" if not.