using glmfit and/or manova
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Aditya
on 3 Mar 2025
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 Comments
See Also
Categories
Find more on Repeated Measures and MANOVA 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!