2 way repeated measures anova

27 ビュー (過去 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 Center および File ExchangeRepeated Measures and MANOVA についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by