function RT_SIG = STAT_F_TEST(PR_X,PR_Y,PR_X_MEAN,PR_Y_MEAN)
%RT_SIG = STAT_F_TEST(PR_X,PR_Y,PR_X_MEAN,PR_Y_MEAN)
%
% This function performs a test for homoscedasticity (equal variance)
% for two sets of sample data PR_X and PR_Y using the two sample
% F-test. If the population means are known, it can be specified
% in PR_X_MEAN and PR_Y_MEAN. If the population means are unknown,
% leave these parameters unspecified or pass the empty matrix, [].
% Do not simply pass the sample means.
%
% Parameters:
% PR_X, PR_Y - a vector of samples from the two populations.
% These vectors do not need to be the same length.
% PR_X_MEAN, PR_Y_MEAN - the population means (scalar) from which the
% samples were drawn, if known.
if nargin < 3
PR_X_MEAN = [];
end
if nargin < 4
PR_Y_MEAN = [];
end
if isempty(PR_X_MEAN)
LV_X_MEAN = mean(PR_X);
if isreal(PR_X)
LV_X_DOF = length(PR_X)-1;
else
LV_X_DOF = 2*(length(PR_X)-1);
end
else
LV_X_MEAN = PR_X_MEAN;
if isreal(PR_X)
LV_X_DOF = length(PR_X);
else
LV_X_DOF = 2*length(PR_X);
end
end
if isempty(PR_Y_MEAN)
LV_Y_MEAN = mean(PR_Y);
if isreal(PR_Y)
LV_Y_DOF = length(PR_Y)-1;
else
LV_Y_DOF = 2*(length(PR_Y)-1);
end
else
LV_Y_MEAN = PR_Y_MEAN;
if isreal(PR_Y)
LV_Y_DOF = length(PR_Y);
else
LV_Y_DOF = 2*length(PR_Y);
end
end
% This ratio is F distributed if the samples are from a Gaussian populations with equal variances...
LV_F_STAT = (LV_Y_DOF/LV_X_DOF)*(sum(abs(PR_X-LV_X_MEAN).^2)/sum(abs(PR_Y-LV_Y_MEAN).^2));
RT_SIG = fcdf(LV_F_STAT,LV_X_DOF,LV_Y_DOF);
% The test can indicate that either the numerator or denominator of LV_F_STAT was too large to be expected. The significance
% in a two-tailed test is twice the value of the least likely possibility (only one has likelihood less than 0.5).
RT_SIG = 2*min(RT_SIG,1-RT_SIG);
STAT_F_TEST.rar_F-test_The Test
版权申诉
132 浏览量
2022-09-14
16:39:34
上传
评论
收藏 865B RAR 举报
weixin_42653672
- 粉丝: 93
- 资源: 1万+
最新资源
- #P0015. 全排列 超级简单
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈