2 way repeated measures anova

26 次查看(过去 30 天)
Ben Title
Ben Title 2024-3-8
回答: Shivansh 2024-3-20
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!

回答(1 个)

Shivansh
Shivansh 2024-3-20
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!

类别

Help CenterFile Exchange 中查找有关 Repeated Measures and MANOVA 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by