|
密度曲线
上alpha分位点
clear,clc,close all;
figure('color',[1,1,1]);hold on
x = 0:0.1:40; df = [1,4,10,20];
for n = 1:length(df)
y = chi2pdf(x,df(n));plot(x,y,'linewidth',2);
end
text(2,0.2,'$$n=1$$','interpreter','latex');
text(4,0.15,'$$n=4$$','interpreter','latex');
text(10,0.11,'$$n=10$$','interpreter','latex');
text(20,0.08,'$$n=20$$','interpreter','latex')
axis([0,45,0,0.25])
%%%%%%%%%%% 上 alpha 分位数
figure('color',[1,1,1]);hold on
x = 0:0.1:40; df = 10;alpha = 0.05; n = 10;
y = chi2pdf(x,df);plot(x,y,'linewidth',2);
fill([chi2inv(1-alpha,n),40,40:-0.1:chi2inv(1-alpha,n),chi2inv(1-alpha,n),chi2inv(1-alpha,n)],...
[0,0,chi2pdf(40,n),chi2pdf(40:-0.1:chi2inv(1-alpha,n),n),0],'m');
text(10,0.10,'$$n=10$$','interpreter','latex');
text(chi2inv(1-alpha,n)-1,-0.01,'$$\chi_{\alpha}^2(n)=18.3070$$','interpreter','latex','color','r');
text(19.9,0.01,'$$\leftarrow \alpha=0.05$$','interpreter','latex');
plot(chi2inv(1-alpha,n),0,'ro','MarkerEdgeColor','r','MarkerFaceColor','r')
axis([0,42,0,0.11]);%axis off
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-9 15:47
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社