Reps in Friedman test
15 views (last 30 days)
Show older comments
Hi, I want to do Friedman test on a test data where data from an individual has been collected for 18 days. I have 4 groups with 5, 7, 8, and 6 individuals in each group. If I am understanding correctly, then the data should be in the following format:
[D11 D11
D21 D21
D31 D31
D12 D12];
So basically , each column would have 18*n group individuals and each column would represent different group. I want to make sure I am understanding the reqs correctly. Also, how would I represent the reps in this case? The code gives me bad rep number.
Thank you.
2 Comments
Umar
on 4 Aug 2024
Edited: Walter Roberson
on 4 Aug 2024
Hi @Rashi Monga,
Given that you have 4 groups with 5, 7, 8, and 6 individuals in each group, you want to create a matrix where each column represents a different group, and each row corresponds to the data collected over the 18 days.The correct way to organize the data in the matrix would be as follows:
[D11 D21 D31 D41
D12 D22 D32 D42
D13 D23 D33 D43
...
D18 D28 D38 D48]
So, in this arrangement, each row represents a day of data collection, each column corresponds to a specific group and the data for each individual in a group is organized vertically within the respective group's column.
You can use friedman() function to conduct a Friedman test in MATLAB based on your predefined dataset. To illustrate it with example, first, organize the data in a matrix format where each column represents a different group, and each row represents the observations for each day. Then, use the friedman function in MATLAB to conduct the Friedman test on the dataset. I will illustrate by example,
% Define the data for each group (replace with your actual data)
group1 = rand(18, 5); % 18 days, 5 individuals in group 1
group2 = rand(18, 7); % 18 days, 7 individuals in group 2
group3 = rand(18, 8); % 18 days, 8 individuals in group 3
group4 = rand(18, 6); % 18 days, 6 individuals in group 4
% Combine the data into a single matrix for the Friedman test
data = [group1, group2, group3, group4];
% Perform the Friedman test
[p, tbl, stats] = friedman(data, 1, 'off');
% Display the results
disp('Friedman Test Results:');
disp(['p-value: ', num2str(p)]);
disp('Friedman Test Table:');
disp(tbl);
disp('Friedman Test Statistics:');
disp(stats);
So, you can see that random data for each group (replace with your actual data) is generated. Then, the data is combined into a single matrix where each column represents a group. Afterwards, performed the Friedman test using the friedman function and display the p-value, test table, and statistics. Please
make sure to replace the random data generation with your actual dataset. By structuring your data in this way, you can avoid bad repetition number errors and conduct the Friedman test successfully on your grouped data.
For more information on this function, please refer to,
Hope, this answers your question.
Answers (0)
See Also
Categories
Find more on Analysis of Variance and Covariance 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!