Can glmfit() be used with time/epoch sampled data?

3 ビュー (過去 30 日間)
Psemaj
Psemaj 2015 年 5 月 7 日
回答済み: Aditya 2025 年 7 月 14 日
Hello, I am new to logistic regression and classification. Simply put, if I have N observations or trials of time-sampled data with their classes, can I use glmfit()?
For example, 20 trials of 1 second epochs, sampled at 10 Hz, and 12 of these trials are classed as "good" while the other 8 are "bad". All the examples of glmfit's use that I've seen have one or more predicators that aren't temporally sensitive. Things like "weight", "size", or "colour". Whereas I'm more interested in a 1 second window of a fluctuating voltage. Can glmfit do this or am I after a different function?
TIA for your help.

回答 (1 件)

Aditya
Aditya 2025 年 7 月 14 日
Hi Psemaj,
Yes, you can use glmfit() for your data if you treat each trial’s time series as a feature vector. In this approach, each trial becomes one observation, with its 10 time-sampled voltage values serving as the predictors (features). Your data matrix should be organized so that each row corresponds to a trial and each column to a specific time point within the 1-second window. The response vector should indicate the class label for each trial However, be aware that with only 20 trials and 10 features, you might risk overfitting, and the time points are likely correlated. Sometimes, summarizing the time series can improve results, but the basic use of glmfit() is straightforward
% Suppose 'data' is a 20x10 matrix (trials x timepoints)
% and 'labels' is a 20x1 vector (1 = good, 0 = bad)
b = glmfit(data, labels, 'binomial');

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by