using glmfit and/or manova
조회 수: 3 (최근 30일)
이전 댓글 표시
Pretty sure I'm doing this wrong and could use help. Have two populations of subjects. Take 6 individuals from each. Administer 50 different stimuli to each individual (stimuli are qualitatively different, not quantitatively). Need to see if there is an overall difference in 50 responses due to population, and if any responses to specific stimuli are different between populations. I have done this:
[b,d,stats] = glmfit([pop stim pop.*stim],[resp]);
where pop = 1 or -1, stim = 1,2,...50.
댓글 수: 0
답변 (1개)
Aditya
2025년 3월 3일
HI John,
To analyze whether there is an overall difference in responses between two populations and to identify any specific stimuli that elicit different responses, you can use a Generalized Linear Model (GLM) approach. However, setting up the model correctly is crucial to obtaining meaningful results.
Here is an example code for the same:
% Assuming you have the following variables:
% pop: Population indicator (12 subjects * 50 stimuli = 600 entries)
% stim: Stimulus indicator (1 to 50 repeated for each subject)
% resp: Response variable (600 entries)
% Create a design matrix for the GLM
X = [pop, stim, pop.*stim];
% Fit the GLM
[b, dev, stats] = glmfit(X, resp, 'normal'); % Use 'normal' or another appropriate distribution
% Display the results
disp('Coefficients:');
disp(b);
disp('P-values:');
disp(stats.p);
% Interpretation:
% b(1): Intercept
% b(2): Effect of population
% b(3): Effect of stimulus
% b(4): Interaction effect between population and stimulus
% Check p-values to determine significance
% If the p-value for the interaction term (b(4)) is significant, it suggests a differential response to stimuli between populations.
Here is the documentation link for glmlink:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Repeated Measures and MANOVA에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!