using glmfit and/or manova

3 views (last 30 days)
John Layne
John Layne on 4 Jan 2016
Edited: Walter Roberson on 3 Mar 2025
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.

Answers (1)

Aditya
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:

Tags

Community Treasure Hunt

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

Start Hunting!