Anova - Oneway / Twoway

4 Ansichten (letzte 30 Tage)
vincent demunck
vincent demunck am 24 Mär. 2021
Beantwortet: Sai Pavan am 12 Apr. 2024
Hello All,
I'm currently trying to analyze data I gathered experimentally to see if the points actually statistically differ from each other. So in the code below, prob355, prob532, prob1064 correspond to probabilities I gathered experimentally in 3 different settings. Each of the entries in these specific vectors correspond to a different condition for that setting. Such that for the conditions entry prob355(1) = prob532(1) = prob1064(1) and prob355(2) = prob532(2) = prob1064(2) etc.
The comparison I would want to make is basically between prob355(1) = prob532(1) = prob1064(1) and than also for prob355(2) = prob532(2) = prob1064(2) etc. So far, through Google, I have found that Two way Anova would be a better test to do so than my first guess the two way student's t test. However, currently i'm strugling to find the right way to use Anova2 as to make sure it compares the right conditions with each other. Especially, when looking at the syntax I'm confused as how to set up my Matrix for Anova2 in matlab for it to work properly.
I hope this clearly explains the goal of my comparison.
So, If anyone knows a better way of making this comparison or a suggestions as how to set up the matrix for the two way Anova comparison I would be very happy to hear it.
Thanks in advance,
Vincent
clear all, close all, clc;
prob355 = [0.06672, 0.07473, 0.14813, 0.25516];
prob532 = [0.07226, 0.08718, 0.09631, 0.14276];
nucprob1064 = [0.05979, 0.09020, 0.10891, 0.11307];
prob355_2 = [0.06672; 0.07473; 0.14813; 0.25516];
prob532_2 = [0.07226; 0.08718; 0.09631; 0.14276];
prob1064_2 = [0.05979; 0.09020; 0.10891; 0.11307];
model_error_355 = [0.03255, 0.03986, 0.01321, 0.01928];
model_error_532 = [0.01370, 0.00880, 0.00856, 0.04257];
model_error_1064 = [0.03150, 0.02441, 0.02307, 0.02059];
%set up overall vectors
Overall = [prob1064; prob532; prob355]; %1064,532,355
Overall_2 = [prob1064_2, prob532_2, prob355_2]; %1064,532,35
%For Anova the collumns most correspond to 1 factor and the rows most
%correspond to another vector!
% in the first case the columns are the I's and the rows are the w's.
%in the second case the columns are w's and thw rows are the i's.
Number_w = 3;
Number_i = 4;
%Anova_first case
Anova1 = anova1(Overall);
Anova2 = anova2(Overall,Number_i);
%Anova second case
Anova1_2 = anova1(Overall_2);
Anova2_2 = anova2(Overall_2,Number_w);

Antworten (1)

Sai Pavan
Sai Pavan am 12 Apr. 2024
Hello Vincent,
I understand that you want to analyze your experimental data with the aim to compare probabilities across three settings under different conditions.
The two-way ANOVA is a suitable choice as it will help us investigate the effects of two factors on the measured probabilities, and whether there's an interaction between these factors. For the "anova2" function, the data should be organized in a matrix where rows represent levels of one factor and columns represent levels of another. We need to stack the probability vectors for one factor vertically to form this matrix, ensuring each column corresponds to the same condition across all values of that chosen factor.
Please refer to the below code snippet that demonstrates how the data can be organized:
dataMatrix = [prob355; prob532; prob1064]';
numConditions = 4; % Number of conditions
[p, tbl, stats] = anova2(dataMatrix, numConditions); % Perform Two-Way ANOVA
Please refer to the below documentation to learn more about the "anova2" function: https://www.mathworks.com/help/stats/anova2.html
Hope it helps!

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by