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);

weixin_42653672
- 粉丝: 120
最新资源
- 第3章数据库基础知识培训资料.ppt
- 11第十一章-网络基础.pptx
- 办公大楼(经济型酒店)无线网络覆盖方案.doc
- 企业信息化建设的实现及意义资料讲解.doc
- 设计软件测试方案.docx
- XXXX0509培训资料 Z68X系列产品介绍及Touch BIOS图解.pptx
- LTE网络优化分析报告.doc
- aspen化工过程经济分析与评价.ppt
- ppt课件:互联网产品智能设备发布大气商务通用演示.pptx
- CAD期末考试题答案.doc
- 南开大学2021年9月《计算机原理》作业考核试题及答案参考20.docx
- 车之侣汽车主题超市装修项目管理方案.docx
- 2019年最新网络技术工程师总结范文及最新工作规划.doc
- 2022网络安全工作实施方案.docx
- DB22_T_3332_2022_耕地质量指标划分细则.pdf
- 软件工程4软件设计ppt课件知识讲解.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


