2 way repeated measures anova
28 views (last 30 days)
Show older comments
Hi everyone,
I have data of firing responses of 6 neurons for 7 different current injections (20:20:140), before and after the application of a drug.
So basically every neuron has 14 measurements.
What is the correct way to perform two way repeated measurs anova test to find out the drug effect?
Thank you!
0 Comments
Answers (1)
Shivansh
on 20 Mar 2024
Hi Ben!
It seems that you want to perform a two-way repeated measures ANOVA in MATLAB to analyze the effects of drug application on the firing responses of neurons across different current injections. You will need to structure your data appropriately and use the "fitrm" and "ranova" functions.
I have provided a sample MATLAB code that performs the ANOVA analysis on the given data:
% Read the data from the Excel file
filename = 'Data_anova.xlsx';
data = readtable(filename);
% Handle NaN values - for simplicity, removing any rows with NaN values.
data = rmmissing(data);
% Convert categorical variables
data.cell_ID = categorical(data.cell_ID);
data.condition = categorical(data.condition);
% Fit the repeated measures model without explicitly specifying 'WithinDesign'
rm = fitrm(data, 'x_20_,x_40_,x_60_,x_80_,x_100_,x_120_,x_140_~condition');
% Perform the repeated measures ANOVA
ranovatbl = ranova(rm);
% Display the results
disp(ranovatbl);
The above code demonstrates a simple approach for repeated measures ANOVA analysis. You can try modifying the above approach by reshaping the data table to have one data point in one row and performing two-way repeated measures ANOVA in MATLAB.
You can refer to the following documentations for more information:
I hope it helps!
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!