フィルターのクリア

Identifying if reaction times are 3 standard deviations away from mean

1 回表示 (過去 30 日間)
Rania Hanna
Rania Hanna 2022 年 9 月 19 日
コメント済み: Rania Hanna 2022 年 9 月 20 日
have a data set of several thousand values.
There are 10 unique subj_indx, 1 through 10. Each one represents an experimental subject. Each subject has a bunch of reaction times, rt.
I am new to Matlab and don't understand how to write for loops. I know I need to run through the entire dataset, and identify outlier reaction time trials, without using isoutlier function. This is because I want to be ale to identify whether each RT trial is > 3 standard deviations away from the mean RT, and then mark that trial in a new vector as "1", otherwise, mark it as "0."
I know Matlab has standard deviation and mean functinos, but am not sure how to connect everything together for this code.
I don't know where to start other than:
rt=subject_data.rt;
for id = 1:length(subj_idx)%loop for each unique id value
%rtIdx = 1:length(rt)
currentid = rt(rtIdx);
rtIdx = 0;
and I'm not sure even that's correct.
  4 件のコメント
Steven Lord
Steven Lord 2022 年 9 月 20 日
See the description of the "mean" method on that isoutlier documentation page to which I linked.
Rania Hanna
Rania Hanna 2022 年 9 月 20 日
Perfect, thanks so much!

サインインしてコメントする。

回答 (2 件)

Chunru
Chunru 2022 年 9 月 20 日
編集済み: Chunru 2022 年 9 月 20 日
% rt=subject_data.rt;
rt = randn(300, 1) * 3 + 1; % genate some random data
mu = mean(rt)
mu = 1.2843
sigma = std(rt)
sigma = 3.0914
idx = abs((rt-mu)) > 1*sigma; % use 3 sigma when samples are large
[rt idx]
ans = 300×2
2.6351 0 -0.5263 0 -1.5895 0 2.5097 0 4.4268 1.0000 1.5017 0 -3.1915 1.0000 -1.7580 0 1.9555 0 1.5195 0

Steven Lord
Steven Lord 2022 年 9 月 20 日
Take a look at the "mean" method for the isoutlier function.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by