How do I do Regression for multiple subjects

Hi
This a stats question for regression analysis
I have data for 19 subjects who did 8 blocks of a task.
I want to see if data increase "significantly" across blocks.
Which option is correct (statistically speaking)
They give different results!!
Option 1: Fit every subject and then t-test on the coefficient of rate of change (slope)
coeff = [];
for s=1:19
fit = fitlm(1:8, data(s,:)) ;
coeff(s,1) = fit.Coefficients.Estimate(2) ;
end
[h,p,ci,stats] = ttest(coeff)
p = 0.1030
Option 2: Average across all subject and then run fitlm (on the group average) and use the stats in the fit LinearModel
M = mean(data) ;
fit = fitlm(1:8, M) ;
fit.Coefficients.pValue(2) = 0.155
thanks
pb

답변 (2개)

dpb
dpb 대략 1시간 전
이동: dpb 대략 1시간 전
Strictly speaking, you're supposed to know the test for hypothesis before designing and running the experiment.
The Q? here is what is the actual null hypothesis to test? If the hypotheis is one that there is a difference in difficulty between tasks, then the better test would be Friedman...if the question is whether there's a trend in difficulty versus test, that's different. Then it's a Q? of whether it's for the population as a whole or for each individual.
Without additional background on the test and objectives, I'd suggest Friedman.
data=readmatrix('data.txt');
stackedplot([data mean(data,2)])
friedman(data);
It is pretty low for significance, but you have no replications. As the bottom plot shows, there does appear to be a slight curvature in the average versus block although it would be difficult to show significance I suspect (I didn't try).
If the Friedman test were to turn out significant there are then post-hoc tests that can be utilized to identify which specifically differ.
Pat
Pat 대략 6시간 전

0 개 추천

You are not a stats person, you shoudl not have tried to answer this question. You obviously do not know about that topic. You took someone else's chance to answer my questionand fix my issue.
Please do not respond.

질문:

Pat
2026년 5월 27일 16:40

답변:

Pat
대략 6시간 전

Community Treasure Hunt

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

Start Hunting!

Translated by