⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test2n.m

📁 一个非常实用的统计工具箱
💻 M
字号:
function [pval, cimean, cisigma] = test2n(x,y,cl)%TEST2N   Tests and confidence intervals based on two normal samples%         with common variance.%         %         [pval, cidiffmean, cisigma] = test2n(x,y,CL)%         %         Input CL is confidence level for the confidence intervals,%         with default 0.95. Output pval is the probability that the %         difference of the means of x and y is as far from 0 as it %	  is, or further away, cimean and cisigma are confidence inter-%	  vals for the difference and for the common standard deviation %	  respectively. These are of the form [LeftLimit, PointEstimate,...%	  RightLimit].%%	  See also TEST2R.%       Anders Holtsberg, 18-11-93%       Copyright (c) Anders Holtsbergx = x(:);y = y(:);if nargin<3, cl = 0.95; endnx = length(x);ny = length(y);mx = mean(x);my = mean(y);m = mx - my;df = nx + ny - 2;s = sqrt(((nx-1)*var(x)+(ny-1)*var(y))/df);d = s*sqrt(1/nx+1/ny);T = m/d;pval = (1-pt(abs(T),df))*2;t = qt(1-(1-cl)/2,df);cimean = [m-t*d, m, m+t*d];cisigma = s*[sqrt(df/qchisq(1-(1-cl)/2,df)), 1,...              sqrt(df/qchisq((1-cl)/2,df))];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -