Irreproducibility of anovan on Mac vs. PC implementations of MATLAB
4 次查看(过去 30 天)
显示 更早的评论
We are experiencing issues with a basic implementation of anovan yielding different F statistics when the same code is run on different computers. The biggest difference is between Mac and PCs, but there are also differences among multiple laptops of the same type. If we load the following dataset (Testdata.mat) and then attempt to call anovan as follows, we get a different answer on a Mac:
compared to what we obtain on a PC (below). The problem persists when we remove nesting, change computers, etc. Note that the sum-of-squares and mean-squared estimates are identical, but the F statistics diverge indicating differences in how the degrees of freedom are calculated. We appreciate any guidance on this matter.
load Testdata
anovan(data,grouplabels,'continuous',1,'random',3, ...
'varnames',{'Day' 'Volume' 'Replicate'},'model','interaction', ...
'nested',[0 0 0; 0 0 1; 0 0 0]);
4 个评论
dpb
2023-8-29
Realistically, that probably will take a TMW bug/support request to get to the bottom of, then.
There is at least one other regular here who has Mac who may see this and may be inclined to delve deeper, but I don't know that he has the wherewithal to generate/compare the result on the Windows side.
I simply don't have time to dig much deeper at the moment, sorry...
回答(1 个)
Shivansh
2024-1-5
Hi Kevin!
I understand that you are getting different results for F statistics when the same code is run on different computers. The difference is maximum when calculated on “Mac” than other PCs.
I have faced a similar issue and found a possible workaround to resolve it. Please follow the below the steps which involves editing the “anovan.m” file in Matlab to resolve the issue,
- Open MATLAB and run the following command in the command window.
edit anovan.m
- Copy the entire code content into a new file "anovan_temp.m"
- Modify line 680 as shown below
tol = 100 * max(size(R)) * eps(R(1,1)); % before
tol = 100 * max(size(adjx1)) * eps(R(1,1)); % after
- Save the file in any directory.
- Navigate to the path of the original "anovan.m" file in File Explorer
- E.g 'C:\Program Files\MATLAB\R2023a\toolbox\stats\stats'
- Rename the "anovan.m" file to "anovan_old.m"
- Paste the "anovan_temp.m" file in the same directory as "anovan_old.m"
- Rename "anovan_temp.m" to "anovan.m".
- Restart MATLAB and run the command for "anovan".
You can refer to the following link to get more information on “anovan”: https://in.mathworks.com/help/stats/anovan.html.
Hope it helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!