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

📄 cmpmod.m

📁 一个非常实用的统计工具箱
💻 M
字号:
function [p, es, el] = cmpmod(Y, As, Al);%CMPMOD   Compare small linear model versus large one%%         [p, es, el] = cmpmod(Y, Xsmall, Xlarge)%%	  The standard hypothesis test of a larger linear regression %	  model against a smaller one. The standard F-test is used.%	  The output is the p-value, the residuals from the smaller %	  model, and the residuals from the larger model.%%	  See also LSFIT %       Anders Holtsberg, 27-07-95%       Copyright (c) Anders Holtsbergn = length(Y);ns = size(As,2);nl = size(Al,2);one = ones(n,1);if any((one-As*(As\one))>10*eps)   disp('Warning: perhaps you should include an intercept column of ones.')endif any(any((As-Al*(Al\As))>500*eps))   disp('Warning: small model not included in large model, result is rubbish!')endths = As\Y;Ys = As*ths;es = Y-Ys;thl = Al\Y;Yl = Al*thl;el = Y-Yl;Rs = sum(es.^2);Rl = sum(el.^2);z = ((Rs-Rl)/(nl-ns)) ./ (Rl/(n-nl));p = 1-pf(z, nl-ns, (n-nl));

⌨️ 快捷键说明

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