Input for ARfit ? (EEG analysis)

58 views (last 30 days)
Annaëlle
Annaëlle on 5 Nov 2024 at 15:43
Commented: William Rose on 12 Nov 2024 at 14:26
Hello,
I am trying to use the ARfit toolbox on EEG data, more specifically the arfit function itself, but I can't figure out what format the input should be in.
It says on the toolbox page that "The input matrix v must contain the time series data, with columns of v representing variables and rows of v representing observations" but I don't understand what it means. What I have is a vector where the rows are the EEG channels, and the columns are the signal values for each data point. However, it clearly doesn't work (either returns an error "time series too short", or it runs but the output is wrong (siglev = 0 with the function arres)).
I'm hoping someone there know how to use the toolbox better than I do... Thanks in advance.

Answers (2)

William Rose
William Rose on 5 Nov 2024 at 16:06
Edited: William Rose on 5 Nov 2024 at 16:08
[Edit: fix spelling.]
Have you run the script ardem.m, which is part of the ARfit toolbox? Does it produce reasonable output?
Assuming it does, I would modify ardem, so that it uses two columns of your data, instead of using the simulated data that it does use. To do this, change line
v = arsim(w, A, C, 200); % generate simulated data v (200x2 array)
to something like
myData=load('myData.txt'); % read data from file
v=myData(1:200,1:2); % v=rows 1-200 & columns 1 and 2 of data
The details of the new lines above will vary depending on which columns you want to use, etc. But you get the idea. See what happens.
You can also start a discussion on the FileExchange site for that toolbox.
Attach a sample data file here, if you want more assistance.
  2 Comments
Annaëlle
Annaëlle on 5 Nov 2024 at 16:23
No issue running ardem.m.
However, it clearly doesn't work (either returns an error "time series too short", or if it runs but the output is wrong (siglev = 0 with the function arres)). -> This is what happens when I load my data into v, hence why I'm asking for help.
Would it be possible for you to clarrify what the rows and the columns in your data array correspond to?

Sign in to comment.


Walter Roberson
Walter Roberson on 5 Nov 2024 at 19:40
What I have is a vector where the rows are the EEG channels, and the columns are the signal values for each data point.
Your input is in the wrong form for the toolbox.
Each EEG channel should be considered independent. Going to the next row of the data does not correspond to going to the next time-point of the data.
Potentially if you were to flip the array it just might be the right order... provided that what is currently the colums that are signal values for each data point, happen to reflect different times.
You need
channel1_time1 channel2_time1 channel3_time1
channel1_time2 channel2_time2 channel3_time2
channel1_time3 channel2_time3 channel3_time3
channel1_time4 channel2_time4 channel3_time4
and so on.
  7 Comments
Annaëlle
Annaëlle on 12 Nov 2024 at 9:13
Thank you so much for the detailed explanation, it really helped!
William Rose
William Rose on 12 Nov 2024 at 14:26
@Annaëlle, you're welcome.
Good luck with your research.

Sign in to comment.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!